instruction stringlengths 34 36.1k |
|---|
So, somebody at work who is twice as experienced than I am, told us that we must not create ViewModel classes within Web API. (We are using Angular for UI)
In his opinion ViewModel is ASP.NET MVC approach. And we must come out of it when using Web API.
Here is my argument for using ViewModel in WebAPIs:
Database Tables... |
I am working with a custom, fairly simple DSL for specifying how various scripts will be run. The DSL takes the form of config files that are very simple and easy for humans to read. They define what scripts must be executed in what order and how. I have a program that parses such a config file, and executes the steps.... |
I would like to write something like
<byte> ::= <bit>*8
to mean that a <byte> is a sequence of exactly 8 <bit>'s.
Is there a way to do this in BNF[1][2] or a widely used extension of BNF? How?
|
I have the following StudentGroup class:
public class StudentGroup
{
[Key]
public int Id { get; set; }
//the set of peers who will review the work of the StudentGroup
[ForeignKey("PeerReviewGroupId")]
public PeerReviewGroup PeerReviewGroup { get; set; }
public int? PeerReviewGroupId { get; set;... |
I have a code at my local machine, with which I want to call an AWS Lambda function.
I have configured AWS API Gateway as doorway to Lambda function, but I am concerned about security when sending credentials as query string parameters.
So could anyone suggest nest approach to pass credentials to Lambda function even i... |
I have a hardware device connected to the computer and on the hardware device there is 512 bytes of memory for storing parameters. I want to read this data and decode the parameters stored in the memory. I will explain how I currently do this, and then ask if there is a better way.
I read the data using this function c... |
We have an issue with how the implementation of the Data Access layer (EF6 Includes more specifically), influences the behavior of our Domain layer.
A theoretical example to illustrate:
Application in 3 layers, DDD:
Domain layer: simplistic domain model
An Order has Orderlines
An Order has a public property "CanBeExt... |
I am working on the development of an SDK in Android with Java, In general the user doesn't need to inherit any class of the SDK, so the question is if it is a good practice put by default all classes as final in the SDK's Classes?
|
Long story short - I would like to make a web application, solely for self-education purposes, that should allow user to add additional functionalities via plugins - just like Jenkins - https://jenkins.io/doc/book/managing/plugins/ - which does it via extension points.
But beside that, at the same time I would like eac... |
We are starting our new application in which we using MS SQL DB for all our insert/update/delete/select ie. both SELECT and DML operations.
But, soon we will have two different sources. SQL Server DB and Elastic Search. The idea is to perform all the DML operations on MS Sql DB but will be using Elastic Search for ALL... |
In C, global variables are stored with the program code. I.e. the space to hold them is part of the object file (either in the data or bss section), instead of being allocated during execution (to either the stack or heap).
What other ways are used by languages to store global variables? For example, consider a dynamic... |
We have a text file with extended ascii (words like 'Systèmes' and 'Café').
It is in Google Cloud Storage. Its Content-Type is text/csv. If I download it via the browser UI (https://console.cloud.google.com/storage/browser/...) all of the characters are correct. However, If I download it from java, using the code be... |
For libraries like NGRX - Actions or NGXS - Actions when creating an action you create an interface or class like so:
bar-action.ts
export class Foo {
static type: string = 'bar-foo';
}
// etc classes
They are simply imported in angular:
import { Foo } from './bar-actions';
All great until you want to do something ... |
I'm writing logic for a patchable game, and patching involves modifying multiple files.
type UpdateInfo {
file string
data []byte
at int64
}
func AtomicUpdate(ui <-chan UpdateInfo) error {
for _, v := range ui {
file, err := os.OpenFile(v.file, os.O_RDWR|os.O_CREATE, 0)
if err != nil ... |
A potential client is very interested by a VSTO product we developed. However, their IT department is concerned wether they should trust this sofware. Mainly, they are worried it could expose a security breach into their system.
We are a small company, with very little reputation.
Our apps are signed via en EV Code cer... |
We have a Java Play Framework Application which we want to scale out into a cluster. The only issue is that there are services ran by the Akka Scheduler once per day, and we don't want these services triggered by all the instances. Here are some of the options we have thought of:
Extracting the scheduler operations as... |
As far as I know, the DBContext or underlying persistance technology should be only contained inside the Data layer.
Also, it feels very wrong to me to have identity package inside the user interface layer. The identity should be the responsibility of a centralized business layer, which in case should be usable by oth... |
Every day, there will be a set of new data that I will need to write and update to the database. This set of data can contain 8-10million records.
This new set of data comes from Service A and it writes directly into a database which is used by Service B. I don’t maintain Service A but I do maintain Service B.
The pro... |
We are a fairly new team of 5 devs working on an existing code base to make MVP somewhere in Q2 2020. We do not deliver to production yet but we do demo to stakeholders on our progress.
We try to work as agile as possible but because we are new (1 dev 8 months, 1 dev 4 months (myself), 2 devs 3 months and one dev 1 mon... |
I have a library that provides access to our content management. It consist of a public ContentService and an internal ContentRepository. The ContentService is public and Dependency injected through out our solution. The ContentRepository is only used by the ContentService.
My issue is that I am passing 3-4 arguments ... |
From my understanding, parser generators accept as input some form of context-free grammar description. The context-sensitive features are handled during semantic rather than syntactic analysis (please correct me if this is wrong).
Since shell languages inherently have a lot of context-sensitive features, is it worthwh... |
More specifically, how to study competitive programming, but starting with the notes.
Some background information: So I am new to programming. I noticed that competitive programming is a lot like math competitions. These are real world problems and just remembering a few for an exam is not like the industry. For exampl... |
I have just started learning about model-driven engineering.
But I have a hard time to grasp the different model levels, given software example. Would not the model always be represented in a UML diagram or a class? Which then makes the above level to be the same in all cases?
|
We are now in a process of migrating our server-per-client architecture to a multi-tenancy architecture.
Everything is in place except for one design issue we are having.
We are using a subdomain in order to determine what tenant it is and route it to the proper DB (it is DB-per-tenant).
Let's say we have a tenant clas... |
Redux uses a state reducer pattern where essentially you create a pure function that looks like:
function reducer (previousState, action) {
//...
return newState;
}
This looks similar to JavaScript's Array.reduce function, so I don't think the concept of a 'reducer' is something original to Redux.
However, ... |
I have to call a critical API over a network (which makes it unreliable) many number of times in a go, many times a day. If the API fails to respond (timeout) or returns an error (because that server is in turn calling other unreliable third parties) i have to notify them about the error and then call the original API ... |
I'm building an Electron app using React. I'm coming from the C# and WPF world and I'm wondering, where should my domain classes go? I understand the concept of components, but what about a class with no UI, just a lot of methods in it?
For example, an application for managing software teams in the company. There is an... |
I am building a Data Collection Web Application with Flask and MySQL Database. It is basically a creating a Bill Of Materials for the organization for a new product.
Bill of Material in a form looks like this
This application is giving three interfaces to three different groups ie:
a) Engineers - They will be adding Pa... |
I am working on a project to use fingerprint to authenticate the user. I don't want the authentication to be device specific. Hence want to upload the user fingerprint to cloud.
I do understand that fingerprint can be considered to authenticate the user on device using :https://www.npmjs.com/package/react-native-biomet... |
We are building a backend RESTful service for a workflow builder. The service's responsibilities will be to accept workflow definitions from a frontend and store them in a database.
We are trying to decide between the following two choices for the structure of the API.
Choice 1: Single API, saveWorkflowDefinition, wh... |
When writing tests, I often struggle with a conceptual issue, and maybe I am missing something major here.
For many classes, the test writing is straight forward and simple, often tests (and their verification) are even possible to be repeated with any amount of random input data.
However, for a certain type of classes... |
Currently I'm building GUI applications for Linux and they have many dependencies( We ship Raspberry Pi devices with the executable installed on each device). My idea is to create a docker image for the executable and copy the image across all the devices instead of installing all the dependencies on each device and th... |
I have several jobs that run nightly. Generally they work but from time to time they fail. What's the best way for them to report failure?
The way that seems obvious to me is to send email. I have several google accounts and would like to use one for this purpose.
However, I cannot after several attempts, get my head a... |
So I have some naive implementation for the following problem:
We have a list of objects with action methods that have to be trigger at some value of interest.
This value is polled (or is streamed) from a remote server and is constantly changing.
Let's say we have tens of thousands of such objects in the list, and t... |
What's the relationship between the two?
Both are for atomic operations. Both results need to be either success, or failure with rollback to original state.
|
Say I have two Map instances in JavaScript (or HashMap in Java, or Dictionary in C#), A and B. I want to synchronize B to A, so that B is a copy of A. I can't copy the reference and I don't want to delete all keys and re-add; I want to keep B available and mostly accurate during processing. What's the most efficient al... |
I'm using a public git repository and adjusting it to my specific needs, meaning that the changes are not worthy of being merged upstream.
Repo is in github (upstream), and we maintain our own git server (origin), where the fork will be store.
The original repo is quite active and has 10+ release branches plus as man... |
I want to implement "FaaS least cost routing".
It does not make sense to calculate the costs before every request, but calculating the cheapest provider on a daily or hourly basis would make sense.
My question is specific to FaaS. No storage is involved.
As far as I know up to now the FaaS providers (Google, AWS, Azure... |
Maybe I'm being dense, but is it common practice to create an API which requires users to submit GET params as an object? I've encountered one which has me submitting GET requests like...
http://www.example.com/?ip={keyOne: "ValueOne", keyTwo: "ValueTwo"}
I find this makes using Postman with the endpoint pretty difficu... |
I know that associations in class diagram can be bi-directional or directional. We refer to this as navigability. I am not sure to fully understand what it means.
Please consider the following example :
Does the navigability in the example meant that we read this association as "one order detail is related to one it... |
I'm starting a pet project and would like some advice. I need to perform the following:
Scrape JSON Data from a REST API
Save the Data into my Postgresql table
Paginate through the rest API and continusously bulk insert rows into my Postgresql table.
I have some specific questions regarding 2 and 3.
Question regardin... |
Where would I begin if I wanted to develop an algorithm that maps consecutive whole numbers to a long list of unique sets of whole numbers. For example:
0 = {0, 0, 0}
1 = {0, 0, 1}
2 = {0, 0, 2}
3 = {0, 0, 3}
4 = {0, 0, 4}
5 = {0, 0, 5}
6 = {0, 0, 6}
7 = {0, 0, 7}
8 = {0, 0, 8}
9 = {0, 0, 9}
...
29436 = {19... |
This question has been asked first on Stack Overflow, I've been told that this forum would be more appropriate
I am wondering what's the recommended way to solve the following situation :
I have items, Cars which have a color and a car model property
When a customer choses a car on the carmaker website (the one I am... |
I'm working on a video streaming project for drones with opencv where I want to apply multiple stacked image manipulations on a 2D input matrix. I was advised to make all manipulations calls non-blocking.
In designing this I had the idea to give each of the manipulations a thread and 2 matrixes, the last completed matr... |
I have a question about how can manage multiple repositories with unit of work.
I thought for two solutions but I'm not sure.
The first is a classic solution where the IUnitOfWork interface looks like this:
public interface IUnitOfWork
{
IUserRepository UserRepository { get; set; }
IUserSecurity UserSecurityRep... |
First post here on Software Engineering, so I hope I don't goof up too much.
I am writing software that integrates with an application written by a company that has a small development team. I have suggested that they add webhooks to their application so that it can be event driven. They have said that they like the id... |
I am in the process of designing a simple portfolio management system for financial advisors. The central table here is an 'tb_account' table that holds the various accounts an advisor manages. I create a random unique account number and store it in the 'accountno' field in the table tb_account. The field is also the p... |
I have been doing some research on the Hexagonal/Ports & Adapters architecture. For the most part, it makes a lot of sense. My initial understanding was that "Driver Ports" were to be implemented by the adapters in the implementing application.
The more work I do on my application, it's becoming clear that this is not... |
I recently ran across some code in a public repo that I'd thought... just plain wrong. The first thing I noticed was
/**
* Sets a test mode status.
*
* @param boolean $mode Mode to set
*/
public function testMode(bool $mode = true)
{
$this->testMode = $mode;
return $this;
}
Then another method used the te... |
I have a spring boot application, that simply does, takes a set of characters and lists out possible english words.
Now, as everyone knows , its fairly easy, build a trie data-structure to load up a dictionary.
Now, the problem is let's say 170,000 words in english dictionary, need to be in-memory, how do I achieve tha... |
I have created a machine learning software that detects objects(duh!), processes the objects based on some computer vision parameters and then triggers some hardware that puts the object in the respective bin. The objects are placed on a conveyer belt and a camera is mounted at a point to snap pictures of objects(one o... |
We have a class in our company's main library as follows:
public class User {
private long id;
private UserType type;
// Getters, setters, constructors, etc.
}
and have several options to implement UserType. One of which is an enum:
public enum UserType {
DEFAULT (10),
TYPE_A (20);
private in... |
In my UI application (WPF/C#, using MVVM design pattern), I have implemented a global exception handler which catches all unexpected (hence uncaught) exceptions and reports the application crash to the user via a dedicated "crash report" window.
Instead of bombarding the user with the entire stack trace right away, I'd... |
I've just started using clean architecture, It's clean and nice, but I've found a bit confusing use case.
My application should be able to register to update a token after some time, so I handled that by calling a use case that starts a ScheduledExecutorService in a statically managed object, after the time is met, the... |
The context
I need to design a Client-Server(-Client) network in C++ that would allow an android application to communicate to a Raspberry Pi and back
I am running everything on linux environment(s) and the project is time sensitive, but a latency of <80ms is manageable.
The problem
I am just starting to learn C++ and ... |
The context: I created a PySide2 app to remote control a pyhsical product. The device is interfaced with a driver to get and set it's overall state (state machine with nested and parallel states) and configuration values. Dependend on the overall application state the model requests the product state periodically, mean... |
In our company we recently had a discussion about which part of an application is responsible for the (re)arrangement of the items of a list.
The list is a visual representation of steps to be done in production. Backend provides it in the "normal" order (1., 2., 3., 4.). In the frontend at the very top should be the 4... |
I am writing a deep-learning program in Python.
I'd like my program do the following steps (the exact steps are irrelevant, the pattern is important):
Download the images and store them on disk.
Train the neural net
make predictions using the trained neural net.
Downloading and training takes quite a while, and when ... |
I work on a GIS-based Network Inventory software. There are two versions of it available: a desktop and a web application.
Currently any feature must be implemented separately for desktop and web. The only common element of both systems is the database.
E.g. if I want to add an entry in the context menu for some type o... |
While recently creating a module for shared functionality between our projects I stumbled upon this question. Should the module be occupied with transpilation of code to older browsers that our projects, in general, should support or should it only contain the essential functionality, assuming compatibility to be an i... |
I believe I understand what REST is and what Agile is. Our company has some APIs that we maintained, usually we only needed to tweak some requests or responses to fit new requirements. Recently, we had a need to create new set of API.
The design of the new API was driven by how the client would interact with the server... |
I have a class containing a list, for example:
class User{
....
List<String> cards
...
}
What's the best way to provide access to this member?
List<String> getCards()
or
String getCard(int index)
I am tempted by the second option so that I can avoid a null pointer exception like this:
getCards().get(0) //if... |
I have come across mutable variables kind often, yet it seems to me it's always been use to solve
a problem of design(typically coping with legacy code) rather than to answer a natural, intrinsic architect design necessity.
Could some architect designer explain when is it really necessary, and why was it introduce in t... |
Imagine you have a chain of functions calls, in which each function is taking the previous function's output as input for the next calculation in the chain.
Make an assumption that you are leading the infra scope, which means you are defining the process chain and protocol, but you have a group of users that are respon... |
I am storing my Ping records in a limited queue, and I also have a cumulative sum to get the average. I'm doing it like a window.
My problem is this: Does it make sense that I have 5ms Ping with 98% packet loss? If I sent 100 packets but only two were answered and had a good response time, should Ping be the ones recei... |
I am pretty new with go mod and vendor... I have a project A and a project B out of the GOPATH. I import project A in project B.
I own both projects and I modify them. As I use externals packages from GitHub, I want to use go mod so I wont be impacted by any breaking changes.
Problems come when I want to modify project... |
I am to develop an inventory tracking system (e.g. keyboards, mice, phones, etc.) I am wondering if it is possible to use 1D barcodes UPC standard for this, will I be able to track each individual item or can I only categories the assets?
|
I am trying to understand DDD, but the scope to which we should seperate out domains seems a bit tricky to me.
Consider a few cases:
1. Utility
Consider I have a utility domain, with 2 helper function.
GenerateUUID
ValidateRegex
Should I split these two into utility/uuid and utility/regex domain as well?
2. Versioni... |
We have a REST API which calls a third-party REST API to Send Emails. The Third Party API is not super reliable and randomly fails every now and then with a 500.
Our Clients do not want to retry at all and instead requested us to build a retry mechanism for failed emails.
We are using Spring-Retry to implement Retry a... |
I'm working on adding Approval workflows around our system which manages CRUD operations for our business item.
Till now, I have been using an optimistic locking strategy to handle race conditions when two users try to edit the same item. The user whose request is saved first wins, and the other user has to try again w... |
Currently have situation between having not much data (mid single-digit to low double-digit TBs (not per data set mind you, but the average total amount)), but desiring tools similar to those that come bundled with hadoop packages, specifically Sqoop, Atlas, and Ranger (which can be easily installed via Ambari with Hor... |
Currently I have a large ontology like this:
There are different categories of variants and each can be somatic or germline.
There are more common behaviours between same variants, like somatic CNVs and germline CNVs have more common behaviours due to the fact that they are both CNVs. But there also are a few behavio... |
I know that the general concept behind event sourcing is that the state of the application should be able to be replayed from the event stream.
Sometimes, however, we need to get information for business rules from other parts of the system. i.e. An account has a user. A user has a blacklist status which is required to... |
I am trying to implement some of the principles laid out in Clean Code by Robert C. Martin.
I had a class that was heavily suffering from the ordering problem. I have solved most of this by extracting the code into separate classes.
I am now left with my main class looking like this:
public class Planner {
public Es... |
This is a matter of naming, structuring and conventions.
I am developing a simple python package. in a directory "PKG" I have 3 files:
__init__.py:
# import the main module
import PKG.main
# in case for: from PKG import *
__all__ = [ "main" ]
main.py (simplified):
import PKG.exceptions
def f(x):
return(x+1)
e... |
I have a workflow process housed in a Jupyter Notebook that uses spaCy to parse text documents. The workflow process essentially reads a text file and returns all sentences containing the keywords provided by user (similar to Google search which returns hyperlinks instead) To use that workflow, a potential user then ne... |
I am working on a project where a user can input different criteria which will be used to fetch tweets, lets call this action as TweetAnalysis. These tweets will then be sent to another internal system (REST API) to do some calculation and get results. Each tweet will have a unique result from REST API. For each TweetA... |
I have this idea of an app and I'm a little frustrated by how much I don't know how to proceed.
My app is basically an art recommendation app.
You start with 3 base images and for each images you click on you're presented similar images with slight variation etc...
So my goal is to make this a mobile app and call it m... |
Not sure if this question belongs here, but I've always wondered how exactly sites like Leetcode & HackerRank test your code. Say you code in Java for a question like,
Find all the duplicates in an array
After clicking submit, the code is sent as part of a POST request to the backend and then what is the most likely ... |
I tried to build a database for Driver Booking system. Here's brief details:
Drivers have several vehicles and they offers the driving service with them
Drivers will charge different hourly rates on the different vehicles
Drivers have base charge for each booking, this is independent of the vehicle types but depends o... |
Often I need to transform a type to another, such as a networking model to a data model, or a data model to a binary representation. Should these transformation functions take an Optional/nullable value and immediately return nil if it's nil, or should the function only accept non-nil values and always return a non-nil... |
Upon generating an entity-relationship diagram of my database I observed several occurrence like this:
This diagram (in IDEF1X notation) shows the following:
Our team's DB convention is that each primary table (i.e., not an association-type table) has its own unique primary key called db_id.
iam_projects.db_id is a f... |
I am looking for a way to handle errors in a Node.js application without getting lots of log entries for the same error event, one from each each affected layer.
This might actually apply to any language, but I still don't understand how to do it correctly. The questions are always who handles the errors, does it make ... |
Sorry if this is broad. But I'm confused on how to scale a file system.
I'm currently working on the server side of a webapp with Node(Express)js, its file system module, and mongoDB.
I'm storing images locally right now but don't understand where these would be stored in production. Are there dedicated cloud file se... |
I am midway through my software development project in Node.js and have encountered a fork in the road. I need to create a "database" or a JSON file, that will automatically delete an entry after it has been in for X amount of seconds. An entry is simply just a random string.
Should I use JSON and write an asynchronous... |
I am a theoretical computer scientist. I have heard the following:
Practitioners do not like randomized algorithms because they are notoriously difficult to debug. So deterministic algorithms are much more preferred.
How true is this statement? If you have can provide examples or counter-examples that would be great... |
I am building a scrabble game, and I have already a dictionary working.
When the user will place letters on grid, I need to check that all the words are valid. Which algorithm can I use or how can I go through each cell of that grid to validate which are words in an efficient way ?
I tried googling but most of search r... |
I have been looking for a good, general design pattern to implement simple mathematical structures where functions have the following properties:
know which parameters they contain, parameters are "fixed"
can be called with variable values as arguments
are defined in terms of other functions, which have the same prope... |
I am designing an E-R Diagram for a simple system where there are some users and contests. A user can create a contest or invite other users to the contest who can decide to accept or not.
I am wondering if it is possible to model this in an E-R using a recursive diagram since a user can invite an other user mixed toge... |
I'm not sure if this is the right way to build React components.
I have a component with several buttons that call different functions in the component. In some of the functions I need to display some extra GUI (inputs, etc.). In vanilla JS I could just do this by creating the elements (document.createElement….) and a... |
When developing a somewhat larger application, with 3-4 screens or so, what is the most common way to organise the code?
I've read that organize-by-feature trumps organize-by-type, so I was considering a structure like so:
xyz/Feature1/
+ feature.pro
+ api/f1/header1.h
+ src/f1.cpp
...
xyz/Feature2/
+ feature... |
I'm working on a Kafka consumer in C# (using the Confluent C# lib).. and practically all of the documentation/examples online leverage console apps to do the consuming.
So, this is fine for logic validation and general playing about but clearly not suitable for a production workload. Is there a recommended deployment m... |
I have a JSON object of arbitrary complexity, representing several entities (not my design choice). I want to partially persist it, only for the changed entities. What would be the best way to mark the parts of it that I will update? (Think "dirty bit"). The JSON will be passed around several microservices (again, not ... |
I'm trying to build a C# application that sends notifications from the server to its users (a mobile app).
Since each user can have its notifications collection changed by any thread, I have to lock those collections whenever somebody tries to read/add/delete a notification.
The problem I think that I might face if the... |
I'm working on a relatively thin front-end web application that talks to an API. Depending on where this front-end application is served from (CI server, staging server, production server, etc.) I want it to be configured to talk to a different API server.
We're not really a web shop, so we're all inexperienced with th... |
We have a scenario in which all the important and transactional fields of our business entities are highly structured and relational. The data size of these important fields is also very small. However, there is a raw JSON associated with each entity that is very rarely updated (only in exceptional cases). However, mos... |
I'm using ReactJS (React Hooks, specifically) to build an application. Part of that application involves account creation, sign-in, and authentication. I only recently finished the sign-in feature, and I noticed that while all my components have access to the JWS/JWT, only my SignIn component has a state for whether yo... |
I organize my Git projects based on the article A successful Git branching model. The problem is that I don't know how to handle the following case:
develop: working on a major app redesign (taking ~6 months)
master: current production version
However, because we access paid customizations (from enterprise customers)... |
I have an API that charges for an order. It accepts the orderId and the amount as inputs. Then it makes a '/charge' call to the downstream, which returns a 202. Immediately after this call, it calls a '/verify' endpoint to make sure that the previous charge was successful.
Now it may happen that the charge was declined... |
It seems as though in software engineering, we care more about these "on and off switch" usages of binary numbers more than the actual values of them numbers... For example, say I have the number:
1011
The "value" of this number is decimal 11.
Likewise:
1001 0110 - Value is decimal 150
However, with bit manipulation te... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.