instruction stringlengths 34 36.1k |
|---|
I have setup a docker-based development environment having the following images as you can see in docker-compose.yml:
version: '2'
services:
phpBB_dev:
build:
context: .
dockerfile: Dockerfile
args:
XDEBUG_HOST: 172.17.0.1
XDEBUG_PORT: 9021
UID: 1000
GID: 1000
image: 'pcmagas/p... |
So, this is going to sound like an accounting question, and on top of that might be a little too opinion or discussion-based for Stack Exchange. But we've been going back and forth on this a little bit so I'm curious to know what the dev community thinks.
If you're building an accounting system, obviously at some point... |
I'm building a WCF service project. It has a few layers, like Data, Business or Hosts. I usually also added "Clients" folder and "Proxy" project inside. So that anyone (who wants to use my service) can reach out to the repository, grab Proxy project and adds it to his own project.
Does it make any sense? Is Proxy class... |
What in your opinion is good practice to handle the case where I want to have re-usable and shared logic that collects and returns my data from the database?
For example I have Multi Page Application and one day I decide to make Single Page Application out of it. I don't want to re-write much.
This brings up the ques... |
public static Func<string, Task<T>> MyMethod<T>(
UserCredentials credentials,
Func<string, string, string, Task<T>> func
) =>
async (value) => await func(credentials.user, credentials.pwd, value);
I'm having difficulty discerning the purity of the function, because obviously T(int) resu... |
How can I measure ActiveRecord's performance?
My query has where and an order by clause, and on top of that I want the top row:
User.where(…).order(id: :asc).limit(1)
Knowing that the order by forces the parsing of the whole table, how much of a performance gain can there be in using .limit(1) as opposed to use [1]?
|
I'm trying to get my head around DDD but I'm stuck.
This is how I setup my project:
Data Access Layer
-Entity models that map to the db
-Db connection stuff
-Repositories implementations
Domain Layer
-Models that represent the DAL entity models
-Repositories interfaces
Application Layer
-MVC application that us... |
I receive sensor data as a binary stream of bytes. This stream is not always the same length, and does not include the same data set each time. If the sensor did not send a field, it is simply absent, not null. The first 62 bytes of data is always predictable, but after that it's all up in the air.
However, the messag... |
I develop an open-source project. According to this webpage, you should increment the "MINOR version when you add functionality in a backwards-compatible manner".
Suppose I'm developing two distinct features in a backwards compatible manner. Should distinct features always be part of separate releases, or can they be b... |
Many of Laravel's build-in framework libraries use closures as arguments. What is the primary purpose of this coding style? Is it just to gain more control over the configuration of the function, to use "functional style", or does it provide dependency inversion of some sort?
I'm curious because I wonder whether I sho... |
I am designing redux actions for a user signup. Signup process requires three entities to be created User, UserProfile and an Offer and involves side effects to handle async server calls.
I wonder what actions should be introduced to make them clear, readable and not overcomplicated. The minimum set of actions I can t... |
So I've got this java assignment for college and was just wondering if anyone here could give me some feedback as to what I've been thinking some of this means.
I've got a .csv file with building details - Here is a sample of the data I'll be working with.
Now part of the assignment states -
Entries in the building... |
I have this application containing 2 parts:
User-facing SPA web served by Apache
NodeJS API server
When a user go to the SPA web, Apache will do authentication and prefetch data for that user by making a POST and a GET request to the API before serving the page. This works fine for normal days, but it is pretty slow ... |
I'm trying to understand the implications of structural typing vs. nominal typing. From reading, I've managed to gather that one of the key advantages of nominal typing is the ability to declare an interface that can be used with third party libraries where you can't edit a class declaration to add an interface. Unfort... |
Let say I have an Apache server that needs data from external API before serving the page. I wonder if there is a limit of requests an Apache server can make and wait for response. Or does it depend on the physical server?
|
I have a Circle class and a LineSegment class, and I want to implement a method that returns two points (or one, or none) for the intersections.
How do I know which class to put this method in? Would a separate "middle-man" Intersections class be better?
|
I am confused on how to apply DDD principles for the design of domain entity clusters with Aggregate Root. According to my understanding, Aggregate Root enforces business validations and all entities within that aggregate should be accessed from its root. But this is leading to a huge aggregate of linked objects.
To g... |
This is a systems architecture question.
I'm in the process of planning an online platform that will collect people's medical information. Because of the extremely sensitive nature of the data being submitted, I want to ensure complete anonymity.
A profile would be created that would contain all of the data, but none ... |
Suppose I have an application written in C++, which uses WxWidgets (or some other library) for gui. When an end-user installs my application, how do I make sure they also install the necessary dependencie(s).
Should I include the source/header files for the library within the download, such that they get compiled with ... |
I'm working on an application which can be added to third party websites. This means that this app runs in the browsers of the users of a third party and I don't have control over what runs in their server.
My problem is that my app needs to load data from my own server. How can I secure my server so it does not leak d... |
I am trying to decide whether BDD is suitable for my project or not. I was reading about BDD here: https://en.wikipedia.org/wiki/Behavior-driven_development and here: https://agilewarrior.wordpress.com/2015/04/18/classical-vs-mockist-testing/
In the first link BDD is described as outward in, which is supported in the ... |
I'm beginning to sketch out an automation rules system (e.g. letting users define "when X happens, do Y"), and I'm not sure how to monitor for triggering of those rules.
How do apps like, for instance, an email service provider handle that? With ESPs, you can often define arbitrary criteria, and when those criteria are... |
I am trying to write integration tests for a client-server app. The client app runs on a user's machine and connects to the server app running on a specific Windows server, network-serverA. The server app also accesses files on a different network server, network-serverB.
In this post, the author mentions that integra... |
For example, lets say I have this class:
public class Account {
private String username
private String email
private String phoneNumber
private String zipCode
private String website
}
Each of these fields could potentially be separated into their own class:
public class Account {
private Userna... |
This is similar to: https://stackoverflow.com/questions/1278831/unit-tests-in-production-release-code# but more specific.
At the moment the DLL I ship and the DLL I use for unit testing have different access. When doing unit testing, since I test each individual functions/classes, I add __declspec(dllexport) to functio... |
Is it common to use "timestamp" to mean with time zone and "datetime" to mean without time zone?
|
Is it better to unit test using a mock library like 'nock' (nodejs) or to just test the server's http requests directly?
Here is an example of my Express server test for testing if my server is up and testing for yelp data being served from my server.
test.js:
describe('Express server', () => {
let request;
befo... |
I've recently learnt about "NewSQL" databases like:
Google Cloud Spanner (proprietary)
Microsoft Azure Cosmos DB (proprietary)
CockroachDB (open source)
also see How does CockroachDB compare to MySQL or PostgreSQL?
also see How does CockroachDB compare to Cassandra, HBase, MongoDB, or Riak?
VoltDB (open source)
I... |
What should a constructor contain?
In both cases, all three arguments are needed for the class to work.
Which approach is better and why?
1)
class Language {
LanguageRepository languageRepository;
Language(LanguageRepository languageRepository) {
this.languageRepository = languageRepository;
}
public void... |
I'm writing a library to be used by several applications.
Some interfaces which my library declares and uses, and which are implemented by the application, look something like this:
interface IOpaqueHandle : IDisposable {}
interface IPaintFactory
{
IOpaqueHandle Create(string configData);
}
interface IPainter
{
... |
Reading this:
https://renenyffenegger.ch/notes/development/web/URI-URL-URN-IRI-URC
URCs provide a set of attribute/value pairs that describe properties of URIs like authorship, publisher, copyright etc.
Is that synonymous with the query string found in here:
https://stackoverflow.com/questions/ask?authorship=foo&publ... |
As the title explains the question, let's assume that we're using versioning as major.minor.revision.build. What should the initial version of a software build be? 0.0.0.1 or 0.0.0.0 or anything else?
|
I've been reading/watching a lot of Robert C. Martin content. I've come across him saying SQL is unnecessary because of solid state drives. When I search other sources to back this up I get a bunch of random articles describing the difference of SQL performance between hard drives and solid state drives (which is relat... |
From AWS documentation:
A Kinesis data stream is an ordered sequence of data records. Each record in the stream has a sequence number that is assigned by Kinesis Data Streams
I don't see any connection between those 2 sentences. Also, the documentation doesn't explicitly specify what type of ordering it is.
After a s... |
I am not from a IT background. An idea is generated is being worked upon now. Initially we started with Waterfall methodology and now using agile. Want to understand how exactly this agile methodology works. Please don't consider my questions in a wrong way. Request for your inputs.
There is a bug found in between of ... |
Background:
There is a UI Client and REST Webservice.
The user interface form allows you to create a complex object.
The complex object is composed of primitive types (string, integers,...), and nested types (reference types). Each of the nested types is accessible through a REST resource endpoint as well as the comple... |
I'm trying to find a way around the integration of Google and Facebook login for an Android application using the Clean Architecture.
My application has 3 Android Studio modules :
presentation : contains the Interface Adapter layer of the Clean Architecture (Presenters), along with all my UI (Activity, Fragment, Cust... |
Downcasting means casting from a base class (or interface) to a subclass or leaf class.
An example of a downcast might be if you cast from System.Object to some other type.
Downcasting is unpopular, maybe a code smell: Object Oriented doctrine is to prefer, for example, defining and calling virtual or abstract methods ... |
I have a question about best practices given the following scenario.
Requirements
There is a daily process that has two steps:
Query configuration data across dozens of database shards
Perform many intensive jobs based on that configuration data, across a cluster of applications
The first step is lightweight and can... |
I came across this SESE page: What is a proper use of downcasting? (for C#) -- and it talks about when to downcast, and the possible downsides to it.
In Python sub classes are slightly different
Example:
Suppose I have the following abstract class:
from abc import ABCMeta
from abc import abstractmethod
class Weapon(... |
A textbook I am teaching from about ASP.Net using ADO.Net in C# says:
Note that concurrency checking isn't necessary here, because a
concurrency error can't occur for an insert operation.
The textbook emphasizes using Optimistic Concurrency (as extensively described in the Microsoft online documentation): Update an... |
I'm building a GUI for a CL program and I have the following question
Is it better to
Have the GUI invoke the program behind the scenes using a shell with some options eg: If I were I were writing a git frontend, I would just have every button click correspond to a git foo bar command that runs in its own shell
Or by-... |
The company with which we are integrating is a door security company that makes RFID cards and door scanners. You scan your card, the door opens and lets you in. They allow 3rd party integration via their websocket server. They post "Events" to their server. "Bob Foobar scanned his card at door reader #14 at 8:12am on ... |
I'm in the process of implementing a counting Bloom filter. This data structure is defined as a bit-array and a "width" parameter, W.
The bit array stores unsigned integers, whose size is determined by W, into an array of uint64s. Thus, it is expected that the integers' size will not be multiple of 8. For instance, ... |
According to Is it wrong to use a boolean parameter to determine behavior?, I should not use a boolean parameter to switch behavior inside a function. How about other types of parameters?
For example, if I try to use a string instead of boolean:
void f(str){
if(str==='a'){
a();
}else if(str==='b'){
... |
Can a UWP App access data outside its own app data, publisher data, or what the user picks with the FilePicker?
As far as I can tell, a shared publisher area and a user prompt with the FilePicker are the only ways to access files outside a UWP app's own personal app data stores. Registry settings are sandbox'd, as are ... |
I am test driving a method which is parameterized by two inputs and depends on a Strategy. Here's what I have:
[TestCase(input_a1, input_b1, strategy1)]
[TestCase(input_a2, input_b1, strategy1)]
[TestCase(input_a3, input_b1, strategy1)]
[TestCase(input_a1, input_b2, strategy1)]
[TestCase(input_a2, input_b2, strategy1)]... |
Let's say I want to write a function to compute factorials of nonnegative integers. I could write something like this:
fact :: Num a => Int -> a
fact n = fromInteger(product [1..n])
(Let's not concern ourselves with negative values of n at the moment, as that isn't what my question is about.) If I write the function... |
I was tasked with implementing a networking stack. The software is self-contained with no external dependencies - it only needs the C++14 standard library, and a POSIX platform.
In my opinion there's nothing preventing it from being successfully implemented in a single repository as the logical separation (layers, clas... |
Sometimes I need for loops which needs a break like this:
for(int i=0;i<array.length;i++){
//some other code
if(condition){
break;
}
}
I feel uncomfortable with writing
if(condition){
break;
}
because it consumes 3 lines of code. And I found the loop can be rewritten as:
... |
I guess this is a problem solving question but I am out of ideas, don't really know where else I can resort for help, and I need to solve this problem.
Essentially we have a set of consumers and a set of resources, and the objective is to assign a resource to each consumer. Not every resource is eligible for every cons... |
Let’s assume there is a function EventHandler that is called on multiple threads at different points in time.
EventHandler has to call SomeOtherFunction, but these calls shall only happen on one thread at a time.
That means: If a call to SomeOtherFunction is currently active on thread A, and EventHandler gets called ag... |
I'm working in a Electronic Funds Transfer (EFT) system and need be very careful with sensitive data like credit card numbers.
We need this information do mount the ISO 8583 data before sending to EFT Gateways.
We use char[] and byte[] to keep sensitive data and use Array.fill when We don't need this information anymor... |
In a competition application I'm designing there are several types of prize draw, each of which needs to act upon an entry object in some way. So the first lines of code I wrote defined an interface.
interface PrizeDrawInterface
{
public void enter(EntryInterface entry);
}
Here's the problem which I'm not sure how... |
Please can you tell me if my Data Access Model makes any sense?
Thank you very much.
|
So probably like many, I often find myself running into headaches with design problems in which, for example, there is some design pattern/approach that seems to intuitively fit the problem and has desired benefits. Very often there is some caveat which makes it difficult to implement the pattern/approach without some ... |
This may be a silly question but if I have good unit test coverage, does that mean I can reduce the amount of, or remove completely, functional and integration testing.
When people talk about having a continuous deployment process in place, does that mean automated unit tests are the only form of testing done and the c... |
I am in the process of refactoring a Django web app. It is written in the usual MVT style, and I would like to change this for a REST + frontend approach. In my first iteration I would like to do as little changes as possible. My plan is:
split backend into REST API and a simple, client facing Django application (the ... |
In my current problem domain, a number of problems seem to lend themselves quite well to the strategy pattern. I have a common, high-level process - let's say it's a sales process - and regardless of the sales channel I use, sellProduct needs to happen... It's just a bit different from channel to channel.
So let's say ... |
i'm new to the whole Microservice architecture so pardon my unstructured questions:
Context: The business needs customers to be able to select commodities, calculate the cost of these commodities based on certain business rules to do with the amount of commodities selected, currency and other rules that affect the calc... |
We're developing an app using React Native and MobX for the state stores, and also using a Web API REST service for the GETs and POSTs. All is going well, so far we're able to use FETCH to get the data, persist it in the relevant store using MobX and populate ListViews etc from that store...
Where I'd like some guidanc... |
So I've been researching and looking into versioning my applications correctly rather than coming up with my own scheme. Semantic versioning is a popular option as many of you probably know, but my applications do not apply to the semantic criteria. By this I mean my product isn't an API. Looking into this, people say ... |
To start off I'm familiar with what microservices are, how they communicate with each other, the general flow etc.
Now, I'm used on working with standard 3 Layer application for my backends( API - BL - DAL ) and was wondering what the architecture of 1 microservice was, as I can't really find something about that, or i... |
my application sends a batch of custom emails every day using mailgun (an email API service). I have a producer worker scheduled to run daily, and all does is query the database for the unique configurations/templates, and adds the jobs to redis. Then my consumer worker sends the requests to mailgun and acks them. It w... |
I have made a textual minesweeper game (here you can find the program).
I want to initialize some data by the help of a file. The file should be readable for humans and easy to modify with a simple text editor.
The file should look for example like this and it should allow comments:
# columns and rows
size:10
# describ... |
Context
I recently got interested into producing better formatted code. And by better I mean "following rules endorsed by enough people to consider it a good practice" (since there will never be one unique "best" way to code, of course).
These days, I mostly code in Ruby so I started to use a linter (Rubocop) to provid... |
I got a REST webservice and it has a simple method like;
public void processItem(Item item);
Problem is processItem method takes too long to complete nearly 1 minute) and there can be multiple calls in a short time.
How can I handle these requests efficiently?
Webservice creates a new thread for every request and it h... |
I'm practicing various C++ exercises. In this particular exercise they are asking me to implement an in memory database. I guess they are not asking me to use something like SQLlite. Could anybody give some general pointers as to how I should tackle this please? Would I use C++ maps. I'm struggling to understand what t... |
I looked at this question. As far as I understand test env is for qa department to conduct their tests, and staging is identical to prod, but hidden from end user.
My questions are:
Should staging be 100% identical to prod, or is it ok for staging to have "messed up" data in it? Just how much is it ok for staging db ... |
For example, given the following class:
public class SomeClass
{
//...
private IEnumerable<SomeType> myEnumerable;
public IEnumerable<SomeType> MyEnumerable
{
get => myEnumerable;
set => myEnumerable = value ?? new List<SomeType>();
}
}
Is it good practice to perform this type of ... |
I came across this issue at my second job interview. The technical interviewer said multiple times that booleans are not ok to be passed as parameters in methods, rather find another constructs (Enums) to get rid of booleans.
What's the general opinion on this topic?
|
I'm confused about applying the "Composition Root" (CR) to create aggregates in DDD. Seemann (2012) defines CR as a "(preferably) unique location ... where modules are composed". He argues for composing object graphs inside CR, near the application's entry point, and warns against the temptation to compose "classes ... |
Situation:
Our Python project is hosted at GitHub. The actual release should only contain handful of files, but or project also contains several non-release files that are required for testing and ironically for packaging, etc.
We roughly follow the GitFlow model, so develop is our mainline that we build on and stabili... |
I have a function that gets the statues of my databases and Redis instances to check that they are online:
internal static bool IsOnline(ConnectionLocator connectionLocator)
{
try
{
connectionLocator.SessionDatabase.Ping(StackExchange.Redis.CommandFlags.None);
usi... |
I currently have a WinForms app that uses XML documents to drive dynamic content that is shown to the user. I call these XML documents template files.
The template file determines the features the user sees, the properties, what type of control to use for the property, the drop items in the combo boxes and how to valid... |
I previously ran into an interesting practice called occlusion culling in game development. I am still researching to gain more understanding of how it works, since this is mostly discussed in game programming/tools/IDEs such as Unity, so I am applying the practice to data management in application development.
Other n... |
We are currently beginning an upgrade to our system and have decided to follow DDD methodology. The system is highly customizable by the users to allow them to tailor the software to their specific needs. This has led to some confusion on the proper way to implement properties on some of our aggregate roots.
Let us sa... |
So we have an application that I am not ready to describe in full before we take it to the market, but I will give the details necessary.
We currently have an application that takes a snapshot of an active window of a particular application based on a region that is selected by the user. This data is simply a number th... |
I have a method that tries to get a ICommand instance and otherwise returns an ICommand with an Action that does nothing
private ICommand GetCommandFor(object o)
{
if(CommandExistsFor(o))
{
return _commands[o];
}
return new Command(() => { });
}
Completely disregarding the fact that we have dif... |
I have a class that handles the state of a response, called StockResponse.
The code has multiple ifs to handle each state of the stock. Most of the cases has a default behaviour, but some conditions need additional if-else inside to handle correctly the response.
The conditions are becoming hard to maintain, and looks ... |
As the open source world is fairly advanced now and you can find an open source implementation of pretty much everything, why are people/developers still using the obscure/proprietary libraries? In what case these are absolutely needed?
|
Short story: We had an issue, where customer reported some feature they wanted developed year ago stopped working. The problem is, the feature was indeed developed, but put into separate branch and then not merged into master, so the feature in fact was never on live enviroment, only on testing.
So now I am tasked with... |
I'm designing an application based on microservices architecture.
In this application I will need Auth microservice.
Also I will need to store some extra User information such as, perhaps, multiple addresses, avatar picture etc.
This leads to idea of having two microservices - one for Auth and another, User, which coul... |
Worse title ever but I don't really know how to describe my scenario in a line...
So I have a method that wraps the calls of a many methods of the same nature. Once any of these methods have finished, a certain update needs to be called.
class SomeClass:
def perform_tasks():
self.task1()
self.task2(... |
(This question might be overly broad, and it certainly doesn't have a "right" answer.)
I am rewriting some small embedded projects for a company. Rather than dive into the pre-existing code, I am restarting from scratch. The original code was written by students for a research project and while it proved the point, it ... |
I have to set the value of a string object "result" depending on the results of different methods and different if/else conditions. In the end, there would be one (last value set) in the string that i need to use. The first way i did it is:
public void MyClass(){
public void validateApples() {
Stri... |
I have a question about MVC pattern, concerning the controller part.
Most of the program I happen to write are basically spreadsheet like. They are written in C/GTK+ and Python3/Qt5/Tkinter but share a common design : I separate the gui from the logic (data struct and heavy lifting methods) that seems to be the MVC pat... |
I don't know if there actually is one design pattern, or several together, or maybe what i'm asking is anti-pattern.
Context (simplified) : my company sells SaaS services (through an API) to several clients, which in turn sells this service to end users. Each client uses the service, but some want custom behaviours in ... |
Thinking about the overall architecture of the application logic:
Current status: The model contains all resources that are used at runtime.
In a factory you register a builder which is used to create a resource via the factory. Every time the factory creates a resource, it adds the resource to the model. That means t... |
My task is to process asynchronously balance deltas for multiple clients and provide aggregated balance amounts.
I have a REST service which accepts requests from N clients C₁…Cₙ, each of them has its own financial balance value which changes throughout time. These clients send their positive/negative balance updates... |
When implementing a DDD driven system (based on event sourcing) using a functional programming language (Clojure), should one separate event handler functions from aggregate functions?
In my naive implementation an aggregate would be a namespace with
functions for handling commands which accept the current state data ... |
I want to do something fairly simply in my Gitlab CI pipeline - I want to build the docker image and push it to an AWS ECR repo.
I've looked at this Gitlab CI guide and one of the suggestions it makes is using the docker:latest image.
However, in order to access the AWS ECR repo - I'm also going to need to AWS comman... |
Right now I am collecting memory information on a node.js server every 100 seconds. I want do display the memory usage info as a graph on the front end.
const mem = {
heapTotals: [],
heapUseds: [],
maxHeapTotal: 0,
maxHeapUsed: 0
};
setInterval(function () {
const m = process.memoryUsage();
mem.heapTotals... |
Does 'open-closed principle' also includes files and data of the app? According to https://softwareengineering.stackexchange.com/a/296955/248528, it says files and data are't included, but it doesn't mentions if they should be included.
Suppose I have 2 ways to define the locale string of my app:
Method 1 : all locale ... |
Need some help in the desing of the Auth/Permissions of a REST API for a SAAS app.
I'd done a prototype of a SAAS app and for permissions of the SAAS client, I'd setup the API to request for a header called CLIENT-ID. This way, the API filters all views by the Logged in Client. This header is Mandatory.
The next thing ... |
Say I have a domain object like this:
public class Customer
{
private Guid _id;
private string _name;
private Address _address;
public Customer (Guid id, string name, Address address)
{
if (id == Guid.Empty)
throw new ArgumentException();
if (name == "")
... |
I'm currently working on a desktop application in Java (using JavaFX).
This application stores some user information, parts of which are sensitive. For example, if the user configures a proxy, it will store it into a file with encryption. Moreover, my application is calling a web API to execute auto-updates (with a bas... |
We have an email plugin which encrypts a mail's attachments when the user sends an email and gives the mail's recipients permissions to decrypt the attachments. The recipient permissions are stored on a server. The logic which executes on click of Send button involves some user prompts too. For example, if some of the ... |
On my first part-time programming gig during college, I dealt with a large-ish web application responsible for handling a periodic event hosted by our client, largely a plain CRUD snoozefest with a number of forms for the users to fill out.
The forms change between events, with most forms having a small amount of chang... |
For two choices there is boolean. In my case, I have positive, negative, and neutral which are three choices and cannot be represented by boolean. I've see there's method Math.signum(x) in Java which returns -1, 0, or 1. So, should I follow this practice (simply use -1, 0, 1 without creating constants) or create consta... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.