instruction stringlengths 34 36.1k |
|---|
We have a project that is meant to do signal processing. If all we had to do with the software was that one job, we would have a pretty clean architecture. Unfortunately, we've run into an issue most other projects standard enterprise projects don't ever deal with. We need to generate a qualitative scientific analysi... |
So I am very new to creating design diagrams. I have a scenario where a user who is an admin of pizza hut selects registration option and the system prompts them to enter customer details.
Upon entering the customer details, the system creates a username and password for the customer and notifies the admin that the cu... |
In python documentation, I found that every object has a type, identity, and value.
Does this mean that the object also contains/stores their memory address??
Or are they just created at some memory location containing/storing the type and its value?
To me, the 2nd definition makes more sense although theoretically, w... |
I am writing a program that describes different properties on a single Management Company's plot of land. For this program there are 3 overloaded addProperty method's. My question is I can reuse the more general addProperty(Property p) method within the other 2 addProperty methods.
public int addProperty(Property p) {... |
I have an interface Event and a class Agent.
I want to be able to write something like agent.handle(event).
However, the classes that implement the event interface will all have different fields and things that the agent.handle method would need to know about, and so I'm struggling between either:
A switch on event t... |
Suppose I have a set of related types that are returned by a function, treated
as a group and have certain shared features. In a classical OOP I would
achieve this by having a base class and then implementing
each of the related types by subclassing said base class. In Go it would appear
the main way of achieving this ... |
According to Wikipedia:
In mathematics and computing, hexadecimal (also base 16, or hex) is a
positional system that represents numbers using a base of 16. Unlike
the common way of representing numbers with ten symbols, it uses
sixteen distinct symbols, most often the symbols "0"–"9" to represent
values zero t... |
I've read a lot of useful articles about collaboration with git. Many do's and don'ts, etc. For example, Top ten pull request review mistakes and a nice article about git workflow The Perfect Code Review Process, which is a nice way of doing it. Quite similar to the famous A successful Git branching model. I also reall... |
So, I am making a pure 2D shooter in Unity, and I was thinking about cheats a little bit (Yes, I know that nobody is going to play my game but anyway).
I was wondering if you can get pressed keys directly from a keyboard (or mouse) and compare it with pressed keys in the OS.
For example, I am pressing A on the real k... |
What was the rationale for choosing the name self instead of this when defining class methods in Python?
Yes, of course, you can name it whatever you want - but the widely agreed-upon name for the first parameter is very clearly self.
I ask because there was an article about Robert Dewar explaining why : was added to ... |
I'm developing a web application using Spring Boot and React, that needs to return information about hotels from different cities:
As an input of the controller, I receive a list of cities that can go up to 50. Additionally, the user can filter the search using many criteria (hotel rate, price, etc.)
As an output, I h... |
I have some Arabic content that is justified according to western conventions.
I justified it because it is justified in ancient sources:
However, the way Arabic text justification works is by stretching the cursive words, instead of the whitespace.
So what I would like to do is go into the font source, convert it to... |
I would like to make an request to all instances of my application. Flow of request is as follow( F5 load balancer -> reverse proxy - apache server -> my application) I do not want to make public ip endpoint on all instances or create service discovery server if it would not be necessary. Are there any simple solutions... |
I need to draw a UML Activity diagram for a school java software engineering project I’m required to do. I’m quite new to this and I’m not sure what should be shown and what should not be shown. For this question, I’m interested to show the activity diagram from user input till before the statistics feature produces th... |
When I call an API endpoint I have a class to create an object with the response. The object directly maps the endpoint elements so I have all values, with properties, getters, and setters.
In my problematic scenario I want to set object(s) for 2 endpoints which both represent the same entity, however one has an additi... |
I'm starting a new asp.net mvc core project and for my infrastructure layer I'd like to use WebAPI as this layer should be usable in other solutions besides this one.
I'm not really experienced with that and at the moment I'm thinking of having 2 contracts and 2 implementations for them in the infrastructure layer e.g:... |
My Business unit has huge number of developers (About 100). Due to various reasons, the developers are nearly solely focused on delivery rather than quality. The bad quality code has already started hurting us. The bugs have become difficult to identify. The code has become fragile. The unit tests are quite disconnecte... |
In the "Structure" section of the Iterator design pattern, the book Design Patterns: Elements of Reusable Object-Oriented Software defines the Iterator class with four basic operations: First, Next, IsDone and CurrentItem.
In the "Implementation" section, the book contains the following item:
Who defines the traversa... |
I'm creating a library, and I would like to provide a tutorial on how to use the library. Such a tutorial will contain code snippets as usage examples; therefore, I would like to test these snippets to make sure the code is correct.
How can I test examples in the documentation?
I'm thinking about some kind of interleav... |
I would like to ask what is the preferred way of passing additional state to projections.
I have UserAggregate that is watching changes of several attributes of user (for instance address, name and state).
I have to read a model or projection that need all user attributes on any change.
Is it better to just write all ... |
I have inherited a distributed application with a lot of legacy configuration management.
Currently the application does not get it's settings updated with an application update. The flow looks something like this:
The application is updated. The only settings that are defined are one's with hard-coded defaults.
A sep... |
Pseudo code and comments to explain:
// first select companies to process from db
foreach (company) {
// select the employees
foreach (employee of company) {
// select items they can access
foreach (item) {
// do some calculation and save
I believe this will be O(n^3) time complexit... |
While refactoring my code using Test Driven Development (TDD), should I keep making new test cases for the new refactored code I am writing?
This question is bases on the following TDD steps:
Write just enough of a test for code to fail
Write just enough code for the test to pass
Refactor
My doubt is in the refactor ... |
Startup Context
A friend of mine recently asked me to be a part time software engineer for her startup which has yet to write any code. She is fairly serious and has already raised a fair bit of money. However, she currently doesn't need someone full time for development.
There are no legal issues with my current empl... |
Im trying to make an activity diagram , but i see that activity and swimlane diagram is almost the same, the only difference i see that swimlane diagram include many actor in it
i wonder about the activity and swimlane diagram, what is the difference , and when to use activity / swimlane diagram
|
Following this post https://stackoverflow.com/questions/21554977/should-services-always-return-dtos-or-can-they-also-return-domain-models and best practices in Software Arch suggestions by Martin Fowler
https://martinfowler.com/eaaCatalog/serviceLayer.html#:~:text=A%20Service%20Layer%20defines%20an,the%20implementation... |
I'm writing documentation for a school java project I'm working on. Basically have chunked most of the methods into the class diagram, but now it seems very unreadable on a pdf as the words are too small. I want to ask for feedback on this issue, as well as other things my class diagram is missing. Thanks.
|
I am building a system that consists of multiple programs on many machines, some cloud services (such as RDS) and so on.
In an ideal world, I would like to supply some configuration (e.g. deployment keys, AWS credentials) and run a single "deploy all" command that will build and deploy everything.
I would also like it... |
I have a process which must do 8 steps, in a particular order. One of the step involves sending an email, another one going on a distant FTP server, another one querying a database, and so on.
Now to be able to unit test these 8 steps, each of them is a method in a distinct class. So far so good.
Now the problem I'm fa... |
I have been using Netbeans to practice JDBC coding. Netbeans projects create multiple sub-directories (/build, /lib, /src...). Should I add and commit all of these directories and files or should I only choose the java code located in /src?
I am new to Git and have been using YouTube to learn syntax but I have not foun... |
In Robert Martin's seminal 1996 article "The Open-Closed Principle" he presents an example in C which does not follow the principle (the DrawAllShapes() method is not closed for modification):
enum ShapeType {circle, square};
struct Shape
{
ShapeType itsType;
};
struct Circle
{
ShapeType itsType;
double itsRadius;
... |
I s it possible to develop a distributed memory pointer in C++ by using operator overload?
The idea would be that you pass ip address and port to the overloaded pointer *, &, and the pointer returns the memory location of remote computer.
|
I want to develop a Windows based application that would interface with external hardware using serial communication. The hardware would in turn relay back the feedback to the application. This entire loop should be ideally completed within a millisecond.
Is it possible to develop such an application on Windows OS? I ... |
I'm currently creating a class in C# that will be utilized to help standardize calls to restful web services in my company's code. While the majority of my code has been written and well tested, I believe I made a mistake by assigning a default value to one of my properties in the default constructor.
The property in q... |
I have code in a (Visual Studio) Shared Project, and a number of end solutions/projects which compile and build the Shared Project to various environments (repo).
When writing unit tests, I will want to unit test for each environment.
Should my test project reference the code in the Shared Project directly? Or should I... |
How can a user story be independent and small (following INVEST acronym)? Most of the time we have big functionalities that depends on each other.
As an example, we made an interface for users where they can define zones on a picture (this zone list of zones is called a "model"). For each zone, user can define a folder... |
The main subject of my question are the user stories, after they have been put in the backlog, discussed, refined and ready to be put into the upcoming Sprint. Do they have to list all the possible detail and all the possible scenario?
Our team of 10 people spent almost 3 hours of the Refinement meeting discussing ever... |
Assume we have a desktop application (probably WinForms) that acts as a client to some API for an app with a messaging function. This API has endpoints that return a JSON of messages, and who sent them and where they sent them. A messaging feature is to be implemented in the application, so that messages can be sent an... |
I'm currently in the planning phase / feasability study of a rather big web application which is meant to be implemented using Laravel.
My own experience on the matter is rather limited but I'd like to take the opportunity to further my skills and, if successful, release the basis of the code under MIT license for anyo... |
A Quick Note
I know the question title is a little odd but I haven't had much caffeine this morning so I'm having trouble thinking clearly right now. If you have any suggestions for a better title, please comment below and I'll update.
The Problem
I've built a custom logging solution that allows us (my organization) t... |
I am developing an application that has some features which are only meant to be available to members of the company while the majority of the application is for public use.
Having two separate repositories is a nightmare, since many bugs, feature requests etc. related to one are relevant to the other. Is there any go... |
What are some ways of documenting pitfalls and gotchas when working with a codebase with a team of developers? I'm working with a team of developers on a big codebase and there's lots of small little things that cause headaches and frustrations in code, configuration, and testing. It doesn't seem appropriate to put the... |
Watching this talk about Symfony Forms and validation, at 23:06, I got stuck with a doubt
I couldn't find a satisfying answer to:
Is it a bad practice to execute a query (or a web request, or a side effect in general) inside a validator?
In my case, I have either Symfony Validation Constraints and some implementation o... |
My question is simple: What steps should you take to protect research from the vast amount of spyware or insecure applications on a given device?
Background:
I do research into developing new models for machine learning applications. Security of this research is of high importance. This is because developing a new mode... |
I'm currently designing a system that, no matter how hard I try to break, slow network, failures, random server deaths, it can recover and it can re-build again. Each action it does is a fragment and it can pick up from where it left off. Each fragment is signed with a "done or not" and, again, it can resume work no ma... |
I'd like to see if there has been any precedent on alternatives to nested-ifs--particularly for error-code returns. My workplace requires one return per function, so I cannot early exit. Here is some sample code, rewritten to protect confidentiality:
static ErrorCode_t FooBar ( Input_t input ) {
ErrorCode_t errorCo... |
Originally https://stackoverflow.com/q/58816567/369489
There are tow separate projects within the same organization: P (product, at version p) which depends on L (library, at version l). p lists l in its dependencies and all is well.
The new feature X requires changes to both P (->p+1) and L (->l+1). The changes are s... |
Question about OO-programming, functional programming, NoSQL, SQL databases, and software architecture
Hi all,
I am a intermediate-level self-taught programmer, and have been dying to get an answer to this general question about how to structure my apps. Having no CS degree and only a few programmer friends, I haven't ... |
I'm very new to databases and have no knowledge of how to design them.
I've been using ASP.net Core to develop my website/API
So what I want to achieve is that remote devices log their temperature value every 10 minutes. I want to do this with potentially 100.000 devices, for multiple years.
Later I want to show the d... |
Context:
I have a case where I need to extend some existing functionality for loading a new version of an xml file into a system (new fields, some mandatory that were not mandatory before, etc). The file contains some heavy information, but to keep things simple I will use a simple case.
The xml file can be something l... |
We have two main branches here, master and development, and feature/bugfix branches come off of development. The issue we're having here is that we can't just merge development into master when doing a production deployment, because it's not guaranteed that those changes are thoroughly tested. What we've been doing is ... |
This question is more theoretical. I am studying to certify in AWS, I am reading for the second time the certified solutions architect study guide of aws and it is not clear to me what is the use that can be given to an ENI, I understand that they are used to connect a VPC with other services. Could someone give me an ... |
My question is about a use of while loops that seems very abstract to me. I understand a while loop like the first one (one which has a clearly defined statement):
num = 1
while num<1:
statement1...
statement2...
but, then there's something like this:
num = 1
while num:
statement...
statement2....
wh... |
I'm the maintainer of an ASP.NET WebForms application and am contemplating a refresh of the application in order to eliminate dependency on some legacy libraries, add some features, fix some areas where application behavior does not adequately match up with real-world business practice, etc. So, I'm looking into curren... |
In Python variables that are created outside of a function are known as global variables. However to create a global variable inside a function (a local variable), you can use the global keyword.
My question is, what are the situations for when a global variable should be inside or outside a function?
|
I am curious about the Difference between direct and indirect function() calls
Could anyone help in the diff analysis ?
The c source code could be found at subroutine_direct.c and subroutine_indirect.c
Note: the diff could be regenerated using command : objdump -drwC -Mintel subroutine_indirect
|
I am working on an embedded software project, whose output is an executable which will run on a linux device, using C++.
The app uses peripherals. Some kernel modules are not loaded when the system is powered on. Hence, I am forced to load them manually by modprobe. Currently, I am using a script to accomplish this an... |
I have a little doubt on about get a class in base of an object passed to a function.
In my case, I can two different types of object: classA, classB that have the same interface.
I have to pass one of that object to a service and get its repository.
I have thought something like this:
classA implements MyInterface {
... |
I am trying to implement DDD along with Hexagonal Architecture. One of the things that I am struggling with is validations. I had explored a lot of articles on where the validation should be but it seems there is no one way. I would like to find the most appropriate way to implement in my scenario. Here is the scenario... |
Although our products often have the same requirements, the solutions are always developed anew. From different people, with different good results and different quality. A code library especially for the needs of our products seems to be a good idea.
I think the main problem would not be to develop this library, but t... |
This is more of a procedure and maybe a philosophical problem.
The development team I am in is divided into Scrum teams or Squads that work on the same product. Occasionally, either one of these squads would have to embark on something 'big' such as a revamp of a core functional or component, database upgrade, etc.
T... |
I have a coding style related question. In my example it is java, but I think this can be a generic question regarding languages that are changing rapidly.
I'm working on a java code base which was mainly written targeting java 8. The code was migrated to java 12. By migration I mean the code can run on jdk12, so the n... |
I have a ecosystem simulation where animals move and collide with each other.
Here is how I handle collisions:
public void HandleCollisionBetween(Animal a, Animal b)
{
if (a.GetType().Name == b.GetType().Name) { // same type collision
bool fishCollision = a.GetType().Name == typeof(Fish).Name;
... |
I am at the beginning of designing a system to be deployed across a job site, your boring, dime-a-dozen, database server backend multi-client system.
One feature that I am very keen to implement in this system is the ability for a development team to making running changes with requiring a client reboot. I'm not so muc... |
I am working on an application with multiple threads (using Qt, C++). One of this threads is designed to execute a batch of operations like reading/writing from/to files as well as creating new ones. Sometimes, while this worker thread is active, I need some sort of confirmation from the user for operations like overwr... |
Array := {"title": "Book Title", "author": "John Doe"}
Some people use the following terminology:
title and author are keys.
Book Title and John Doe are values.
"title": "Book Title" and "author": "John Doe" are elements (= key-value pairs).
But some people - this one:
Book Title and John Doe are elements (= valu... |
I try to figure out how to manage versions in an monorepo where one of the packages is an application that needs to support multiple releases.
Assume we have a monorepo with just two packages: lib and app:
repo:
- lib@2.0
- app@1.0 (depends on lib@2.0)
app@1.0 is released release-app-1.0 tag is created.
We continue to... |
I have a python forecasting application that, for a given Entity, executes a fbprophet model multiple times varying the hyperparameters for each execution while tracking the best fit across the runs. The models need to be run in parallel to minimize run time. The data associated with a given Entity is small (~1mb). The... |
When you encode a code point to code units based on UTF-8, then if the code point fits on 7 bits, the most significant bit is set to zero so that it tells you it is a character which is stored on 1 byte (or more precisely 7 bits).
If the codepoint occupies more than 7 bits, then the number of leading one bits of the fi... |
I'm asked to input 15 to 25 sets of data into a website once daily. It requires logging into the website, clicking a button, then selecting 2-7 checkboxes, clicking button, selecting up to 3 more checkboxes, then inputting numerical values for each of those checkboxes, then clicking a 'save/next' button. This proces... |
A C coder here.
My wish is to find the best way to search words and phrases within the ever-growing English Wikipedia XML dump. As a first layer/step, hashing is the answer, yes?
The problem is that the latest dump is around 72GB in size. Would appreciate more experienced coders sharing their vision on the matter.
As a... |
I've heard that when you designing a microservice, the service should includes everything it needs to make them loose coupling instead of calling each other (services).
Based on this idea, should microservice manage their file logics like this:
UserService:
CreateUser()
UploadAvatar()
VideoService:
CreateVideo()
... |
I have an application that returns projects. A Project has many Tasks each Task has a field called hours. A project returns the total hours for all the Tasks that belong to it.
My application processes hundreds of thousands of tasks updating and synchronizing. In the past, I have done no calculating when a task gets sa... |
I have been using c# and trying to learn FP. In context of FP I often hear that usage of basic assignment or return statements are not considered composable, hence their usage is not advised in FP paradigm.
I already found this older Stackoverflow question "What does composability mean in context of functional programm... |
I am currently using RabbitMQ to aggregate the output of various data sources.
Functionally the process is the following:
The user enters a product name.
The request is sent to the different sources via RabbitMQ.
The results are returned asynchronously.
The responses passe through an entity resolution service to make ... |
Please let me know if this isn't the right SE site (or otherwise) for this kind of question, it's the best match I could find.
I'm working on a humble interpreter written in C for a simple language I'm designing. I ran into a design problem in the interpreter which I'm sure people have already solved, and I would like ... |
I want to be able to analyze a five-years archive of supermarket receipts. The receipts are scanned, and thanks to Google Cloud Vision API, the result of an OCR is available. Google's API, however, gives only the text and its geometrical position on an image, nothing more. Example:
ID: 5620
Content: “TICKET”
Vertices: ... |
I'm trying to figure out if the use of schemas on non-relational schemaless databases like MongoDB is a recommended practice or a bad practice to be avoided.
I am doing research work and am looking for objective arguments in favor or against this practice.
|
This argument has been going on for weeks:
Bot.getGuild().getMembers().stream()
.filter((final Member m) -> m.getRoles().size() == 0)
.filter((final Member m) -> !m.getUser().isBot())
.forEach(JoinListener::assignDefaultRole);
vs.
Bot.getGuild().getMembers().stream()
.filter(m -> m.getR... |
Scaling down for the sake of the example, my project is structured like this:
solution X
project A
project B
Project A is exposed as nuget packages externally, project B need the functionality provided by project A.
Those projects are there because of proper namespace attribution and logic isolation, not bec... |
I was watching the Coursera algorithms lecture series' portion on tries. R-way tries are introduced first, where each node has an array the size of the possible character space (R) with potential children -- for instance, an ASCII R-way trie would need 256-element arrays. It is then explained that for many applicatio... |
I've been reading about this thing called dependent types.
So for example imagine a function firstNPrimes(int n) which returns an array of length n. In other words the type it returned would be int[n]. (In normal programming languages without dependent types all we can say is it returns int[] where the type doesn't sp... |
I have multiple databases (MySQL, all identical except data, can delete arbitrarily from any) across multiple machines which contain large quantities of sentences (~ 1e+11 per database, ~ 4e+12 in the whole system). What I want to do is delete all duplicates across these databases.
The first idea that came to mind was ... |
I have a Raspberry Pi with a ConBee 2 (ZigBee) interface connected. The ConBee provides a websocket I can connect to to get push notifications on sensor changes. And I want to forward those notifications using a HTTP method URL.
The current status is that the ConBee (Phoscon) is operational, and I receive push notifi... |
I am a beginner in computer science and have been asked to write a program to convert a binary tree into a circular linked list (order of the nodes in list are in inorder traversal of the tree).
I would like to understand the purpose of such a conversion. May I know any real time or real life applications of such a pro... |
In an order management system for example, what's the best way to plot the states of different objects that overlap and interconnect at different states?
Example:
Order object will have states like Draft, Confirmed, Placed, Picked, Delivered...etc.
Invoice object will have states like Opened, Paid, Closed...etc.
Know... |
Suppose that I have a class that is returned only as a byproduct of another "main" class. I am using a Test Driven Development (TDD) workflow.
Should this byproduct class be unit tested independently or should I be considered as an implementation detail of the "main" class I am testing?
Example:
Suppose I have the fol... |
I have an application which records the company man hours of employees and other related details. Because it gets updated everyday or when a new employee is added, it tends to lead to a very large data set. To analyze this data, I'm planning on using Power BI.
The issue that I'm running into is that the REST API is on... |
I'm implementing an event-driven game in WPF and have the following Blackjack class:
public class Blackjack
{
public Dealer Dealer { get; } = new Dealer();
public Player Player { get; } = new Player();
public IList<Player> AiPlayers { get; } = new List<Player>();
public event EventHandler<EventArgs>? ... |
Imagine a backend service modeled by a hexagonal architecture, where the domain has a class modeling, let us say, a Step of a creative flow that a mobile app will use:
class Step(
val stepId: String,
val description: String
)
The description should come to the client translated according to the User preference... |
I am newbie to angular and Ionic world and trying to figure out the right stack to get started with my requirement to develop a hybrid mobile app.
I understand that Ionic is a wrapper around other JSframeworks as well as Angular. My requirement is to build a hybrid app that runs on web as well as Android and iOS. I che... |
Suppose I have two classes that implement the same interface, as in the example in C# below:
public interface ICommonInterface
{
string Text { get; }
int Count { get; }
}
public class ImplementationA: ICommonInterface
{
// Implementation A
}
public class ImplementationB: ICommonInterface
{
// Implemen... |
Sometimes when writing a unit test using Test Driven Development (TDD) one may find that checking if the result is the correct one is "more complicated than one line of code", probably deserving its own function.
In that case, writing an auxiliary method or even helper/ extension class could be something that comes to ... |
So I have made a pull request to change this code:
//Controller:
...
[HttpPost]
public ActionResult Unauthorize(int userID, int permissionID)
{
_permissionService.UnauthorizeInternalUserPermission(userID, permissionID);
return Json(new Result());
}
... |
I want to use rabbitmq to share domains events between microservices. Due to the fact that queues are round-robin, I need to define one queue per event source and event consumer.
For example, cars-ms emits the CarRepairedEvent and should be consumed by notifications-ms and trace-ms. I though about using a fanout exchan... |
My first programming language is C++. C++ is a multi-paradigm programming language. One of the paradigms C++ supports is Object Oriented Programming. I want to say I get the general idea and benefits of OOP as is exemplified in C++.
I have recently started creating a project in Android Studio. One of the languages Andr... |
When you are done with programming, you may have used many libraries that you maybe had to buy, different software and tools and then when your run your programm, your programm compiles and calls constructs from different libraries and everything works fine, but when we are done and want to sell our software we are sel... |
in my system users register with their email address and receive a temporary link to log in.
hostname/login/OYkwIJt6be1V5kMg10G
The token must be generated from the email adress of user and valid for 2 hours.
I don't want to store a session or token in a given database
In my mind I imagine creating the link like thi... |
Is there a way or design pattern to add supporting information to the existing java object?
Example I have a model class Parent and it has child models. Its nothing but hibernate entities with parent-child hierarchy. The parent class object is being pass through multiple Java business rules class. I would like to add s... |
Updating the libraries in my Angular 8/Electron app produced compilations errors eg, in Electron's menu.ts file, Also, a few of the project external libraries contain @ts-ignore lines, suppressing compilation errors. Some of these have comments "safe to ignore because..." while others don't.
As I couldn't solve the ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.