instruction stringlengths 34 36.1k |
|---|
I'm just getting into OAuth2 and I'm a tad confused (you've probably heard that before)!
I am writing a small independent service which will expose a basic REST API enabling client applications to upload and download files. Please don't ask why I'm not using S3 or some other cloud provider service - suffice to say that... |
I'm working on a CMake module which, at some point, invokes try_run(). The file I'm compiling is not really part of the project's sources - it's not used anywhere. It's only ever useful for CMake, to determine some hardware-related setting.
Now, the module is under cmake/Modules/. Where, in my repository's folder hiera... |
I've been working on a personal project in C# whose purpose is more or less to allow the user to execute scripts written by other users and restrict the permissions of that script. My program compiles the scripts using a third-party library, sandboxes them using the .NET Code Access Security mechanisms and makes sure t... |
Just a general programming best practices question.
If I have a function like that takes in an array of items and the function then calls a series of other functions which filter and act on the items in the array, should execution continue if at any point we are acting on an empty array?
E.g.
arrayItems = [ 1, 2, 3 ]
... |
For example, suppose if I had a Character class and an inventory, before taking out a weapon to use it, it's probably a good idea to check if that weapon exists first, so I might have a method called has(GameObject weapon); that returns a boolean. I can then use it in an if statement like this:
if character.has(sword):... |
Out of curiosity, are there any languages that let you tag a function with an attribute that indicates that it may only be called from a single call-site, such that if any code tries to call the function from a second call site, the second call-site is flagged as a compile-time error?
For example (pseudocode):
unique_c... |
In Clean Architecture boundaries are interfaces, which I model in Python with abstract classes. The input boundary, which is between the controller and the interactor/use case does not need an interface in my opinion, since it just executes the use cases coming from a "higher level". Is this true?
Other boundaries make... |
I've developed an IoT device utilising OpenWrt so my design needs run a on a shoe-string budget of resources.
I need to be able to push small amounts of data, up to 300bytes to my app on a very irregular basis, something once a week and other time maybe 10 times a day, so I'm not looking to over-engineer this thing, b... |
Right now I'm doing this:
Update the readme to include the new version number and what it does.
Commit the version number in git commit message (i.e git commit -m "1.2.1: this does that").
Push the repository.
Is this the proper way of doing it? I had a hunch that this is wrong, because this way I have no idea how to... |
One of the requirement, in the complaint management system were are designing, is to implement complete history of the ticket. For example
Status was changed (new to pending to work in progres to done)
Ticket was assigned from one person to another
Ticket need extra details
Address was changed on the ticket
Descriptio... |
A part of a system I am currently reviewing, consists of a master node which calls several slave nodes using REST APIs.
The slave nodes are scattered throughout the world on different servers, and the master can run the job on the servers up-to every minute. The result of the API call will not take longer than about 50... |
during uat, the user realizes a major missing functionality that should be included in the system. this is not related to the implementation of the application, but with the design and the initial laid out initial requirements.
if you push the current state to production, the app will appear unusable since it is missin... |
I hope this fits more here than SO because it is mostly about code design than making it work. Also, this is not tied to RxJs, but more to the reactive paradigm. (TypeScript tag is only added to make the code highlighted.)
So this is what the code looks like, though this is just an overview. Actual function names are d... |
If my software has some screens, how do i express the various states of those screens? If, for example, I have 3 checkboxes in a screen, so I have 8 combinations total and at first thought, 8 states for that screen. What if there is a popover widget, a slide, etc... And all this variations combined represent many and m... |
There are a few questions similar to this one but I feel the situation is a little different because I do not have the methods available to me or they are not working. I have been working on a solo project for 7 months now and the thing that is really killing my productivity is getting stuck on one little issue like an... |
I have a question regarding HTTP methods and what would be most proper in terms of conforming to REST principles.
I have two services, A and B. When new data is added, or old data is updated at Service A (e.g. POST/PUT) it triggers Service A to contact Service B to let it know that new data is available. Then Service B... |
My coworker and I have having an argument. The Open and closed principle is defined as:
A module will be said to be open if it is still available for extension. For example, it should be possible to add fields to the data structures it contains, or new elements to the set of functions it performs.
A module will be ... |
As I understand, consensus is the mechanism that will ensure the ledger is kept in sync across nodes. Is that correct? Also its nothing new and wasn't something that was invented with the advent of blockchain. It is an integral part of distributed databases and has been around for decades. Many algorithms exist to driv... |
I am aware that this might be a question with only subjective responses, but i keep coming back to this thought.
When you are designing a software's architecture, do you group components by their kind of task or their "theme"?
For the lack of a better example, if you have a lot file exports to do in your application... |
For example, suppose I have an android application, in simple, there are 3 activities :
MainActivity -> Main2Activity -> Main3Activity
,which user can visit them in sequence (eg: by button click), also there is some global data to show:
public class GlobalData{
public static String userId;
}
public class MainAct... |
Can there be different use case diagrams for the same system with differing levels of complexity?
My question arises due to the fact that use case diagrams can represent a single system in a complex way (more use cases and different relations with detailed representation of each feature) or in a simple way (just an ove... |
White-box testing focuses on testing implementation details of a component. Black-box testing sees a component as a black box accessible only via its API.
Both Lean and Agile software development focus on the value delivered to the customer (Lean calls everything else "waste").
Taking this seriously, white-box testing ... |
I built a form builder with which administrators of the system I work on can build forms (or blueprints as we call them). The structure of these blueprints are as follows:
blueprint X
section 1
question 1 (Text)
question 2 (LongText)
question 3 (File)
section 2
question 1 (Text)
question 2 (Dropdown)
section 3... |
I'd like to share my approach to writing database applications for small businesses. It's possibly unconventional, but it's something I have been developing for nearly 20 years.
The approach I use is to place ALL the application logic in the database, with only a thin "dumb" layer which passes http requests to a SQL st... |
We have to support multiple releases, so we are following git branching model similar to the above diagram. Now the problem is that we have to do lots of merging here example for fix/011, we are merging it three different branches(master, release/1.0 and release/2.0). Also there is question of from where to create thi... |
I want to develop a virtual garden with a lot of kind of insects like ants, bees, etc...
For example, if I want to create an area of 10x10m².
I can implement this with ArrayList<ArrayList<Insect>> area an put all the insects in a specific position. With this approach, my space is limit of the array size, but I think th... |
We are about to develop a microservice architecture with azure functions inside azure. We thought about using interservice communication with durable functions.
On app site we want to use an async pub/sub pattern to publish request/commands through a single function gateway. This command will be forwarded to other dur... |
Introduction
In our development team, we divide developers into back-end and front-end teams. To develop a feature for a website, the 2 teams have to work in parallel. We starts by analyzing the requirement, talk about all possible business cases that should be handled, and have agreement on APIs interface specificatio... |
We are a central team, responsible for around 10 services. Other parts of our company depend on these 10 services to write their applications, and we often have to collaborate on new features before they're ready for production.
I'm wondering how to accomplish CD with this sort of situation. I'm sure it's been explaine... |
There is a series of procedures, each of which falls into one of two general categories.
Most of these are of category 1: it would be best to execute them one at a time - the overhead associated with threading or even using a thread pool negates any gains.
However there are a few of category 2: it would be best to move... |
I am running into this issue:
Suppose that there are two independent services, A and B, and both process messages from C.
Suppose that I have a service X that needs to know if a message m from C was processed by both A and B. What are the reasonable patterns to design such thing? How can I sync notifications from both ... |
I need to model the following requirement in an Entity-Relationship diagram.
"Customers place orders, which contain a list of products with their quantity and prices. A shipment is made when products are ready to be delivered to a customer. A shipment may include products from multiple orders, but only if they all be... |
I have an interval partitioned into “MECE” subintervals, and I want to check which subinterval a number lies in.
(MECE stands for “mutually exclusive & collectively exhaustive”, meaning the partitions do not overlap and they leave no gaps in between.)
First I simply used if .. else if:
; if (0/6 <= h && h < 1/6) { r... |
I am considering mutliple options to face a problem.
I want to develop software following DDD style.
The problem arise when I have to define my entities and I am working with Entity Framework Core, any other ORM would have the same problems.
ORM generates plain POCOs entities that represents the Tables in our DB. That ... |
Consider an Eg. of Library Management System, we can have a design where in a student can search for a book based on it's title from the list of books using a function, something like below (in c++)
std::vector<std::string> GetBookListBasedOnTitles(std::string title, std::vector<string> books) {
// iterate through l... |
While creating the architecture of a new project I struggle to come up with a good solution to handle public IDs.
For example our users will receive a membership card. Each card has the membership ID printed on it. But because in our branch of industry we expect cooperation with other businesses the format of those mem... |
As I can understand, assembly language is just a symbolic representation of hardware instruction opcodes that a hardware manufacturer has offered/documented, based on the way they have designed their electronics.
Now I saw the term "Windows Assembly" in another post. As I understand, Windows itself is a software that r... |
I am trying to figure out if there is a better practice for initializing class members of derived classes in ES6 - in the child or the parent, and why?
For example:
Option 1:
class AbstractAnimal {
constructor() {
this.voice = null;
}
makeVoice() {
this.voice.make();
}
}
class Dog extends A... |
A coworker of mine insists that this is the right way to write enums in C#
public enum ExampleEnum
{
InvalidItem,
Item1,
Item2,
Item3,
MaxItem
}
We have enums defined like this all over our codebase. Everywhere we use the enum we then check that the values are between InvalidItem and MaxItem.
To... |
There is a swarm of objects. When a new unit of certain kind appears on the frame, the swarm integrates this object by calling some add_new_unit method. Above the swarm is a controller abstraction, which handles multiple swarms of different types and the interaction with an image processing abstraction that detects uni... |
I wasn't sure exactly how to word this question, but basically, I have a struct stNeuralLayers (for a neural network I'm playing around with) with fields that are matrices (such as a double[,] neuralWeights field and a double[,] results field), and I have a field that's an array of those structs (stNeuralLayers[] fldN... |
I'm currently working on my own open source project.
There are two parts to it at the moment, a .NET core web API and an Angular client side app.
I would like to get your views on installation/setup for my users. What I have at the moment is an install endpoint in the API itself and an install component/page on the ang... |
We are working on several products as the IT department and we try to provide solutions for different departments within the same company. The core of our business is insurance and the main goal is to have automated processes for brokers, back-office people, and finance department (there are some other groups, but it i... |
For example, suppose I have a string constant like this:
const TITLEBAR_MESSAGE="Welcome back, %USERNAME%!";
I think it is more readable when it is named as
const WELCOME_BACK_USERNAME="Welcome back, %USERNAME%!";
because I don't need to move to the definition of TITLEBAR_MESSAGE to see what is the string context, a... |
I am writing a service, which is to be consumed by API and Web controllers. The result of each call depends on a UserContext state. Should I pass this UserContext with each method, which includes a lot of repetition, or include it as a property of the class, which requires the programmer to properly initialise the cl... |
I have ERP database whose good or person entities each have several hundreds of fields. Many of them are used for some subjects only. And hence senior companions (especially from the business division) are quite reluctant to allow me to add new fields when such need arises. E.g. I am not allowed to add such new fields ... |
Moderator note
This question has already had seventeen answers posted to it. Before you post a new answer, please read the existing answers and make sure your viewpoint isn't already adequately covered.
I've been following some of the practices recommended in Robert Martin's "Clean Code" book, especially the ones ... |
I am currently working on a program in which I encountered an issue (not for the first time) where I have two acessor methods for a data structure. The methods are identical, except one is const and returns a const pointer while the other is non-const and returns a non-const pointer. The code in the methods is non-triv... |
My team is currently making some changes to our solution structure. Before the change we basically had a single solution file with about 40 different projects. Most of these projects are libraries that are consumed by a handful of applications.
To improve the load and build times, we decided to split the solution into ... |
It is true that the bitwise left shift operation (shl) doubles the value of the integer being shifted. However, when constrained to a finite space, such as 8 bits for example, left shift will begin to push bits off the high-order word and will cause loss. What mathematical effect does this loss have on the number? Does... |
Is there a usable programming language that disallows all side effects except for its input stream (aka STDIN) and its output stream (aka STDOUT)? All executable scripts in the language should be guaranteed to produce exactly the same output when given the same input (unless they don't terminate soon enough). This excl... |
I have a microservice-based system that has a product service and a store service. I'm using eventstore to propagate events between microservices, so for example when a product is created, the store service receives a notification and can then add the new product to a store.
Now I need to implement multiple stores and ... |
Given that this question is related to my work, I will simplify what I need to do. The system consists of 4 primary types of statuses (internally, we call them events):
Working, not operating machinery.
Working, operating machinery.
Break period.
Off work.
Based on those types of events I have to keep 4 different cou... |
I have a load balanced service that needs two data inputs to correctly give a result.
One of these inputs comes from a queue, the other comes from user input.
Most of the time the data that comes from the queue arrives long before the user input. This data from the queue is saved to a database and when the user input ... |
I have a class called GatewayAPI, which has to load configs from a file, when used. I first wanted to put the get_config() method in the constructor, but I don't like this design for testing purposes.
Now I plan to do a factory, which creates this GatewayObject. Is this a typical usecase for the Factory Pattern?
Second... |
I have a DeviceManager class which can handle different physical devices, and to say there are Classes A,B,C, which require a DeviceManager instance as dependency. They should always use the same instance of DeviceManager, however, at some point of time this DeviceManager should create a new instance in order to wrap a... |
For me, the data I want to retrieve may be in database for which I can use properties of model and also relationships, but if the record is not a property and no relationship exists for that particular record, I need to check it from an API end point, so where I should place my API request code, is it okay to put the c... |
I have an implemented UDP receiver which is continuously receiving DTN packets (UDP encapsulated) and performing some operations on them. This whole process is working on a single main thread. However this consumes time on processing the packets and results in packet lost when a sender sends a huge chunk of data.
int m... |
I am modeling a system that exposes a number of "plugins" (not known at modeling time) through a web API. I have a number of "system" plugins that permit to interact with the system, something like "list plugins", "describe plugins", "submit job (plugin execution)", "get job status", ...
System and user plugins are exp... |
Say that we have Kubernetes running with n pods, each being a separate microservice. Now, some of those services need a caching layer. When we take into consideration:
the fact that Redis was tested to hundred of millions of keys and that it was performant
the fact that you can tag keys by namespaces (which would be ... |
I have a User class, this class handles things like:
login (UserAuthenticateModel)
Handle user sessions: user login tokens, fetching user from session if set in session, ect' (UserSessionsModel)
Fetch & Set user data to populate $this user object. (UserFetchModel)
Update & change my user data (to this user object - a... |
I'm building a helpdesk-type system, where there are:
Customer - can submit/resubmit tickets;
Manager - can review submitted tickets, assign to developers (one ticket to multiple developers), review completed tickets, decline then and mark as complete;
Developer - can work, close and decline tasks.
For now I have 2 c... |
Dynamically apply methods/"rules" to documents
I hope someone here can help me/guide me in the right direction. I am currently creating a web application, where users can import a text file, and then programmaticaly apply different methods on the text.
Example
Imagine that an user have imported a text document, that lo... |
I know it matters for class libraries, but does it matter in projects that are not class libraries, e.g. console applications or GUI applications?
What's the difference if I use public or internal or private when it's a console application and it won't be reused?
Is it worth the effort to add access modifier in such ca... |
I want to create a class ProcessHandler for Windows that pretty much uses the WINAPI.
The class ProcessHandler should be able to scan memory, emulate keyboard and mouse, needs some DLLInjector, some hooking, and provides some process information. Since I want to use some design principles, I think I should split every ... |
I am wondering if the following would be a good technique to allow user to download files from the server in the below scenario:
Info about the scenario:
User logs into a system (HTML,JQuery and CSS, Javascript based), There is a Download button in the UI. Clicking on it triggers a backend Java Message based (JMS)proce... |
If I had an application that pretty much had a "fail-safe" as in, if I need to terminate the application quickly and not free the malloc'd memory, or close the threads that are running, would Windows handle giving the memory back and terminating the threads?
|
If I could get some input on the design of this, I would be grateful as well.
Note that I'm programming in python.
There's a function F that takes lots of data, runs some analysis on it (taking maybe a minute or more) to compute some crucial fruits theta, and then spits out a function g(x), that has a lot of functional... |
By default, the HTTP response code for "file not found" has always been 404. I never really thought about it until recently someone was saying that if the missing file is part of an application then the response should be 500 (internal server error) because it's not a client error (4xx error class). The example for tha... |
I'm trying to figure out how to create unit tests for a function, which behavior is based on a third party service.
Suppose a function like this:
def sync_check():
delta_secs = 90
now = datetime.datetime.now().utcnow()
res = requests.get('<third_party_service_url>')
alert = SlackAlert()
last_value =... |
Considering a medium-big software with an n-layer architecture and dependency injection, I am comfortable to say that an object belonging to a layer can depend on objects from lower layers but never on objects from higher layers.
But I'm not sure what to think about objects that depend on other objects of the same laye... |
We're developing an Angular application that consumes a web method exposing some information that is not sensitive, just bus seat promotions; the user enters where he wants to go and when and he will be presented with the available offers (if any). The site does not require any kind of authentication for this informati... |
I wanted to summarize a quick discussion we had in my stand-up today. We have a big feature branch merge coming up in our system. We are replacing the old live, system (branch master) with a redesign (branch feature/v1). In addition, there are 2 other branches--feature/celery branched from feature/v1 and feature/aggreg... |
I have an OO design concern. Let's say my models as following:
class Account {}
class LocalAccount extends Account {}
class SocialAccount extends Account {}
These Account entities are persisted and I could retrieve them (or do more operations on them) through a typical Repository. Let's say I have the following interf... |
I'm working with a 3rd party company who are providing an API along with an unusual security approach.
The security approach is essentially using a JWT by itself (no oauth). What's odd is that they're expecting us (the client) to create the token which seems the opposite way round.
My API will communicating directly ... |
OK, so I have been at this problem for the last few days, and I must admit - I am stuck.
I am trying to make a web application, where users can upload documents or send inbound e-mails.
Each document or email will be added to a stream. So a stream holds all the docs/mails.
Now, what I want to allow my users are the fol... |
I ran into a situation where my build speeds have started to become large and have affected productivity. I had already minimized header dependencies before using forward declarations. Now I've turned to forward declarations to further reduce these dependencies as a method of trying to reduce compile times.
I unders... |
I am working on an application that involves alerts as well as notification policies for multiple users. I am using microservices and am trying to keep them stateless if possible. I have one service that will do the alerting and another that stores and handles policies.
I currently have it partially working by the aler... |
I'm currently doing a web based system for multiple organizations, so on my login form, there's 3 simple field:
Company code, such as CNN (this is implemented so we can have same username, as long as they work in different company)
Username, such as James
Password
Now we are actually studying on the fingerprint authe... |
I have a parent object that has some other objects as fields. The parent object fully owns these fields: they can be declared as fields of the parent object (MyPart part), directly, not as references.
I would prefer to initialize these fields in constructor, but in some cases they do need to reach the parent object ins... |
We are doing an architectural refactoring to convert a monolithic J2EE EJB application to Spring services. In order to do that I'm creating services by breaking the application against the joints of its domain. Currently, I have three of them and each calls another service via Rest.
Our domain contains User, Customer, ... |
I'm approaching the TDD methodology for software development, reading guides and writing simple applications, because a client of my company wants a software and asked to develop it using TDD methodology.
So I was wondering, besides "trusting" the documentation and reports we'll create, how can one understand and be ... |
I have the need to distribute a set of long running jobs across a cluster of containers in ECS. These jobs essentially would need to open a socket connection with a remote server and begin streaming data for import into a database.
For each customer, there may be any number of socket connections required to consume dif... |
I am reading Docker deep dive since I am interested in this shiny technology.
I can read:
The VM model then carves low-level hardware resources into VMs. Each
VM is a software construct containing virtual CPU, virtual RAM,
virtual disk etc. As such, every VM needs its own OS to claim,
initialize and manage all o... |
The question is not very expressive, anyway what I was wondering is if, if I follow the red-green-refactor cycle for each method is still TDD or if it has to be done globally.
I mean, let's say I have 5 methods to test, I can follow two roads:
Write tests for all methods, start test routine, add code to methods, add r... |
---- Description
I'd like to optimize read operation in my service. It has basically put and get methods.
On put I accept some numbers in a string format and put them into thread-safe cache with timed expiration policy. On get I have to perform some math.
Put has concurrent nature and get is non-concurrent, each entry ... |
This question is NOT about what's here: https://stackoverflow.com/questions/25960192/mocking-ef-dbcontext-with-moq and/or similar questions. I am well aware of that. Please, read the question before replying. Thanks.
We have a fairly complicated database, which has some, call them, "business objects" (transactional da... |
I have developed a package program 3 tiers architecture. Persistence layer is developed by using Repository Pattern and Entity Framework 6 Code First Approach.
This package program has many features and I define a Super User(Admin), who has all rights, in initial creation script. So, the operation of the company can c... |
I'm trying to formulate some requirements using the ISO/IEC/IEEE 29148 standards. I know that the following is correct according to the standards.
The system [Subject] shall stop [Action] only when the stop-button is pressed [Condition].
I'm trying to do the same but for two conditions, as follows:
The system shall sto... |
How to write unit tests a method with a result that is highly based on another method ?
async function getStatus(
session,
correlationId,
data
) {
const client = new SomeAPIWrapperClient({
correlationId: correlationId,
timeout: 10000
})
const result = await client.createSession(data)
return res... |
I have a static website with lots of similar pages. The site is very simple, basically just some information for me and a few other people. I'd basically like to spend as little time as possible maintaining it.
Certain pieces show up on every page, and change every so often (the header and footer, for example, but othe... |
I have a large number of record types derived from a binary format specification. So far, I've already written a computation expression builder that let’s me read structures from the files easily:
type Data = { Value: … } // Data record
let readData : ReadOnlyMemory<byte> -> Result<Data option, exn> = // This function... |
I'm working on the research to resolve the Requirements conflicts in distributed Scrum where teams are distributed over multiple locations. I'm proposing a model that consists of five steps including identifying redundant requirements, removing them, assigning unique IDs to each requirement, storing requirement informa... |
In object oriented programming, it is commonly said that each class/object/instance should have a well-defined purpose. For example, there may be a Window class in a windowing toolkit, a ChunkLoader class in a Minecraft-like game, or a Matrix<> class (template) in a linear algebra library. In each of these cases, the c... |
As far as I understand, OT works really well with concurrent editing. There is only one remote copy of the document, and all editors update that remote copy simultaneously. There is a concept of lag in editor actions, but the lag is never big enough to significantly change the document.
If we add offline editing capab... |
I have a cluster of micro services with an exposed search API serving a client app. I want to "stream" in real time the aggregated results of a complex search. The search will be kicked of by the client calling the search API which in turn adds a message to a queue. This will be picked up by an orchestrator service whi... |
I want to make a centralized log web API, so it will have a large amount of data per seconds. the logs will comming from others WEB API
I was thinking if i make the REST API, all of the POST made need to return an answer and maybe can overload the server with so much request.
then I think in webSockets, establish a com... |
I'm working on system that analyses non-trivial amounts of data. The analysis is pyramidal, in that various combine to make intermediate values, which in turn combine with each other and more inputs to make higher-order intermediate values, and so on, until the value is produced. As a simple example: inputs A & B combi... |
Why do we need Models when we could:
Only get the data (which is to be displayed)
Populate the ViewModel with this data
Pass this ViewModel into the View
|
I want to design a hash table library that keeps usage statistics and based on how it is used will use different implementations at runtime. For example use a certain implementation for small size hash tables and a different one for large ones (or tweak parameters to maximize cache hits).
For example let's say I have a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.