instruction stringlengths 34 36.1k |
|---|
I'm having a bit of a hard time figuring this out. I have a model (which you can see in the image below) this model can be changed (it won't happen often, but it can). When it changes I do not get the changes I get the ENTIRE data set, I get this set in the following order (don't know if it's relevant): First i get all... |
During working on a pet project in microservice event driven architecture, I've faced a problem of delivering responses to a client.
Each microservice (API Gateway etc) has many replicas and has it's own loadbalancer (Kubernetes Service).
Use case:
20 clients (JS App) sends "Register account request"
10 clients get c... |
I am not to sure if this is a question which fits the topics of software engineering.
I have two levels of objects "Categories" and "Category Values". I need to build a user interface for users to choose from that items and select as many as they want.
There can be like 10 or 20 Categories but each category can have fr... |
We have decided to code the new project in TypeScript at the company. Does this mean that everything should be coded in this language?
Discussion
My first thought was Yes. On the other hand TypeScript is compiled to NodeJS before it will be executed. So why create a new library for for example Postgres?
connect-to-pg.j... |
I see that free licenses come with a "same license" and "disclose source" mentions, like stated here.
For instance, I have some software code under the GNU GPL v2 license on github. If some evil developer want to steal my code and use it in a closed-source software, how could I be aware of it, and how could I prove it ... |
Sorry for the confusing title - this is best illustrated by an example (hypothetical but hopefully illustrative).
For 99% of my application a Zip Code is considered as a string, so I consistently use the name zipCode for parameters, variables, property accessors etc. (obviously with initial capitalization as appropriat... |
I am currently using Python to write a compiler manager. I have to detect whether given source code is C, even if the code has a few syntax errors. I am currently using the file's extension to tell, but I want a smarter option.
Would using regex be the best (and simplest) solution to this problem?
I am also looking to ... |
I'm writing driver-level code that runs on a microcontroller. I've described some of the design with use cases. The users in my use cases are the the other software components that use my driver. However, I also receive input from the hardware itself in the form of interrupts. How do I describe those interrupts in my u... |
I am using a MVC framework and I have developed a module where .csv file is being imported into the database, I am little unsure about certain things which I'll try to explain below:
Step 1:
.csv file is uploaded and I do all the initial checks like valid .csv file, size etc
Step 2:
Next I go through the main headers ... |
I have been working on a cloud-based background worker service, and regrettably it is almost "blind". What I mean by this is it is incredibly difficult to get any insight into what is going on, aside from the tedious process of reading through noisy logs.
Some of the common things I would like to know are:
is it runni... |
I have been tasked at work with implementing what I can only refer to as a rule interpreter. Part of my job is to identify production errors as they occur with shipment codes, and we are looking to make this process more streamlined with a user-friendly GUI so we can eventually offload the responsibility to another de... |
I'm a student of best practices, architectural patterns, and design principals. I have been studying dependency injection and inversion of control a lot lately, and have been "drinking the koolade" pretty extensively with a lot of my projects over the last half a year or so.
Recently, I got into a discussion about thi... |
How can Gary Bernhardt's "Functional Core / Imperative Shell" architecture be used to design software for an elevator system?
Specifically, let's say there are a few elevators, each with call buttons (one per floor). Each elevator has sensors that report speed, position, and button status, and a controller that accepts... |
In the context of a modern filesystem such as btrfs or ZFS, both of which checksum every piece of data written, is there any additional value in a file format storing internal checksums?
I also note the case of where a file is transferred across a network. TCP does its own checksums, so again, is it necessary for the f... |
I have a very specific scenario that I'm not sure is possible to fully support:
I have an ASP.NET application that uses Entity Framework 6.3 for it's data management.
I also have a generic audit library that I use to log when specific types of data are viewed. This library is designed to be ignorant of the data/object... |
I'm fully aware that Promises and eventing are both ways to do asynchronous programming, and you can choose either one for a given project. However, in practice, the code base I'm working with is large and we use many 3rd party libraries that handles asynchronicity differently so mixing the two approaches together are ... |
I recently stumbled upon this opinion from 2016 saying that there is still case for domain logic in database.
I thought that this is totally obsolete. I am just wondering if the guy is still living in 90ties or this is can be really true. Set aside legacy systems.
What about having domain logic in database because of... |
My team is currently using Visual Studio Team Services for source control (TFS), building (triggered on check-in), and deploying (using VSTS Release Management).
We have four environments (Dev, QA, Int, & Prod), and any code change has to be signed off (by different parties for each environment) before being deployed t... |
I'm trying to implement the unit-of-work pattern for mutliple storage types like the windows registry, a database or the app.config but I cannot figure out how to do it. All examples I find use Entity Framework which already is a UoW so it doesn't help much. What I'd like to store is a simple Setting object.
From http:... |
Let's say I have a random number generator from which I am requesting values for event A and event B. Both events occur at random intervals but event A happens much more often than event B and I would still want both the values sampled for event A as well as values sampled for event B to be uniformly random in their ow... |
I have an application that lets users create their own character from clothing like hat, pants and facial features, like beard and eyes. I'm using a canvas to display the built up character. The order in which these items get drawn are important, ie. the body of the character should appear behind the pants.
My teacher ... |
I am just testing out a simple neural network with a single neuron. To classify if a number X between 1..10 is greater than a number N. N is a constant for example N=3.
Given my input X and a constant neuron 1. My output is (w1*X+w2) where w are weights.
But what I'm finding is that some values of N lead to faster trai... |
Everytime I need to provide additional information about an exception I wonder which way is actually the right way of doing this.
For the sake of this question I wrote an example. Let's assume there is a class where we want to update the Abbreviation property. From the SOLID point of view it might not be perfect but e... |
If I have an epic with 4 features and one feature isn't really part of another epic but needs to be put into that MVF, do I move the feature to another epic or can epics cross MVF's?
|
Given a class like:
class State {
bool IsLessThan(State);
int data;
};
The State::IsLessThan(State) method can simply compare data in each class according to some logic. However let's say the data within State is expected to change throughout development and hold different predefined types of data groups which... |
I have a Client in AngularJS where I consume multiple SSE (Server-Sent-Events) in Java from the Server Side (there are multiple endpoints in different web servers in the backend). Diagram link
I currently register a listener to each type of event coming from each SSE connection, such as:
source.addEventListener('alpha... |
I'm close to opening up access to a web application that I've built, and I wanted to make sure that I can link updates to the app to errors, or other changes in analytics data. My first thought was to put the current git ref in a custom variable that is tracked with every event. But within analytics systems, you don't ... |
I've worked in shops that produce life critical software and I've dealt with commenting rules that were meant to keep the code readable and potentially save lives. In my experience though the requirement becomes a brain dead chore to be ticked off of a checklist and doesn't help me stay focused on writing understandab... |
What changes need to be made to a language/runtime if one wants to implement fully asynchronous exceptions (thrown from one thread to another, capable of interrupting pure computation without the need for polling)? What issues and challenges need to be addressed and how? What would be the difference in implementation b... |
I'm developing a webapp where I have sets of data stored locally on my computer and I run a tool which transforms the data and uploads it to my webapp. However, I need to be able to rerun the tool on all the sets of data at once. The only option I have thought of is to associate the transformed object's reference in th... |
What is the accepted way of keeping track of a user's permissions in a database? Say I have a web app where users can pay for privileges. To use a straightforward analogy, imagine Github's users (paying members can have private repos, etc.) One way I see of doing it is keeping track of user type in the database:
accoun... |
In the context of houses, should area be stored as square feet or square meters?
The area of the largest houses in existence are greater than 32000 sqft, so a 4-byte integer may be required to store square feet. For this reason, I'm favouring square meters at the moment.
Are there any other considerations that are not ... |
string convertDigitsToBinary(int n) {
string ans;
if (n == 0) return "0";
while (n > 0) {
int rem = n % 2;
ans.push_back((char)('0' + rem));
n /= 2;
}
reverse(ans.begin(), ans.end());
return ans;
}
I understand how the algorithm works to % the ... |
So, I'm developing my own CMS which dynamically adjusts to the settings I have set on a specific domain.
I just developed this whole CMS on my local machine and now facing the problem that I have multiple projects, each on a different domain (same host provider though, don't know if that's relevant?). On my localhost i... |
I'm pinging the dev community collective to determine whether there is an official name for the behaviour I'm looking to build.
Let's say there's client C, spatially positioned at 0,0. C initially has access to data points immediately around him in 8 'chunks', as well as the 'chunk' which matches his position, for a 'c... |
It seems to be fairly common opinion that you should only test public methods for a class or module and not private methods. If private methods are doing their job correctly, then that should be reflected in public methods.
That being said, when testing a public method that makes internal calls to private methods, shou... |
Make comes from a time when version control was fairly immature. I understand the need for a streamlined way to clean the workspace back then.
Nowadays any decent version control tool can clean the unversioned files in the workspace. Files which don't need cleaning (cache, downloads, etc.) can be excluded. It is also f... |
We have several teams in our section of the organization and each will be give features of the system to develop and deploy.
A feature includes back-end work as well as front-end work. All the teams will be using two code bases. Those are back-end code base and front-end code base.
Requirement is to create set of guide... |
I am sorry for not posting any code. I am stuck at the design phase -that's why-
What I want to accomplish is: allowing system administrators of a 'Staff Task System' to dynamically set rights to a specific user/department to a specific action in run-time.
The rights are complicated. For example: They can restrict task... |
I have bit similar question to Optionally Using GPL Library via System API in Closed-Source Application but not 100% the same.
Let's say I have closed application A (i.e. frontend application). It is exposing API keeping rights to it, but grants open rights to execute it (code is closed, API is publicly available).
The... |
We have this DDD project where we have more then one BC, and we have this scenario where we would like to define a proper way to store account settings.
In scenario A, we would have one BC store settings for all BCs, and have it published to each BC accordingly, and in Scenario B, each BC holds its own settings, and i... |
What is the most efficient way to store each users' matches in a matchmaking app/website? Given the complexity of these kind of algorithms, is it reasonable to calculate the matches all the time, on-the-fly, when a user logs-in or presses the search button and later ignore the results after they have left?
If that's n... |
I am working in a wizard in WPF application. As the wizard gathers a lot of information I have designed separate view models for each step (view) in a wizard.
But I have to hold all this information in an object to display in a summary screen and push to database when the user reviews the summary and submits.
Example:
... |
I work with massive strings which need a lot of manipulation.
For example, I might generate a string like this:
Part 1 Boat
Section A Programming
Part 2 Partitioning boats for programming.
Section AA Section SQL Entries.
The string would be too large to manually check every part of it. Now I need to split this strin... |
I'm developing an application that produces "files" that are ultimately just a list of groups of transactions: an event store. I was wondering if there was a name for the way I'm handling undo/redo. Or if there's another common way to implement such functionality.
For example, a file with three "nodes" might look somet... |
Consider a scenario, where A occurs frequently like 4 out 5 times, and B only in rare cases, we can write our conditional statement in two ways:
if(A)
//do something
else
// do something if B, only rarely
Or we can reverse it
if(B)
//do something rarely
else
// do something with A frequently
I know that in low-level... |
Is there a use case/necessity (from design or implementation perspective) not to make a super class abstract?
Are there any differences in the programming language in use?
To make an example:
abstract class A { /*...*/ }
class B extends A { /*...*/ }
My question is about A: When am I not allowed to use abstract or can... |
Let's say I have a HTML/JS project which involves interaction with a canvas. Resizing, drawing, retrieving the current state, etc.
Obviously I should separate these into several functions. However, I'm unsure of the best way to go with this. There is only one canvas, so every function call will be acting on the same ca... |
My question is more about trying to figure out if my belief is correct or valid in that a static method should be the only one that prints to the screen (let's say in a terminal). I am using Java and have a static method main and use objects either from my utility library or from my class itself.
The idea is that, just... |
What is the best way to implement the following code without having the same code duplicated in two different blocks, but while maintaining efficiency and readability?
if (expression1):
if (expression2 that can only be checked if expression1):
doSomething()
else:
doSomethingElse()
else:
doSo... |
I have the following code which I wrote, but there is so much of code duplication. I would like to minimize it but I am unable to come up with the ideas. Could anyone help me out with this?
myFunc(r: Object): Object {
if (condition) {
return {
x: this._width - r.w * this._cellSize - ... |
We're beginning to run into a problem as we get bigger, where features make it to staging for testing, but by the time everything is tested and approved new features are on staging for test.
This is creating an environment where we can almost never push to production because we have a combination of tested and untested... |
Consider these two styles of code that accomplish the same thing:
Nested imports
common.models
from django.db.models import *
class SmallAutoField(fields.AutoField):
def db_type(self, connection):
return "smallserial"
myapp.models:
from common import models
class Test(models.Model):
id = models.Small... |
Moving data in assembly language:
MOV B, A
If I move content from internal register A to register B, what happens to content of register A? Is it deleted? Stays unchanged?
|
Does an OOP design that uses a Design by Contract mean the designer is using interfaces to create a "contract." The term "contract" is used quite often when discussing OOP interfaces, so I didn't know if these were talking about the same concept when using the word "Contract."
What I want to do in one of my designs is... |
I want to sole this problem:
Write a method to return all valid combinations of n-pairs of
parentheses.
The method should return an ArrayList of strings, in which each string
represents a valid combination of parentheses.
The order of the strings in the ArrayList does not matter.
Examples: combParenthesis(2) ==> {... |
How do I find the O - notation complexity for the following?
int sum = 0;
for (int i = 1; i <= n*2; i++ )
sum++;
I read the guide on Big - O and other posts on Big -O complexity, but I'm still lost.
|
RAII is by far the most useful idiom in c++. However there seem to be two common pitfalls associated with it that I believe need to be formally addressed.
Failure to release a resource in the destructor and resource invalidation prior to deconstruction. What are your thoughts on solid pattern extensions to incorporate ... |
Hi I have a programming project where I'm basically using a Binary Search Tree to implement a min/max priority queue. I'm having trouble with the popMin/popMax methods. I get how to get the minimum/maximum node and remove a node, but I'm having trouble doing both with a single recursive method.
I don't understand how I... |
What i got now is low level object that has bunch of methods and its difficult to navigate trough i want to break it down, however functions logically have same functionality just different implementation
class HTMLManipulator {
function findElementById($html, $element) {
...
}
function setElementById(... |
Last I encountered a SOAP based service was during my internship in a financial firm in 2013. That was the time when I started my career in IT. I remember having some study material about SOAP in one of my engineering course. Outside of that, I haven't used SOAP much during my career.
I am asking this since the questio... |
I have this task of modelling a system where given a group of users each can keep track of their expenses. The basic requirements are as followed:
To be able to give credit to an user.
Find all the transactions of a given user.
Filter out the transaction where either user is borrower or spender.
Create a group and put... |
I have a news service that has thousands of users.
Each user can subscribe to a set of tags and sites that they individually would like to follow.
A tag or site has articles attached to it.
A user can potentially have 1-500 of these they want to follow.
Each user should have a page where these articles, based on the ta... |
Lets say I created a webapp that I want to make it more scaleable.
How it would work now
If I want to "sell" the webapp I have to do the following:
Rent a new hosting
Copy the code to the hosting
Create a DB and the tables and change the names in the db
The users table will be used to check the user that wants to lo... |
Say I have a database for storing cars data. Each row is essentially a car and I've a class that takes a row of the data and builds my car object.
I now want to build a dashboard that can tell me all the types of cars e.g.
Type Amount
BMW 12
Ford 7
I'm trying to figure out how best to design ... |
We are currently building applications that will run in house and not be rolled out to any customers. We are the only customer.
We are using c# and the latest .Net platform. We are also using Team Foundation Server with a git repository.
I am looking for information on build and deployment strategies. I am finding i... |
Just for clarity, the stress test I have written steadily increases the load on the system until it reaches a breaking point. It theoretically runs indefinitely, but as the system resources are finite, it is expected to fail after some point of time. I have an expected load for the system, but this is tested separately... |
I was reading nginx article regarding Inter-Process Communication in a Microservices Architecture, and I found this diagram.
What surprised me is the second BC, where trip management BC actually leaves its BC in order to get passenger info from a different BC.
I know it is strictly a business logic if a trip management... |
Reading source code of the early release/version is very helpful for beginner to digest complex project. There is less line of code and learner can see the progression of the project.
However, finding those early version is not easy. Those early work may be deemed as "useless" and not get publish online or include in v... |
I've seen a few build tools in my career, and they've all had their quirks. I'm just now looking into Maven, and came across the idea of "dependency exclusions" for the first time. I honestly don't understand which legitimate problem this mechanism is trying to solve.
Let's take the POM of Apache Pig, for example:
<pro... |
Should Authentication Use Cases be represented in a UC diagram?
Should there even be a use case describing authentication or, as it is usually common-sense, can it be hidden?
|
I have a built a toy server framework that provides very extensive configuration options. In configuration, one can for example define instances of modules with each providing generic options, such as logging level, path, format, module-specific options such as listening port for a http daemon etc.
I've used a big JSON... |
I just wanted to ask you guys if this CQRS architecture is too complex or am I doing something wrong? So just to explain picture below:
After one bounded context emits event (SomeEventHappended = DTO) that something happened, this event is received in another bounded context.
After Event is received in another bounded... |
I'm working on this project which, for certain reasons, will need to read the data that's persisted by a DBMS (*). The data is not serialized objects with class information, representation of pointers etc, it's much more "plain": Mostly arrays of integers or floats, and a more involved persistence scheme for strings an... |
If I have a function where I am operating on a specific offset within a string, and the exact location of this offset depends on a previous test within the function, is it "bad practice" or "ugly" to use the boolean in the arithmetic in which the offset is calculated?
Here's my function:
#include <Windows.h>
#include ... |
This is question about class relationships not class functionality.
Currently my DBConnection and DBQuery classes are two separate objects
class DBConnection {
public $dbh;
__construct() {
$this->dbh = ... //Establish Connection to db
}
}
class DBQuery {
private $dbh;
__construct(PDO $dbh)... |
I am designing a REST API and facing a choice of formatting my POST methods to absorb parameters free-form via query string or content parameters:
POST /my/api HTTP/1.0
paramOne=XYZ¶mTwo=ABC
or expect that a rigidly formatted data message (XML/JSON) be posted which encapsulates parameters:
POST /my/api HTTP/1.0
... |
I've worked on various systems, all well-coded and well organized, but even still, what "gets the data" and "saves" it were never really defined. So I hunted the past month for architectures that "solved" that problem.
What I found was EBC, in particular it had a Controller object that went from raw entity and then pa... |
I'm studying for a final exam and I came across this question which I found pretty interesting. I was wondering what the stackExchange community who are more experience in scripted languages than I had to say.
If you were asked to design a scripting language which was compiled, how would you achieve this without losi... |
I joined a Devops Team of 6 in a Large Software Development programme (100 Developers in the program). At the time the scope of work was:
containerisation of the Java server App
scaling up automated web testing using selenium grid and containers
hosting and rapid-deploying the JavaScript SPA on Amazon S3
Continuous in... |
I'm currently at the design phase of my program (hence no code).
It will be written in WPF in C# using MVVM principles.
I'm going to have a multifunctional Drag & Drop control, that will act similairly to a Facebook's Post on the Wall.
To make this clear, imagine it could be a calendar event, an important note, a produ... |
I need to create a flowchart for one of my algorithms and one step is calling a function (that I don't wish to explain in the flowchart) and assigning the returned value to a variable.
float x = get_random(0,1);
I am wondering if I should use rectangle or (non 90 degree) paralellogram in this case.
On wikipedia I find... |
I'm trying to figure out the best use of Git for my development team. We work on multiple C projects that share some common modules, each one varying a bit in each project. A module can be a hardware driver, a sensor driver using a hardware driver, an algorithm library, a task using a library with a sensor module, etc.... |
I have a small python application (about 6000 loc), where I keep my settings in a seperate
module, settings.py. As the application grew, I started to add tests. Now after having
more and more tests, and trying to test with different settings, I find that the module
approach was not such a great idea, as its not very fl... |
When deploying to Flexible Environment using the default runtime (e.g. python), we just need to specify different app.yaml files with different entrypoint: values.
But what would the 'best practice' for custom runtimes be for this case?
Multiple Dockerfile's with different CMD values?
But that would mean that each ser... |
I wanted to know how do people generically think of, in a data base table:
Columns that people are expected to use mostly for grouping expectable of groupability.
Columns that people are expected to use mostly for actual business data that not.
For instance, let us consider a quick example of a school. I would say th... |
I wonder if project structure and naming convention which I use in ASP.NET MVC and Web API projects are ok. These technologies are quite new to me, so I don't have my own standards yet.
I don't change default convention in controllers and views. I change Models directory name to ViewModels. Every View has it's own View... |
I am creating a system that allows an admin to login, manage items, customers, reservations and many more. But as I have asked my professor, he told me that before the admin can access the managed items, customers etc., the admin should go through the login process in the data flow diagram first. But how can I illustra... |
The question is self explanatory, just to add my thoughts :
As far as I have read, The presentation layer in Clean arch has the same responsibility as in MV in MVP.
How one decides to choose one pattern instead of the other?
|
I use a third party library for speech recognition.
This library give me access to some classes ( SpeechRecognitionEngine, SpeechRecognitionConfiguration etc) which give me access to some events (OnSpeechRecognized, OnSpeechRecognitionStarted etc).
So as I could want to reuse this library any day, I created a project ... |
I know that Scrum rules in daily standups say that team should only talk about what they did yesterday, what they're doing today, and anything blocking them. Nothing else. But the problem is, sometimes developers spend their day doing work irrelevant to their tasks, and then talk about it in the standup. It's what they... |
We have a RESTful API that allows for creation of users by POSTing to a particular endpoint, api/v1/users
In the system, when a user is created, an email is sent to the user with content along the lines of "{Authenticated user} just added you to the super cool system and you can now do all sorts of things"
However, in ... |
I'm searching for best practices for versioning software from a process (technical) standpoint but can only find conversations on numbering schemes.
Basically, I want to see if my planned update process meets "standard practices".
The application checks an API and compares the result with it's own build number. If the ... |
I'm working on web application, which gets Wikipedia data from Wikidata (such as description, image, Wikipedia link) and shows them on the page.
I see 2 ways of making this:
Upload requested data from Wikidata to my database and then get them from it. In this case my application will be working when Wikidata is not av... |
Where is the figurative line drawn for using static services in a project? I am a coop student working and learning how to write .net MVC projects. I've been developing trying to stick to TDD. In my project I'm using ninject for dependency injection. I have written an abstract and a class implementing that for making A... |
I worked in many companies, and whenever the dev process is tracked by the ticket system, there is a big related issue: quality and perception.
When a developer finished 12 points, he or she will be viewed as a super star of the team, but there is way more that is overlooked: there will be 6 to 8 points for other peopl... |
I still consider myself as an apprentice programmer, so I'm always looking to learn a "better" way for typical programming. Today, my coworker has argued that my coding style does some unnecessary work, and I want to hear opinions from others.
Typically, when I design a class in OOP language (Usually C++ or Python), I ... |
We're about to embark on helping with a new-to-coding boot camp at my work, where people from other departments can come learn how to code from the IT folks. While this is great and all, I'm in a pickle. I've been requested to come up with a way to physically demonstrate the concepts of inheritence, polymorphism, has... |
Following the recent incident on reddit (viz https://www.reddit.com/r/The_Donald/comments/5ekdy9/the_admins_are_suffering_from_low_energy_have/dad5sf1/) where the CEO of Reddit changed content of certain posts without any notification to anyone.
Is there any way to secure a forum database so it's tamperproof even when ... |
I'm writing a little GUI system for my game in Go. So far my structure is kind of like this:
type Component interface {
Update()
Render(ctx)
Translate()
GetComponent() []Component
AddComponent(c Component)
AddInput()
GetInput()
}
And then I would have say a Panel which implements these, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.