instruction stringlengths 34 36.1k |
|---|
I'm writing an API in JavaScript, and I'm confused whether or not I should check if the API user is passing me the correct type on which the API expects to work. Actually not the type, but if you are passing me the object with the properties on which API will work. Is it a good practice for me to issue an error if the ... |
I am building a slot machine game for a client (virtual money, not real-money gambling). They started out with a template game and hired me to reskin it and make "minor" changes for a "quick" release. Unfortunately, there are no brakes on the scope train.
The original template was very basic. Count the number of consec... |
I have recently started updating portions of our corporate platform, and I've been trying to find ways to make the entire platform more efficient, better structured, and just cleaner in general. With SignalR finally being pretty well ready for our version of the MVC framework, I decided to get my feet wet with it by at... |
In our monolith application, the piece of code that used to handle sending SMSes and emails was written in our business layer. Now the responsibility of sending emails and SMSes is handled by a microservice. Lets call it SendMicroservice. Now other microservices call SendMicroservice if they want to send any emails and... |
On an 8086 CPU before the flat memory model had been adopted, when the OS wanted to create a new segment for a process, how did it know what virtual memory ranges were already covered by existing segments; how did it find a suitable base address to use for the new segment descriptor that had suitable room?
Also, imagi... |
Recently began implementing domain events in my domain layer which really allows me to decouple the application from the domain. Eventually, I would like to get a full-scale CQRS w/Event Sourcing infrastructure.
The question I have is that I have an Account class and one of the use cases is to be able to rename it. How... |
I am working on a small plugin for a DNS server. I have a static list of domain (sometimes subdomains too) names:
gaming.xyz.com
facebook.com
mail.example.com
blog.example.com
I want to check if a subdomain has a match in the above list. For example:
abcd.gaming.xyz.com and def.gaming.xyz.com => gaming.xyz.com
a.b.c.f... |
I am implementing a messaging protocol between nodes on a network and i am wondering how to expose the messaging system interface to the programmers. The messaging protocol supports a set of commands that the clients and servers can exchange to get jobs done.
To be generic, let's says, for instance, the system support... |
I'm writing a mutation testing system for Clojure and I was wondering what the general consensus is for when a test causes a mutant to throw an exception or enter into an "infinite" loop (my system judges any run of a mutant that's significantly longer than average to have entered an infinite loop) which would not have... |
I'm working on staff management application for a clinic, basic scenario, but learning about JPA inheritance lead me to over think some parts, and I need help to clear my thoughts and design.
SCENARIO:
I have some obvious classes: employee, clerk, medical staff, nurse, doctor..etc... the conform to a class hierarchy wh... |
What is your suggestion on where to put cross-cutting concerns in a package-by-feature structured app? This aspect seem to be missing from most of the pro package-by-feature articles I have read.
Consider for example a Java REST api:
com.myapp.authentication
AuthenticationResource.java
Token.java
TokenDao.j... |
My team has been trying to transition to Scrum for some time now, but it seems like the preexisting culture is preventing the team from switching to a new mindset or even causing it to move in the opposite direction.
For reference, the team has two line managers, a project manager, a product owner, and five developers.... |
I use Python sqlalchemy to store my model in a MySql database. One of my objects has a 'state' field (for simplicity let's assume there are two states: AVAILABLE and UNAVAILABLE).
There are different micro services which can modify the states of the objects - such as the API service, periodic tasks, background tasks, ... |
I frequently work with very numeric / mathematical programs, where the exact result of a function is difficult to predict in advance.
In trying to apply TDD with this kind of code, I often find writing the code under test significantly easier than writing unit tests for that code, because the only way I know to find th... |
We are using verification statements which describe how the requirement should be tested. These statements are co located and associated with the requirement. How is this different than a set of acceptance criteria?
|
I have security question that i am not sure if this approach is safe and secure way to download a file and present to a web user ?
We have customers invoice files stored in a server location (publicly inaccessible location), then we do read them via the PHP code in a file (in public accessible location) like below,
I... |
My team has a Git repo for a large service that incorporated a related, but fairly unique, micro-service. We recently decided to separate out the micro-service into its own service in terms of release branches and deployments (so we can deploy the micro-service independently of the large service). The gotcha is there’s... |
As a small snapshot of my product, I have 2 bounded contexts, one which is a rich domain with defined events and invariants, operating on files implemented as CQRS/ES, and the other a CRUD store of corresponding files and data that will be used as a Customer/Supplier relationship with other exclusive contexts in the pr... |
I'm developing a WebSocket API and I was wondering if there was either a standard or best practice for responding to client messages. For example, if my API is expecting only stringified numbers but receives a word, what's the best way to respond? Is there something analogous to a 400 response? Conversely, is there ... |
I have a web service that implements Repository Pattern and I was wondering if there is a design in C# that can remove the need for 'dynamic' when injecting it in my method.
public interface IRepositoryPlan : IRepository<PlanDetail>
{
// methods...
}
public interface IRepositoryFlan : IRepository<FlanDetail>
{
... |
I have started using the following in my automation code in instances where I'm not interested in keeping the object 'alive'and just using it as a means as a type of precondition. For example:
Instead of the following:
Login login = new Login()
login.SetUserName(username).SetPassword(password).Submit()
I do the follo... |
When reading code, how do you say the following statement? (It was taken from some C# code, could be many languages, though).
List<string>
Do you say:
List of type string?
or
List of string
or
List of string type
or
Something else
|
in my company we are using different 3rd party systems, for example:
a CRM, where we sync information about the customer; the goal is having a 1 to 1 syncronization.
a transactional email system, with whom we can send email to the customer.
At the moment we are having several timeouts, because these systems have a fi... |
Most Defect density metrics are like this:
Number of bugs / Size (KLOC, Story Points, Function points..)
I have read that it measures the effectiveness of QA but I do not get it:
I can have a super senior developer and a sloppy QA. Therefore, the sloppy QA guy finds nothing because there is nothing.
I can have a ba... |
KLOC has been - I think justly - criticized as too inaccurate to express size when comparing several projects.
In only one source I found a calculation that uses Story Points and thus allow to compare small/large projects with respect to their Number Of Bugs per 100 SP.
Providing that the teams all have a common defini... |
We have some linux(ubuntu) based VMs running in the cloud in a private network and they do not have external/public IP address. We have some apps running on those servers and everything is working fine. My question is: are there any arguments for doing regular updates on those machines? How about security patches only?... |
I'm trying to understand the difference between terminal and non-terminal values in a real language. I wasn't able to find enough examples on real language CFGs on the internet, most examples are abstract. Assume we have the following
int main(){
int a = 5;
return a + 6;
}
Are the following statements true?
Term... |
I'm currently working on a project which will use a REST API and that's exactly what I'm working on and I'm using nodejs with express, mongodb and mongoose.
I've users that can have 4 different roles: user, secretary, worker and manager. Let's say they can all access the kits document but they can do different actions ... |
I'm considering two types of notifications:
Domain events used internally within a bounded context
Application events used to exchange notification messages between bounded contexts
Each aggregate in my bounded context defines its own transactional boundary, so that only one aggregate is modified per transaction. Whe... |
In the book Building Microservices by Sam Newman, on chapter one in the section Ease of Deployment there's a sentence that has left me bothered:
"A one-line change to a million-line-long monolithic application
requires the whole application to be deployed in order to release the
change."
This doesn't seem true to... |
I am pretty new within our Scrum team. (Round about 4 months)
Whenever I suggest some paradigm like "DevOps" or technology like "Kubernetes" to solve issues I am criticised at least from a part of the team.
Arguments are "these are just buzz words".
Other times the team just does not react to my proposals.
I am really ... |
I'm developing JS and PHP scripts and selling them on various marketplaces. But I need to track/monitor errors on my scripts. Usually, I use Sentry for own web apps, but I'm not sure if it's okay to use it for the scripts which I'm selling. Because this scripts will contain some authentication tokens with write permiss... |
I'm becoming addicted to writing fluently (perhaps incorrectly originally said "declaratively") and I'm taking it to possibly unwise extremes, but the more I write this way the more one thing stands out as being completely unable to write in this fashion, and that's the return statement.
Something like what I want to w... |
I have 2 sequences:
One is a videoclip with the image taken by a drone's camera
The other is a file with a list of chronological data from the sensors
Example:
time 0: speed_x=1, latitude=0.001, longitude=0.2, altitude=40
time 112: speed_x=3, latitude=0.0021, longitude=0.221, altitude=30
time 232: speed_x=3, latit... |
How can I give complete control of one folder to one person, while the rest is in the control of another person. Control means they have the power to approve pull requests and commit to master and development.
I think the answer is git subtree or git submodule but I'm not sure which or if there's something better. I'm... |
Question probably sounds confusing so let me clarify.
Let's say I have an object containing keys and values for my project's font sizes:
{
small: '8px',
medium: '11px',
large: '14px',
}
This is fine, but it's not very flexible or scalable; it would not - for example, allow me to insert a new size between s... |
I am looking for an efficient way to handle a calculation. I have lots of timestamped events, representing loading and unloading of trucks. I need to construct the filling rate of these trucks over time.
This picture represents data and the wanted result. Keep in mind that the dataset is quite huge, and lots of events ... |
I know many despise KLOC as some managers attempt to correlate that with productivity. But when we speak only comparing sizes of projects using the same languages and coding standards as well as the same tool for LOC calculation. Unlike story points, this seems like a more reasonable way that size of two projects can b... |
For example, suppose my application have some sound files, now I define all sound file references in a single class:
public class SoundHelper{
public static Sound buttonSound=new Sound("(some url)");
public static Sound alertSound=new Sound("(some url)");
.
.
.
public static Sound pageChangeSoun... |
So, I am more or less voluntarily learning NASM, and I have problems finding sources that really explain it. Unlike with Java or C# I can't just use google as well, since Assembly just isn't used by many anymore. I need to prepare a presentation about an "Introduction to Assembly/NASM" without explaining code but rathe... |
I read about microservices and it seems illogical to me to create a separate DB per service just to achieve isolation. I can achieve the same using only web services and a single database. Why do we even need it? The thing that separate database is beyond discussion. Or I am plain wrong? Can you guide me on this?
|
I've seen Singleton design pattern represented like below. Always with just getInstance() method.
My doubt is: once I get the instance of the object I need, if I would like to modify it don't I need to add other methods to the Singleton class? Like setField( Type something) ? Or is against the pattern? In this case wh... |
Almost every software has a number of internal data structures that we don't want to expose externally (through APIs for example).
Let's say we have a few classes representing 1:1 database tables - User, UserGroup, GroupPermission, etc.
Then we can have an external class ExternalUser that will be exposed on an API, exp... |
Recently, I've stumbled upon an old interview with Dennis Ritchie, Bjarne Stroustrup and James Gosling, published back in 2000. Each of them talked about the language they were most involved with, namely C (Ritchie), C++ (Stroustrup) and Java (Gosling).
It's a very interesting article in itself, but what caught my atte... |
I am writing an application using the Model/View/Presenter passive view pattern.
I have view that contains multiple items in a list. My model is of type AudioDrama. For filtering that list I have classes that implement the interface IAudioDramaFilter.
public interface IAudioDramaFilter
{
EAudioDramaFilterMode Filte... |
I need to implement a rollback system and the memento pattern gets mentioned regularly as a solution to this requirement, but in all cases a single object is used and it works in memory, persistence is never discussed.
But what if I need to store the memento/state in a database?
What if multiple objects are involved?
... |
I have a similar question to one already asked about SQS to Azure Service Bus - https://stackoverflow.com/questions/51650073/consume-aws-sqs-and-publish-to-azure-service-bus. I want to get messages from AWS SNS (hosted by another party) into an Azure Service Bus and wondering about the best approach.
Ideally, I don't ... |
While creating tools for an api, I've noticed the following inside the api specification:
GET /cookie-orders
returns the following structure as a 200 result:
{
"first":true
"last":false
content:[
{
"id":0
"customerName":test
...
}
...
]
}
I find this a little contradicting as I think that a rest... |
If .catch catches any errors upon request attempt, why would I need to use Throw Error... with .catch?
For instance, what is the throw Error used for, that the .catch doesn't handle automatically?
fetch(...).then((response) => {
if (!response.ok) {
throw Error(...)
} else {
response.... |
I'm designing a new application that is very basic however I expect it to grow and don't want to have to refactor down the line. My challenge is that in one method, I either need to retrieve thousands (e.g. 20,000) of records from the database and iterate through them in memory or, make multiple calls in a loop (e.g. 2... |
Recently I have worked in a small standalone Python console application and have inherited some code from another team. Although some of us have written small Python scripts in the past, none of us are experienced in Python.
One thing that bothered me was the way logging was done - the start module would configure the ... |
I'm trying to write good code to make extrapolation on economic data and I have a hard time finding an efficient/ingenious way to do it. (to have a nice code that can be used in a different way later with ease)
Example of economic data split on an Country => year => value structure
['FR'] => [ 2008 => 50, 2009 => 100],... |
We have a webapp (ecommerce webapp) where we are currently working on. For some functions we wrote UML diagrams and ERD diagrams. We just made a high level architecture of the website. But the question is, for future proofness what type of documentation which describes the complete system will be best to write in this ... |
I am part of a software team that is writing a console application (no UI) in C#. My part in the team is to write code to call RESTful APIs from a third party site, process the returned data and save it to the local database.
The third party API has a cap on the number of items returned in a single call (100 items max)... |
This is a hypothetical scenario with some concrete parts.
Say that I have built a system that allows users to interactively arrange living room layout.
The result of this arrangement is presented to user in a form of a RENDERED preview image.
The system is built using best practices, SOLID principles, and taking the Un... |
My project aims to provide a common interface between multiple different HDL simulators, so users can write test benches that will work no matter the simulator used. In this situation, it is the simulator, not the user's code, that is the driving application. When the simulator starts, it loads with it a library that a... |
I've been investigating various distributed file systems, like Gluster, Ceph, Moose and Lizard.
I'm also familiar with various key/value store type systems, some of which do not perform any system calls related to durability (such as the fsync() function) because replication reduces the likelihood of data loss. E.g., i... |
We are building API which mainly passes database objects back and forth between user and database, so the main flow of information is quite basic:
Table (view) <-- ORM --> C#/Java/etc. Objects <-- JSON serializer --> JSON objects <-- HTTP --> User
We are using ASP.NET Core with Entity Framework Core if it matters, but... |
Assuming OldModule.oldFunc, if we want to move oldFunc to NewModule and, for backward compatibility, keep oldFunc there merely calling NewModule.newFunc by passing the exact same arguments and doing no tampering whatsoever -- do we need to still write unit tests for oldFunc? Or will having unit tests for newFunc suffic... |
I am working on a project using C#/WPF and following MVVM pattern. This project is designed for touch screens.
The major objects of the program are the following:
We have Programs which contain Channels which contain Functions. All these should be able to be copied/cut/pasted.
I have to implement a copy/cut/paste funct... |
As a developer who has primarily been doing functional programming in F# for the last several years, I'm very attached to my REPL and use it run my code as I go, testing and refining each function as I write it. However, one area where I often fall short as a developer is in creating good unit tests for every function... |
We had a discussion about the real value of effort estimation (EE) for SW development tasks, and I like to get some feedback from the community.
The major questions in hand are:
Should R&D team provide effort estimation to R&D tasks?
Can you learn and get better at EE, by extrapolating from task A's EE vs. actual dev... |
I have this question, is more about pattern and in theory what is wrong or not instead of if is possible or not (because it is).
In a DDD design, I have a DTO that I am validating, to check not nulls, and other certain values.
There is a field that I just realised needs to be validated through a service that will make ... |
I'm writing an application which would allow users to access the databases over the network. Currently the user enters database details in a form which are later used to establish a JDBC connection. The details I obtain are (1) database host name, (2) username, (3) password, (4) certain other config parameters. Apart f... |
I work for a Rails SaaS platform that was recently acquired by a primarily Microsoft shop. They are pushing the issue we need to rewrite the entire application in .NET. It's very clear they know nothing about Ruby or Rails and are simply scared of something out of their norm and have heard the common thought of "Ruby /... |
Contrapositive-ish question: What is the design reason a library class would not implement an interface as a convenience to the developer? (e.g. the .Net library class FileInfo)
The FileInfo class necessarily is dependent on the file system. This obviously present problems when unit-testing. If I had to design and imp... |
I'm currently writing a design to add the possibility to mark a field or attribute for an entity as read-only in preparation for imminent removal. The idea is that, once the field has been thus marked and the change has propagated everywhere in production, we can run a job against our database to remove that field from... |
In OOP, is it possible to have a class that inherits from multiple other classes? And if yes, how is this situation called?
For example, suppose I have the following classes:
Eye
Nose
Mouth
Eyebrow
Ear
Hair
Skin
Now I want to have a class called Face which should inherit or depend on all these classes to make a Face o... |
We recently migrated from SVN, with most code in a single repo, to git, with most projects in their own repos (about 70 of them).
We build about a dozen different apps from this java source. The apps all run on *nix servers.
We use maven and nexus to build.
Many of us are struggling with developing features when that f... |
I have a single linked list of elements. Each element has a unique ID (positive integer) and a type. Each element may have a "sister" element, associated by its ID, that may also be in the list. The sister element is always of a fixed type and it does not have its own sister. The sister element may be in another list a... |
APIs vary in their complexity, functionality and also usability. In Mobile Cloud Computing (MCC) applications, which are mainly mobile applications that offloads processing / storage to the cloud, APIs can be complex as they may span across both Mobile and Cloud. Therefore, adopting these APIs may be difficult.
My ques... |
Problem statement - I have to construct an invoice (having line-items, legal details, payment details etc) using booking and payment information of a hotel booking. There are two sources for these two data points (payment+booking) - a third party tool that gives you both and an in-house application that gives you the s... |
I am working on a project where a user can send email to either a contact from his directory (Internal) or type an email address explicitly (External Contact) or a mix of both.
We also show the read stats of the mail (who read what and how many times) this object somewhat looks as follow
class X {
String text;
... |
When an application A communicates with an external/3rd party system B, there is always a chance that B is down.
Say that A raises an event that should be sent as a message to B via HTTP, what is the best way to guarantee that the message is delivered?
One possibility is of course to have some retry logic to resend the... |
Does it make sense to declare a async method as private and then create a public method to act as a wrapper that calls the private method with ConfigureAwait(false)?
The intended purpose is design an intuitive API that hides complexities and doesn't require the user of the API to have to think about ConfigureAwait.
Is ... |
I'm trying to build an appointment system but at one point I stuck
Problem:
I define available slots for the next 7 days with help of a cron.
I have multiple users serve service more than one location.
Now for example if
- P1 location have two User U1 and U2
- P2 location has the only U1 user
now for P1 location, I... |
Ive been looking around for a way to design a database for large amounts of leads (users) with custom fields.
Ive check this out (How would you design a user database with custom fields), but this solution would limit the amount of custom fields.
So far ive been designing it in three tables:
leads (I... |
Consider an application where you can create and edit a SVG file (e.g. draw.io).
How should the SVG be stored in the database?
With SVG (image/svg+xml)
Thus no further processing is required before the data is stored. But after the data is retrieved the SVG needs to be parsed so the application can set up event handler... |
I am currently building a finance application that contains "accounts"
Each account has a balance that is dynamically generated based on platform charges vs payments. e.g simplified example.
$account->balance = $account->transactions->sum('amount') + ($account->charges->sum('amount'))
It's obviously very simple how... |
I work at a company where we have wrappers for pretty common things: pthread library and time.h functions. Management claims that this was done so that if we ever need to switch to another thread lib or use a different set of time related functions, it can be done easily.
I understand that doing this for third party li... |
I come from a Java background, and my colleague is from .NET. We are working on a Java project and I saw him create a method like this:
public Object myMethod(Object[] param1, ErrorMessage errorMessage) {...}
ErrorMessage is a self-defined object that just holds a String, and is checked if empty or not in the caller.
... |
Are there cases where more verbose code (as in more logical statements) is more clean than more concise code?
|
We use a branching git workflow, but we have real issues with merge conflicts. None of us are git gurus so we always end up manually resolving the conflicts in an IDE which is error prone.
There has to be a better way? We have 4 teams, all with 5+ devs working in the same (very large) codebase.
We branch off master... |
We have multiple projects that are using common binary assets (e.g. images, sounds, 3D models etc.) stored in a folder on a server. Right now, each project adds these assets to their git repository. The result is that we have multiple copies of the same asset across different repositories, and if the asset changes, eac... |
Right now I construct all objects of my application in the root class manually. Since it is getting ugly now, I want to switch to an IoC-Container like Autofac. Now I have to register each interface with its corresponding implementation manually. Looks great, works great, but:
Say I have to modify one of my classes' co... |
I am making a watchlist type application that will get all items being watched and then poll an api every ten minutes or so to check on its status.
I am trying to design the database portion of this project and wanted some advice on the best technology to use. I am very experienced in relational databases but have used... |
I have a very specific use case. We are working on a Project where user can buy the tickets to an event. In this, we are asking the user to enter an Email id where he can receive the email from where he can receive the ticket onto our App. This email has the link using which user will receive the ticket inside an App. ... |
Minimum-documentation is one of the basic features of agile development (intuitive GUI, visually rich documentation, automated tests replaces it). But usually software development goes hand in hand with the development/reengineering of business processes and (in opposite to agile software development) the introduction ... |
I am planning to set up a new Web-application that contains the following things:
I want to use JavaEE with JSF for the Frontend & Backend combined with git-hooks to deploy them onto my server. Also it seems to be useful to integrate the Spring-Framework whenever you use JEE. Now additionally, I need some database inte... |
So one thing you do not hear much about is inheritance with DDD. Currently I have an Account aggregate that handles details regarding a financial account and its subaccounts. Then a Transaction aggregate is used that maintains the invariants related to a financial transaction. The transaction is not a split transaction... |
Let's say I have users, groups (or "roles") and resources, and I want to manage various permissions on those resources. As far as I can see, there are two main "philosophies" when it comes to permissions.
For lack of a better word, I'll call the first one "precedence-based", and it's used, for example, by NTFS or SQL... |
I am working creating api for activity feed of user. Feed contains different type of entities.
Before that let me give you bit overview about the app. Its a video app where Users can ask questions then we show results of matched solution. If user watches any of video from matched solution. we show that in feed (all use... |
I need to check for the existence of a record in an SQL database. If it exists, create a printer stream and send it to a label printer.
My issue is that I have as many as 20 of these services running at a time. It seems like a bad practice to continually monitor the tables for data, but I cannot come up with a better... |
So my client asked me to provide a rough estimate of a number of CPU cores and the needed memory for a specific project I'm working on. But the project is complex, is different from anything I've been working on and different from anything they have running, is not completely defined yet and not much has been done.
I ... |
A short introduction to the problem: I'm working with a small database where I have a table of strings (web URLs, to be precise) as pairs: hash|string. Another table references these strings by hash so I'm saving a lot of space and some CPU cycles by using hashes (a compact identifier of a string). I knew collisions we... |
I'm building a PHP app which should somehow receive emails that are to be imported into user records. None of the solutions I've come up with will work (listed and explained below). I'm hoping someone out there has a possible solution.
Our organization's email is hosted by Google, and so I can use the Google API to a... |
I wrote an app with the MVP Passive View pattern.
My solution has four different projects. A MyApp.Core containing all kind of business logic, a MyApp.Forms containing stuff related to WinForms (UI), a MyApp.Tests contain all unit and integration tests and a MyA0p.Xamarin containing stuff related to XamarinForms (UI).
... |
Non-mainstream OSes (Genode, BSD, Haiku, etc.) tend to have problems with drivers availability/support. Why don't they reuse Linux drivers? I would imagine they could provide some ABI compatibility layer, which would make reusing Linux drivers possible. Why don't they? If "it's too much work" — can you give an example?... |
WhatsApp has the "Delete For Everyone" feature that makes it easy to delete messages you did not intend to send to the other user.
For text messages, this recall is easy, but what about Video, Photo or other message resources? In Android, whatsapp messages and resources get saved on the device. Is that deleted too us... |
so I'm working on a website project with the goal of writing my own blog posts with markdown syntax. I made some thoughts regarding the handling of the markdown and the conversion to HTML, storage solutions, performance and flexibility. I'd like to get your thoughts and experiences regarding this, trying to find the op... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.