instruction stringlengths 34 36.1k |
|---|
Unfortunately, I do not have the flexibility to use Quartz for scheduling and am left to build a simple scheduler for emailing based on frequency determined by user.
A user can choose to receive the same notification daily and weekly and monthly and yearly [ Yes, this will mean that the user gets the same notification ... |
As I understand, when following the Low Coupling High Cohesion Principle, I should keep together the code that is related to same theme, splitting the code into modules/submodules by its "domain" or, in other words by what "topic" it is about, not by its "type".
E.g. it can be considered a bad idea to keep all interfa... |
I am creating a website that allows to teachers to uploading courses, what's better, to just use the DB or should I use storage services, and how could I know the size of the videos?
I am using AWS if the services better, please give me a service name.
|
**** EDIT: See below for "working" code based on the discussion.
I'm re-writing my software from scratch and instead of hardcoding the processing libraries I decided to take a look at dynamic interfaces. But even the examples I found were not explicit in what I wanted to do. I'd like to write the management thread proc... |
If I have code that looks like this:
int i;
void functionA (){
for (i=0; i<10; i++){
functionB();
}
}
void functionB (){
for (i=0; i<20; i++){
doSomething();
}
}
It seems like using the same variable i to iterate through the two for-loops would overlap and cause errors.
I've always just... |
It's a SEQ diagram designed for a smartwatch app to receive zone level of feeling from an adult with autism on their smartwatch and provide a recommendation based on their input.
The scenario is like this:
At one of the pre-configured times or in case of outbursts, the app sends an alert.
Sarah senses the alert and r... |
I have a simple use case:
Newsfeeds aggregated based on posts that are linked to geopoints
Users can comment on feed posts
Users can like feed posts and comments
I'm certain that Redis as a cache can provide me with what I need if this app were to come under high load, however I am a bit puzzled about the following o... |
The consensus seems to be that it's better to put an if statement guard clause at the top of a method rather than using an if else statement.
However, how can this be done with a void method and Console.WriteLine() to display an error? I would argue that example 2 is pretty ugly, especially if you have to validate mult... |
Some programming languages allow conditional value assignments that look like
x = (IF condition THEN a ELSE b)
My search-fu is failing me: how do we call such statements in the jargon of programming languages?
It evokes functional programming, though some imperative languages achieve the same with a "ternary operato... |
I'm thinking of developing my first mobile app and now that I have chosen the language(react native), created the wireframes and done almost all the preliminary work, I'm about to start the actual coding part. I'm wondering if create something like a UML class diagram could be helpful or a waste of time.
Also any other... |
Sorry, the title of my question might be a little confusing. I have this online game that utilizes websocket connections for the users to initialize so my server can broadcast messages to all them in real-time as the game progresses. I figured this was a better solution than having the clients polling the server every ... |
Visual Studio often recommends the 'simple using' statement rather than brackets. However, which is actually better?
I quite like the simple using statement, but I can see it potentially causing problems since you can't see the scope. The simple using seems a bit less clear that it's a using statement.
1. Simple using
... |
I have a Shop which sells Items for a given Price.
To be clear, this is in the context of a video game, not an enterprise ERP system. The game operator can create Shops that Players can use to buy supplies, weapons, tools, etc. Players also have the ability to create their own Shops, ideally using the same rails the ga... |
Hi I am new to async/await in C# . I have created a controller which is accessing result from HttpClient injected through HttpFactory. Here is my working example
class MyController
{
private readonly IExternalServiceManager _externalServiceManager;
public MyController(IExternalServiceManager externalServiceM... |
I am looking for alternative ideas of how to implement the following situation (.NET Core, C#)
Having multiple sensors that communicate over a RS485 interface with the host. Each sensor is implemented using an generic ISensor interface (All sensor types have a certain function which must be implemented over the ISensor... |
I have a bean that has around 10+ fields and it may grow till 30 odd fields. The bean is a contract between applications to share data over an HTTP call. Basically, a downstream application will set exactly one field and will make a rest call.
class Person {
private PersonalInfo personalInfo;
private EducationD... |
I'm developing an app (using Flutter) that has a model that contains most of the business logic, and a view that displays the user interface. The model can call notifyListeners to inform the view that some data in the model has changed, and the UI should be rebuilt.
I currently keep track of the status of some pieces o... |
I have the finance application where we can have different types of transactions, like balance enquiry, funds transfer, and pin change etc. Now the Transaction is a base class, and there are specific child classes implementing it as per above use cases.
Class Transaction
{
int txnId;
String sourceAccountNumber;... |
I've quite frequently seen benchmarks where the tester discarded the highest and the lowest time out of N runs.
Discarding the highest time I understand; it's probably high because of some other processes running suddenly demanding more CPU.
But doesn't the lowest time indicate the best possible performance when the be... |
So I'm currently building a .Net Blazor PWA, and I was wondering how the behaviour of my application looks like when it is installed on a mobile device, and the user is done with the app for the time being.
My current setup looks like this:
The Blazor application builds up a SignalR connection to my server (which is es... |
I need some consultation on the correctness of the activity diagram, that I have created for the following scene:
I have one dictionary structure, that I want to compare to other dictionaries. for the explanation I want to name them as sentences. So, I am comparing one sentence to other multiple sentences by iterating ... |
I'm referring to "Fluent Python" by Luciano Ramalho. In chapter 12, there's a section "Coping with Multiple Inheritance" where the author suggests a few best practices, such as:
Distinguish Interface Inheritance from Implementation Inheritance
Make Interfaces explicit with ABCs (abstract base classes)
Use Mixins for C... |
In the Xamarin.Essentials library there is a Location class that comes with a DateTimeOffset TimeStamp.
I know I'm being pedantic and I should just move on - I know it's to indicate a location of the device at a moment in time, but I don't like this. Locations in three-dimensional space have no associated concept of t... |
An API is often analogized to a waiter in the restaurant but the analogy stops here fruitlessly. To assist me to understand this analogy, I want to match each of the words in "API" to something about the restaurant waiter, like body parts or waiter's functions. Thus what exactly is the Application? Programming? Interfa... |
I've been practicing DDD and refactoring an app to understand it's principles and applications better. However I can't fully grasp some of the ideas and how to implement them in my business domain.
Let me start with stating a business requirement: A user can place and order and this order would need to be verified by a... |
Context:
Recently I was discussing the design of a small programme with a new team member (I am the product manager). The programme is essentially a protocol converter that reads data from a number of sockets (as a client) and inserts that data into the database. We discussed the idea of having one thread per socket to... |
This code is from https://www.geeksforgeeks.org/segregate-even-and-odd-numbers/
It takes an array of numbers & segregates them in place without bothering about the order.
void segregateEvenOdd(int arr[], int size)
{
/* Initialize left and right indexes */
int left = 0, right = size-1;
while (left < right)
... |
I'm trying to learn more about the fundamentals of containerization.
I came across the term "OS-Level Virtualization" as the partitioning of the user space to further increase process isolation. However, I have two questions about this
what is the benefit of this? aren't processes already fairly isolated via separate ... |
As we all know /usr/local/sbin, /usr/local/bin, /usr/bin, /sbin, /bin, /usr/games, /usr/local/games and /snap/bin are directories that Linux commands ( Except ones that built-in to shell and custom alias'. ). So, some applicatons doesn't needs root password to put their program launcher command to path. I made a launch... |
We are building a software application for a client with a particular naming convention for REST services.
For example if you use a POJO for your request or response in a REST service something like that:
public class Document {
private String codeDocument;
private String codeParentDocument;
private Double ... |
What is difference between Average length of codes and Average length of codewords in Huffman Algorithm? is both the same meaning? I get stuck in some facts:
I see a fact that marked as False:
for a text that it's characters get from set of n alphabets then
average length of codes is O(log n).
I ran into a bigger cha... |
Pandoc is a command-line tool and Haskell library for converting between many different markup and document formats. One of the ways Pandoc's behavior can be customized is via filters -- Pandoc serializes its' representation of the document into JSON and passes the JSON into the standard input of the filter; the filter... |
We have a few backend services that our frontend SPAs fetch data from. Right now, the SPAs use JS libraries to authenticate with the Auth server (Azure AD) which returns a JWT which is validated by my backend services before responding to the requests. We also have a couple of native mobile apps and they too are using ... |
Goal:
I am trying to create a UML class diagram for a java spring application.
Spring uses a lot of annotations and I couldn't find any resources online on how to properly model them in UML.
I know that there is this question and it gives a good answer on how to model class annotations but it does not talk about method... |
I have a WPF MVVM application, the WPF is the UI frontend and I have another project in the same solution that does DB access, I do this by starting a Task from the frontend that executes the backend DB access method.
I'm wondering what is the best practice to handle exceptions in this case? I'm thinking the backend sh... |
The Common Lisp Cookbook discusses how to use ftype to declare the inputs and outputs of functions. In compilers with a lot of type inferencing like SBCL, this would seem to offer a lot of support during development at both compile time and run time for error checking and generating efficient compiled code. (The extent... |
The title almost sums it up but let me be example-led and clearer.
Assuming we have a class:
class T:
def goto(self, value):
print('go')
And a second inheriting class:
class A(T):
def __init__(self):
pass
Now, of course, instances of A can call the goto method.
My question is: Does this break immutability... |
I have a function which returns either true/false, each return plays nicely with the function name: isOnline, however, there are cases in which I want to throw an error inside of it. Maybe the status server isn't available or what-not. But the problem is, errors in PHP are not that well-supported, nor is the community ... |
Context:
Creating a "middleware" between 2 services I have to Get data from Service Source and get it into Service ERP.
There is a multiple type of Data: A, B, C. An integration process follows the following script:
Get pending ID for A
Get A for each of those Id
For each of those A convert them into ERP A.
Submit the... |
In the UML specification 2.5.1 (Link) on page 117 it is specified that the notation of operations (methods) should look like the following:
[<visibility>] <name> ‘(‘ [<parameter-list>] ‘)’ [‘:’ [<return-type>] [‘[‘ <multiplicity-range> ‘]’]
[‘{‘ <oper-property> [‘,’ <oper-property>]* ‘}’]]
What irritates me are the b... |
I have a method GetReportAsync that takes one XML and generates another:
public async Task<string> GetReportAsync(string id)
{
// Get Order.xml from a file database
var order = await _dataService.GetOrderAsync(id);
var report = _reportGenerator.WriteReport(order);
var xml = SerializeToXml(report);
... |
In many discussion I learnt that was undesirable (forbidden) to expose IQueryable from Respository pattern.
What is the best practice then for server-side filtering and paging?
|
An Aggregate Root should always have a unique ID within the bounded context. Typically the examples one finds use a GUID for this to ensure global uniqueness.
However consider a bounded context for a Chat. In this case I deem messages and chats as their own individual aggregate roots. One may consider Message an entity... |
Situation
Right now, I am at a point of realization, that at my present position I am not completing requests with regular interval, have spaced out request completion. But to approach my true ability I want to try to in the course of a day, going for my first attempt, to push my ability to push out 3 moderate sized ... |
I have written a software as a student. All functionality was in the software and it was a 30 days fully functional version. After some years there were cracks around and my income was 10% of before. This was where I decided to switch the paradigm to full version vs. demo version with limited functionality (the functio... |
To simplify I'll say I'm using a list containing an array of Movies, and Movies.
Problem
I have two options to update both the note in the list, and the global note of the Movie.
Single Calls
POST www.example.com/api/lists/:id/ // Creates a new movie entry in the list, updates Movie's note
PUT www.example.com/api/list... |
I'm designing a new language and the package-management system for it (something like NPM, Cargo, Pip, Gem, Cpan, Cabal, NuGet or the like).
I'm trying to decide what's a good way to handle the versioning of a package when only part of it is updated. I'm also curious to learn what's the best way to solve this problem w... |
I want to develop an end-to-end machine learning application where data will be in GPU-memory and computations will run on the GPU. A stateless RESTfull service with a database is not desirable since the traffic between GPU-memory and database will destroy the "purpose" of it being fast.
The way I see it is that I need... |
I've read a number of conflicting articles as to whether microservices should share a database. How and when should microservices communicate?
Someone posed the example of 2 microservices:
Employee
Department
Suppose the Employee microservice needs information about a department.
Should these microservices share a d... |
Let's say a process (P1) is asking for 100 MB of memory, and the RAM looks like this:
[[50 MB free] [USED] [60 MB free] [USED]]
Since there are technically enough memory that are available (110MB free), what would happen? According to some sources I saw online, the OS will just refuse to allocate the memory, but then ... |
I wrote this valid piece code, which made me wonder if there was a name for it:
public class GenericObject<T> {
public T Obj { get; set; }
}
public class DerivedClass: GenericObject<DerivedClass> { }
This leads to the capability of:
var x = new DerivedClass();
x.Obj = x;
x.Obj.Obj = x;
x.Obj.Obj.Obj = x;
// ...
x.... |
I am working on a project which connects to different data sources and fetches data. The problem is each of these data source needs different parameters to fetch the data
s3 = S3(ACCESS_KEY, SECRET_KEY, BUCKET, HOST)
db = DB(HOST, USERNAME, PASSWORD, DB_NAME, SCHEMA)
sftp = SFTP(HOST, USERNAME, PASSWORD)
The fet... |
We have a service (lets say FileService) that provides API to store/download files into various stores (S3/local file etc.,)
We have a scenario where one microservice (Service A) writes a file to S3 via FileService and the same file needs to be read by another microservice (Service B). In an ideal scenario, Service A w... |
Tech Stack: I am using MySQL 8 with InnoDB engine. Application is built using Java with Spring & Hibernate. Database is hosted in AWS RDS and web apps in EC2.
I have two primary tables for handling orders:
Orders (Rows Count = 1,294,361)
Orders_Item (Rows Count = 2,028,424)
On peak days, my storefront generates order... |
Command Query Responsibility Segregation and Model–view–controller patterns look pretty similar to me.
Are they comparable? Do they act at the same layer of abstraction? How do they differ? Can they be used together or one replaces the other? What am I missing?
|
Assume that I am implementing a method that takes a data source in a system. Assume that it's a multi-tenant system, so a data source belongs to an organization (as other relevant entities, like users/datasets/etc). There are two ways to go for it:
getDataSource(dataSourceName, organizationId)
getDataSource(organizati... |
I have been searching for an answer in this topic but I haven’t been able to find a satisfactory one like in other topics, where the consensus is solid.
The situation
To keep things simple: I am implementing a custom Dependency Injection Container into one of my current projects (I know, I should use an already built o... |
In a typical Java Spring Web APP:
we have the following layers:
Model [DB Models]
Repositories [where you have queries to DB]
Services [Business service where you have the @Transactional annotation]
Controllers [Rest endpoints]
So for a simple model e.g Car
@Entity
Car {
Long id;
String name;
@ManyToOne(fetch ... |
In my applications users can perform actions on a few thousand aggregate root instances with a single click. The problem is that the UI is blocked for several seconds (~ 3) what feels too slow. So, I'm looking for way to improve the database operation.
The respective entity class looks (simplified) like this:
class Ins... |
I have implemented idempotent order placement (mostly to avoid accidental double submissions) but I am not sure how to handle incomplete operations. Example scenario:
User tries to place an order.
An order instance with status PENDING_PAYMENT is created in the DB.
Order payment succeeds (3rd party processor, supportin... |
I'm practicing an exercise of use cases but it's hard for me know when it's ok or acceptable. The exercise it's about a system for sacrament of catholic churches and a part say
The archbishopric requires that:
1) All baptism and weddings realized in catholic churches at province be registered in a central database whic... |
I've started in this new company a few weeks ago, this is the CTO CI strategy:
Current: Developer team has the repo prod/master and they merge everything into master (no branching strategy).
Once the code is ready in prod/master they'll ask Infrastructure team to start the deployment process which uses Jenkins.
The In... |
I recently found out about Domain Driven Design and I liked it. However, it is quite overwhelming and requires quite of expertise to get it right. For this reason, I wanted to try to model a simple domain using DDD and event storming.
The domain is the following:
The application allows publishers to publish small artic... |
I'm designing a microservices structure, and I'm facing some problems on how to place data on different microservices.
For example, I have users that subscribe to plans and the plans have different features. For example, a user can download 10 items per month.
So I'm thinking of building the following microservices:
U... |
I've been finding that for a lot of code I've been writing recently, it naively might look like this:
Array approach:
const options = [
{
id: 'red',
label: 'Red',
data: '#f00'
},
{
id: 'blue',
label: 'Blue',
data: '#00f'
}
];
And then something like, in say React ... |
I'd like to build a simple privnote-type clone for fun. The idea is this:
User A writes a note in their browser, browser encrypts it client-side
Server saves the pre-encrypted note without knowing the decryption key
User A then sends a link like abc.hidden/mynoteid#mydecryptionkey to user B
User B decrypts the message... |
I have tried this piece of code:
String[] latitudesArray = latitudes.split(",");
String[] longitudesArray = longitudes.split(",");
Double startLat = StringUtils.isNotEmpty(latitudes) ?
Double.valueOf(latitudes.split(",", 2)[0]) :
null;
Double endLat = St... |
My question is regarding caching and ViewModels in ASP.NET (Core) MVC.
I have a service which injects a Repository<T> which is used to fetch domain models from the database. The service layer transforms the domain models into ViewModels via automapper and then caches them server side.
Example controller:
public FooCont... |
I'm trying to think of a scalable solution for my current system.
The current system is
3 microscopes
1 processing machine
1. 60-100GB Files come from 2-3 microscopes every 30 minutes
2. That data is transferred to a (local) network mount of the processing machine
3. The processing machine runs and contains the ETL... |
QA here. Relatively new to API testing (manual). Thought I'd turn to the experts to try and figure out if my expectations around how much functionality should sit in the API are more or less valid.
More specifically, I'm testing dependencies ie.
if input_field_1 = No then input field 2 should be read-only
if input_fiel... |
According to Robert C. Martin's "Clean Architecture" you should try to structure your system in such a way as to separate low-level concerns from high-level domain concepts.
Following this logic, Martin proposes, that
the Web is a delivery mechanism—an IO device—and [...]
therefore should be seen as a low-level conce... |
If each cloud function or lambda function is hosted and scaled independently would it be considered a microservice?
|
As the title says, why do developers (especially, but not only, new developers) habitually underestimate the work involved in 'greenfield' projects or 'total rewrites'?
We all know that software estimation is not a science, but most problems to be solved are not new, and many elementary problems have been getting solve... |
I'm sometimes torn between two naming conventions defining the order of words that make up a function name. The first one is choosing the words in the same order we would natural use in a sentence, for example:
getFilters(...)
getPairedFilters(...)
getUniquePairedFilters(...)
This reads rather naturally but it's not i... |
I'd like to build detail analytics of my computer usage to try and detect patterns and improvement opportunities. So I'm building a software to record every mouse click, keyboard event and window activation event with a timestamp.
This is potentially a huge amount of data streaming continuously to disk and I'm somewhat... |
In my limited understanding, one-way data binding could happen like the following:
On the back-end, I have a Node backend server. In that, I have a layer that communicates with the database (Model). I have a controller that exposes URIs that the frontend server can connect to (Controller).
On the front-end, I have a Re... |
In decomposing a monolithic web application into smaller services and by following the Strangler Fig pattern, I'm in the middle of a problem for which I can't find a practical solution. There is a web app written in PHP and I'm taking steps to:
Move highly cohesive code into its own service (more precisely a docker co... |
As a hobby / to learn I am building an app in JavaScript using Node.js where a component of it will take input from a client, send it to a server, and then broadcast it to other clients. For simplicity let's say that the data looks like: {"x_pos":0.4, "y_pos":0.2}, and specifies an avatar's (x,y) position on a map in a... |
I have been trying to learn neural networks from scratch
(in Python). Wherever they talk about neural networks, I don't get the meaning of activation of a neuron, and need to understand the basic meaning of activation. Is it like activated - non activated boolean?
The definition of bias says it helps to compensate the ... |
For my final year project I'm looking to build a distributed version of a popular benchmarking client (this has already been done using various methods involving some form of existing frameworks), I have been advised by my dissertation supervisor to consider implementing a RESTful service. Essentially what will be happ... |
Here is description of my app I'm working on. On the client-side (index.html) a user can interact with a data. When he needs to call a server operation for example reading or writing a file on the server, he must authenticate himself and send JS async request. The index.html and API are hosted on the same domain.
The f... |
Imagine an app like Instagram/Reddit with a feed of posts.
Problem: We want to show users posts they have not seen before.
When the user first opens the app, we retrieve 30 latest posts from the backend and show them to the user.
The user sees 10 posts and leaves the app.
At this point, the user has seen post with id 3... |
Recently I came across some article on Chess OOPS design.Following is some snippet from it:
public class Chess {
ChessBoard chessBoard;
Player[] player;
Player currentPlayer;
List<Move> movesList;
GameStatus gameStatus;
public boolean playerMove(CellPosition fromPosition, CellPositionb toPosit... |
Currently, I have an application generating time series spacial data. The data is weather data with coordinates and a time of reading.
I would like to receive chunks of the data in a time series way and I am currently using a generated CSV as a response to input requests
temperature,latitude,longitude,timestamp,
10,50,... |
I have a website that was writing using .net stack technologies. It is accessible via the internet. Some of my potential (Enterprise) customers want me to install the whole website on their own VM and we dealt with them that the website will live on their VM the only one month (it is enough time to test its functionali... |
My question to the community is this:
What makes C#'s LINQ Unique from other query language in other languages and frameworks, or does it not have anything to make it unique at this point?
Specifically with regard to Django or Laravel, but that doesn't matter all that much. I'm not looking for an opinion of why someone... |
As a software architect/product lead/project manager etc., should you run your database model by your customer? Is it common practice to show that model to have their opinion, or should they trust that the model you chose will fit their requirements?
What is common practice on the subject if they don't explicitly ask f... |
I'm currently a developer in a team of size 3-4 and I am concerned our team is not at all resilient to me taking days off or saying goodbye.
Two years ago when I arrived at the company I made the choice to take over and learn the work of someone departing. We had also the team downsized due to the start of an other pro... |
With the introduction of Apple M1 processor, ARM has stood up to be a capable competitor and an alternative to x86 processors. We can foresee a future where ARM captures considerable market share of x86 in the server space. That means we will be writing software that works and is optimised for ARM.
Such a change would ... |
My goal is to collect/publish different types of information from the application. We use Kafka for the event bus. Consider the following sample code.
class UserService {
public User userUpdateService(String username) {
try {
userRepo.save(new User(username));
} catch (Exception e) {
// this ... |
I have legacy code and it has a function called initialize and this function calls N amount of methods of same object and these methods are responsible for validating identity of personas.
At each method call, the function checks whether the said method approved or disapproved the persona. If the method returned 0 then... |
Consider typical gym trainings tracker app.
User has account related attributes:
User {
id
login
password
email
fname, lname
isBlocked
}
However, the requirements are that an application's user manages his trainings, trainings history, achievements, profile, etc. All of those entities should be somehow lin... |
I am working on implementing a database of sorts and am stuck wanting to make it perfect from the get go because I realize I don't know how to migrate the database engine from one data structure to another (as the data structure implementations evolve). I am afraid that if I pick a database data structure, then I won't... |
I have been developing software driver for the analog to digital converter in C++. The a/d converter is primary intended for conversion of the temperature signals. The temperature signals are then used for the algorithms of temperature protections. My goal is to design the driver interface in such a manner that the dri... |
For learning purposes, I'm trying to build an Expense Tracker web-app from scratch. I'm in the process of designing it before coding it. I decided to attempt to make it a Headless Web-app: The main server will only have an API and the client will query it to render content. This means I can use the same API for mobile ... |
The following is an example of "composition":
public class Car
{
Engine engine; // Engine is a class
}
But is it still called "composition" if we are using primitive data types? for example:
public class Car
{
int x; // int is a primitive data type
}
|
How does a functional programming language, such as Elm, achieve "No runtime exceptions"?
Coming from an OOP background, runtime exceptions have been part of whatever framework that is based on OOP, both browser-based frameworks based on JavaScript and also Java (e.g., Google Web Toolkit, TeaVM, etc. - correct me if I'... |
I work for an organization that heavily leverages AWS. There is a strong push that every team move from containers deployed on ECS to leverage AWS Lambda and step functions for (almost) every project. I know that there are workflows for which lambdas are the best solution, for example if you are running infrequent, s... |
Let's assume I want to use an open-source software, the developer says that the software is open-source and provides the source code.
Now my question is, how can I be 100% sure that the given binary files are compiled from the given source code?
Of course I could always compile the source code of every open source proj... |
From the one side, customer can order "I need products list on /products and conversion statistics on /statistics/conversion". In this case, we need to obey in and write something like:
const RoutingData: { [routeID: string]: Route } = {
products: {
URN: "/products",
queryParameters: {
category: "CATEGO... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.