instruction stringlengths 34 36.1k |
|---|
I know the proper folder structure for an Angular application should be like this:
/app
/core module
/components
/services
/feature module
/components
/services
/models
/shared
/components
/constants
/directives
/interceptors
/i... |
I have developed a task management tool. And some task lists can be very large. (I have myself more than 300 tasks to do).
I would like to do some task reviews from time to time as the tasks pile up to be able to sort them by priority.
I imagine presenting tasks 2 by 2 to the user and ask him what task is more importan... |
Partly for use in my own projects, and partly for fun while being stuck at home I'm attempt to build yet another "block" based editor.
So far I've been using simple objects, starting with a global window.myeditor object, then various sub objects to handle different things. For example I have window.myeditor.toolbar to ... |
I have a state machine in which I might have to restart something when needed (Say restart a hardware). But after restarting, I need to run some tests on the thing. If the tests fail, I need to stop the thing and exit the state machine with a failure status.
In case of failure, how should I handle the 2nd stopping of t... |
Disclaimers:
This question is reposted from SO upon SO user's suggestion to put it here since there is no specific code in question.
This question is a subset of my larger theme of Fortran modernization.
There are useful versions of this question asked already (1, 2, 3) and blog posts, and although helpful, I am curio... |
So this is a very beginner question, so please do be patient with me:
But I am building a little practice project and what I am struggling to understand is the overall structure of the solution, in terms of breaking projects up. I assume this is for easily readability and maintainability and as I have never worked lik... |
In The Art of Unit Testing, 2nd Ed., the author gives the following example for injecting a stub using constructor injection and a "fake object". The goal of the "fake object" is to inherit the interface and break dependencies so that way you can unit test it.
I don't understand how these are examples of legitimate te... |
I've written an app using golang which uses OAuth2(Authorization code flow with PKCE) to interact with the Gmail API.
If I build the app using my own client ID then my client ID can easily be found out through the authorization request URL which my app passes to the system browser during user consent. This won't be a g... |
I've been researching different approaches to i18n in web applications and have found a lot of great resources for locale specific information like CLDR.
There is one area where I really can't find any kind of aggregated information and that is the naming of individuals and organisations. There are plenty of articles o... |
We have put in place an account service management : its reponsability is to let a user register is account, confirm his email, etc...
We have put also in place a process layer that is reponsible to notify the user when his account is altered.
The notifications are done by a notification service that is decoupled from ... |
I found this previous question that addresses the issue. The question is: How do I deal with global variables in existing legacy code (or, what's better, global hell or pattern hell)?
My question is to ask for more detail in how to accomplish the last part of the solution. The most popular solution says:
"Over time you... |
I am looking for a name/paradigm/research area etc. that describes the notion of working with data not in the traditional file-based sense, but instead based on semantics. I can best explain what I am looking for with an example:
Text editors typically work file-based. I write some text, save it in a file and if I late... |
Instead of using singletons, I made one class to hold an instance for every component. Let's call it MainApp.
MainApp is initialized in the entry point of the program and determines the lifetime of all components and resources. It has a single responsibility and that is being a collection of components. That's why it d... |
I have a RESTful API built with PHP. In POST request saving to DB is triggered. The problem is that now I have to support long running tasks. For example a user triggers POST request that is going to take a few minutes to be processed and having to wait is not a good option.
From what I've learnt from now: One of the b... |
Given 2 programs that are exactly the same where one is compiled directly on the host machine and the other is compiled using cross compilation (eg: say macOS to Linux).
Can there be a difference in terms of runtime performance between the 2 set of binaries generated?
Intuitively I'm thinking that when compiling on the... |
I am building a simple client-side web page that can be updated from an admin page. I am using PHP for server-side manipulation of the client targeted page.
The setup feels like an overkill to me:
index.html has some basic html input elements. A button triggers an XML GET request for makeClientPage.php. The PHP scrip... |
There are two compatible versions of the same Product (e.g. database engine) that I want to compare to each other for the same input scenario (SQL query).
The problems that I want to address at first is the instability and stochastic nature of the System the Product is running on:
CPU throttling,
random context switch... |
I'm building a backend service powered by Spring Batch which enables to define and Jobs.
Currently, I have several jobs, that essentially, aren't related one to another.
So,
I have one application.properties file that contains all the properties for all jobs
Packages are bloated with classes that aren't related to eac... |
using a python function signature as an example:
def this_function_has_an_optional_parameter(x, y = 42): ...
I'm wondering if there is an existing set of guidelines specifically for this
|
I am new to VBA and am struggling with overall program design:
Toy Example
Input: Spreadsheet with 20000 rows and 50 columns. Also, order of rows matters.
Task: Create 3 different reports on a new sheet. Computing these reports requires the following logic:
Filter rows based on criteria, perform computation with order ... |
So, the question I have is how do companies handle transactions from a user with bad connectivity. The scenario in my head is.
A user X (with $150 in their account) is trying to transfer $100 from their account to someone else's account using an app on the phone. But they happen to have not so good internet connection.... |
I have many continuously growing (through scrapping) collections in MongoDB Atlas. The documents in each collection follows the following schema:
{
"source_url": "<some url on the web>",
"html": "<S3 url>",
"text": "<S3 url>",
"source": "<data source>",
}
The html and text are Amazon S3 urls of extracted html and text... |
Our legacy application provide a static method public static boolean persist(Data data) for service/class callers for data persistence.
I do see unit testing issue for callers. Is this also an example for tight coupling? - As far I understand, changes can be made inside static method without any changes required for ca... |
What are the relationships between these pairs of concepts:
value/reference type;
value/reference object;
value/reference semantics?
For the first pair of concepts, it seems to me that an object of value type is an element (data or procedure), and an object of reference type is the location (absolute or relative) of ... |
I love gRPC, but I find every step of the protobuf process rather frustrating (particularly in Python). Even though they are structurally similar to data structures composed of lists and dicts, you can't really handle them that way.
You can't assign a list to a repeated field or a dict to a message (also means you ca... |
My controller calls the service layer. The service layer calls a repository or does whatever it does.
If I just return a person object for example how do I know it was successfully retreived?
I can only think of two ways to handle this, but wasn't sure if there was another way or if one of these was a more appropriate ... |
Consider the following general form of a layered architecture :
I need to check my understanding about the second layer from top . More specifically I need to check my understanding the regarding the meaning of "User interface management " . According to my understanding , UI management is the code that underlies the... |
I have just first heard of Unified Modelling Language, or UML (Note I am only an amateur software engineer), which wikipedia states is a "general-purpose modeling language in the field of software engineering that is intended to provide a standard way to visualize the design of a system."
The UML website seems to claim... |
I'm looking at the design of dropbox's edgestore.
It manages several thousands of MySql instances, where all dropbox's metadata resides (users, filenames, etc.). I understand why sharding is necessary, and I understand why it's very useful to have the client talk with a edgestore core that routes the request to the co... |
I have three branch on my git tree. master contains validated source version, develop contains
staging versions, then I have some feature branches.
For now, I have the current strucutre;
The numbers represents some individual commit hashes for simplicity.
master develop feature
o----------o----------... |
I want to design a system that performs certain actions at a predefined time in the future.
i.e. at 2pm on April 10th 2020, do X
I'm looking for patterns that would ensure that the intended action is triggered at the right time & only triggered once.
Ideally, I think it would be best if the action has no knowledge of t... |
I'm reading a design suggestion for facebook/instagram social network in grokking the system interview (closed content :( so I'll describe the relevant part in my question).
They are speculating over how the sharding of the data is done, and according to that selection, how is the allocation of photo_id (story_id/conte... |
I'm following the python documentation about "distributing packages using setuptools". It doesn't mention what to do if a python package you want to include in your install_requires requires a system installation. For example:
I'd like to include the package pysoundfile, but this requires me to install libsndfile1 via ... |
Say two microservices provide information for a product, one is providing general information (A), one for product images (B). Similar to the architecture described in the gateway aggregation pattern, I would like to create an aggregation gateway between these services A & B.
Now if multiple applications would access t... |
I'm working on making a product for tracking workers/staffs locations and in that case the application need to be able to run on the phone for at least 10 hours without the phone suddenly closing the app.
I cannot find too much information on how I can make sure the app are not being closed and how the app can run in t... |
Java was last revised in 2020, while C++ had it's update back in 2017
|
I am current developing a karaoke app in JavaFX, I need advise on the most optimal data structure storing a huge list of songs (library). I am inclined to use Binary Search Trees due to its Big O Performance of O(log(n)).
I am using the String compareTo function in Java for insertion but searching proves difficult wit... |
About 4 years ago, where I was working, software was still being developed with Java 7 + Swing.
It took me a couple years, but we could finally migrate to Java 8 + JavaFX, two years after that.
Now I intend to migrate again. This upgrade, however seems more complex at a glance. While Java is the most I have developed,... |
I'm an IT guy (read: not a professional programmer) and have made an internal monitoring webtool which allows users to search for printers on our print servers. Based on the filtering criteria given, it returns a series of divs representing the matching printers. Each printer div contains a bunch of live information ab... |
I'm in charge of designing the entire backend for the REST API of an application that works more or less like an online browser game (think OGAME, Travian, and the likes). In this game, players are able to loot procedurally generated equipment, like in Borderlands. This equipment can have any amount of bonii to all the... |
I've been working on an implementation of TD-backgammon. The paper/project I'm basing my implementation on is here:
https://www.cs.cornell.edu/boom/2001sp/Tsinteris/gammon.htm
Everything makes sense to me up until the point that it talks about the procedure for back-prop. I haven't taken a lot of upper-level maths past... |
I am writing a recipe manager for a software engineering class I am taking, and I would like to implement classes (in Java, if it matters) to allow quantities and units.
Now, taking recipes into account, we have the typical 'scientific' units like kg, g, lbs, ml, l (dividing between SI, SI-derived, avoirdupois, US cus... |
I am trying to design online chess game(figuring out required classes). Need some suggestion on choosing better option to validate the move. So, lets say, I have below class
Option 1 :
My Initial thought process was to have a validator Factory defined, and set of validators specific to each piece.
Public class Ga... |
When developing a REST API, is it ok to use Form-Data in POST requests or is that frowned upon? All my methods return a JSON body or only an HTTP code, should this be extended to my POST and PUT requests as well? I think that Form-Data is a lot easier to work with, but that might just be that I'm a bit new to developin... |
I have a question and it is quite simple. Here are the details:
I want to pass an options object into my mainFunction and some other functions inside of it, i.e. someFunctionCall and anotherFunctionCall. This options object is very much for configs. Because my algorithm has many different settings, I am much better of... |
I was wondering about a use case scenario for a nested subsystem. Right now, I get on why and how to use subsystems, but when should a nested subsystem be used?
In the picture below, I decided to create 2 different subsystems as they have their own business logic, but they are for the same company. Is it necessary to p... |
I'm writing a compiler, and I want it to compile to a native executable (just Linux, for now). I don't want it to be Assembly, it needs to be PURE machine code. Can anyone point me in the right direction?
EDIT: I want to produce x86 Linux machine code.
|
I'm using Mocha Library and the Library by default use a Test folder. So, I have to copy the code I written in production into Test folder when doing Unit Tests with Mocha.
Anyone can think reason behind this method? Is it appropriate?
I'm just a hobbyist, haven't done programming for large companies. I also avoided u... |
Imagine the following pattern: you have a window with information that needs to be updated asynchronously. You launch and detach a thread to handle fetching the information, but while the information is being fetched the window is closed and unloaded from memory. When the background thread goes to update the informatio... |
I use Python but I guess my question applies to OOP in general. Whenever I create a class I am never sure whether I should put a parameter/attribute in the constructor or in the method the parameter relates to.
For example, let's take a Person class which has a days_away method. The role of days_away is to calculate ho... |
I'm currently learning Jest, Enzyme, Detox and testing in general, but I'm still trying to grasp the benefit of testing. From what I understand, testing is about creating hypothetical situations. Let's say when a hypothetical parameter is passed into a component, what is the expected result versus the actual result? ... |
Say you have the following entity that represent an exact resource from a table, we're talking .NET Core with Entity Framework Core, code-first approach.
public class Person
{
[Key]
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
Generally speak... |
I have written many http(s) servers in Node.js and just take for granted that I can receive many requests and all IO operations are async. However, now I would like to try and implement an HTTP server in C, like this one, but I'm wondering what it would look like to be robust.
Specifically, what I mean is, I don't want... |
Suppose there are 2 layers below the layer being tested:
Technical Logic Layer: calls the DAO layer.
DAO layer: calls the database
(The layer being tested can call the Technical Logic Layer but not the DAO layer.)
If mocks have to be used, when is it better to mock the Technical Logic Layer vs the DAO layer? Let's... |
Recently I've been working on a project to teach myself PHP and SQL, and as the project has gotten more complex I've been wondering what the idiomatic approaches are for creating the backend models from SQL query results.
For instance, I am building out a feature that lets users of my service invite each other to event... |
I'm writing a language interpreter in C. I'm currently implementing a system that allows writing extension modules in C for the interpreter.
These modules are loaded into a code file like a normal module, but behind the scenes they are dynamically loaded libraries written in C. This is an approach similar to the one in... |
I have the following Job class representing runs of a job. I have a list of start and end times in Job class because the same Job can be rerun.
public class Job {
private final List<Timestamp> jobStartTimes = new SortedList<>();
private final List<Timestamp> jobEndTimes = new SortedList<>();
private... |
For example if I have a class like
class Foo {
public int bar;
public Foo(int constructor_var) {
bar = construction_var;
}
public bar_plus_one() {
return bar++;
}
}
Foo foo = new Foo(2);
and in the IDE I type foo.ba I get bar suggested, or if I type String x = foo.bar() I get red... |
I`m trying to understand the LSP History rule. I have read Wikipedia entry which states the requirement and provides an example:
History constraint (the "history rule"). Objects are regarded as being modifiable only through their methods (encapsulation). Because subtypes may introduce methods that are not present in t... |
So I am trying to speed up my program by using concurrency and/or multi-threading and/or process parallelism. The topics are pretty complex and I am sort of new to them so I am still trying to figure out which one to use and when.
My task (rather sub-task):
Get size of a UNIX directory (recursively). In fact, I will b... |
I'm a CS student, and I'm doing a project on shared libraries and dynamic linking/loading. One of the questions I have to answer is how symbols are resolved with dynamic linking/loading. I've scoured the internet and haven't been able to find anything conclusive. I understand different linkers may resolve symbols diffe... |
I'm working on an enterprise that has some Angular/Typescript projects and to avoid repeating code (basically copying and pasting) between them, we decided to go for Monorepo and start write an util library, with unit tests, docs and everything on.
At the moment we're implementing an util function:
export const normali... |
We have multiple applications with different features. We want to create a central security system, where each user is assigned a role. Role has access to certain applications and features with in those applications. What is the best way to define this in database with good normalization.
We want to identify the roles... |
I'm new to TDD. That begin said, I'm trying to understand why would I have to use assertion library when there is console.log/print?
In-fact, I can see more detailed error log thru console.log in JavaScript than what a single assertion statement display. console.log helps me more than assertion library.
I do use Mocha ... |
I need a clarification about the correct process to use a CD to update an environment where a Docker Swarm runs. I understood that I can configure my CD to execute docker service update --image foo:1.1.0 fooservice inside the Swarm and so having my stack always up to last image.
But I do not understand how to manage my... |
My question is more of educational than an actual coding problem. I tried searching the web, but got little help.
I am trying to learn how to write ISR and understand how they interact with user threads.
Consider a situation where, I have an ISR which on getting triggered, will copy data from an interrupt source (UAR... |
I am making a small "search engine app". The app should get three pieces of input from the user:
The name of the search engine as a string (e.g. "googe", "duckduckgo", etc)
The search term
The name of the website the user wants to search on if they want to search only webpages of a particular website (e.g. "reddit.c... |
I read a few articles and Stack posts but I'm still unsure how to use MVC properly.
One of my app features is handling meetings - each having a list of subjects to discuss. My database tables look like this (simplified):
CREATE TABLE meetings (
id int(11) NOT NULL,
date date NOT NULL,
moderator varchar(128),
)
CR... |
In this docker beginner video its explained, that different stacks may depend on different libraries and dependencies and that this can be handled with Docker.
However, I don't get what the difference should be between a library and a dependency. As I see it, a library is a collection of code/packages and a dependency ... |
We are about to plan our server architecture and we want to use the BFF strategy with node.js servers to serve multiple front-end apps.
However we also want to be able to scale easily (e.g. a new front-end should be served) and want to reuse code with minimal maintenance overhead.
So my questions are:
How can I scale ... |
My question is about an "edge case" of the UML class diagram. In particular, I have loads (about 30) classes that implement an interface. They can be split into two groups of similar classes. Within each group the classes only differ by the implementation of the methods from the interface, however they represent fundam... |
My View has a textfield and a button. According to MVC pattern on button click should be called a function of the controller. This function should do some operation on the View's textfield content. It is a job of the View to pass the String contained in the textfield or should the controller grab it?
To let you underst... |
Rewritten Question
I appreciate the feedback and in response to that I'm re-writing my question. I can't give my specific situation (classes, etc), nor do I think that it would be helpful, as I work in a very niche area that wouldn't make much sense to those outside of it, but I will try and use a similar but invented ... |
I have a piece of code that I developed in an academic context for which I would like to build a nice frontend. My approach to coding has been very academic to this point (read: I made stuff up as I went and didn't worry about other users), but that is no longer a luxury I have, so I want to plan this out carefully bef... |
We have a case where as it stands our API looks like
api/workOptions/{workOptionsId}/items/{workOptionId}
There exists business logic that only one workOptionId can have a status of "preferred."
Rather than forcing the client to submit an entire resource document containing all sub elements pertaining to individual wo... |
I'm developing my first Python plugin for a 3D application.
What I'm looking to do
I would like users who've purchased a subscription to the plugin from my Wordpress/WooCommerce web site to log in to the plugin with the user name and password from my web site. The plugin would then send a REST request to see if the use... |
I know that browsers use a separate port for each tab. However, in each tab, there might be multiple scripts doing data transfer over the network. How does a browser makes sure that the data is delivered to the right script, to prevent security issues? How does it differentiates between all the scripts?
|
Let's say we have two variables, eta and phi related by eta = cos(phi).
Is there a way to link these variables in any programming language such that there's no need for two different functions, phiToEta(phi) and etaToPhi(eta)?
|
This is for an Android app, but I think the question applies to any software designed with a service layer.
Our app is structured with a presentation layer that handles the UI and a service layer beneath it, comprising lots of service objects that the UI layer will call when it needs to perform some business logic. Say... |
We have a multi-vendor marketplace (e-Commerce) system and plan to move our data structures into a polyglot architecture to improve the performance of reads (critical) and writes (not as critical).
Offers are placed on a product by several dealers. We have local and online offers and the default offer (first to show in... |
In game making project, client wants to make the game of which the duration is short.
Is the requirement, "the duration of the game should be short", non functional requirement? or functional requirement?
|
Wikipedia gave an example of State Pattern:
Define LowerCaseState and MultipleUpperCaseState, both inherite from State.
interface State {
void writeName(StateContext context, String name);
}
class LowerCaseState implements State {
@Override
public void writeName(StateContext context, String name) {
... |
I need to model the persistence of combinatorial information. For example, suppose that the combination of 3 attributes (A, B, and C) are used to reference a given product. Besides that, supposed that a given product can belong to different combinations of A, B and C. The queries will be used to constraint the possibil... |
I'm building a project and I only know the MERN stack. Everywhere I see the general consensus is that Mongo is not good and should only be used in very specific use cases. More importantly, I also want to expand my skills so I thought this would be a great time to try out PostgreSQL since there also seems to be a ton o... |
I've willingly inherited a VB.Net forms project based on .Net 3.5 last edited with VS2012. I was able to open it up and up-convert it to VS2017. I can compile and run it and make some little tweaks. The code is written a little more like a VBA project/module filled with random classes behind form files and 1000 line me... |
I am new to RabbitMQ and herewith I want to make sure that I am not missing out on some advanced RabbitMQ feature or pattern I am not aware of.
I need to develop a reliable system that processes a few smallish RabbitMQ messages per second (~40/sec). My application receives those messages by subscribing to a RabbitMQ qu... |
I am working on an application where I will be using Android and iOS biometric authentication.
Coding the use of biometrics on the devices, including prompting and determining whether or not the user device supports it is easy. I can get fingerprint authentication up, face recognition, etc. without any issues. On Andro... |
When writing a long process, i.e. one filled with many steps of business logic, what are the best practices for organising it? There are a few different options here that I can see:
Just write a long script - however steps aren't modular or reusable
Write each step as a function and call each in order in the main meth... |
I have a device that connects using Bluetooth Low Energy (BLE). I want it to communicate with a server over the internet using a smartphone as a gateway.
I have thought of different approaches and I would appreciate any objective input.
Approach 1
Write a smartphone app that processes data between the internet and Blue... |
I have the following situation, which seems to be coming up in multiple teams/services in our Microservices architecture.
We have Service called "Program". A call can be made to create a new program, the first thing it does is do the basic initialization of a program and then fires and event saying "Program Initialized... |
I am working with an API that is used for registering bookings in a ticket system.
Some of the calls I have to make take complex XML objects as arguments.
Some data points in these objects have to be retrieved via multiple API calls in-between which a transformation is necessary before this data is combined with existi... |
I have a little React app and I'm ready to test it. The first thing I need to do is to create some input objects with random data. I can proceed in one of two ways:
I can create my own fake data line by line using something like faker.js. This will create new fake data every time I run my test. For example:
let c... |
I've been designing and developing a very scalable logging library for a while.
The main goal of this library is pretty simple. Like many others projects, a simple goal does not mean a simple way the achieve it. Days after designing the API and the main architecture, this library seems to have a quite large engine on t... |
As I am moving a part of the monolith app logic to a microservice, I am standing before a problem with scalability.
Currently, the main monolith runs on different instances, and has some scheduled services. Some of those services are pretty straigthforward, but there are some services that are sending emails basing on ... |
I'm part of an initiative where we are moving monolithic-ish applications, each running on their separate VMs and using a common database cluster, to a container architecture with the goal of eventually breaking down all the monoliths to microservices.
A big part of the deployment is initially creating users and databa... |
Consider the following sample C# Data Transfer Object (DTO):
public class MailingAddress
{
public string StreetAddress {get; set;}
public string City {get; set;}
public string StateOrTerritory {get; set;}
public string PostalCode {get; set;}
}
I can write unit tests to check for someone setting the vari... |
Context - I'm building a flight booking system (online travel agent) that will partner many airlines to sell their seats.
I've designed my architecture to work like this:
When a user searches for a flight route, a request goes to look up a cache
If the cache has available flight inventory, return it to the user
If i... |
For example, does it make sense to refactor the following code:
a = a * 2;
as:
const int INT_TWO = 2;
// ...
a = a * INT_TWO;
My question hinges on the fact that the new constant conveys no extra meaning (as opposed to calling it, say, FOOBAR_FACTOR).
|
I was wondering if there is some cost saving, either in time or space by passing and/or returning smaller arguments? char vs int.
I have heard the compiler will optimize the code based on the type of the processor 8,16,32 bits.
I think it will pass using a register, so that would be the max value of the register.
Perso... |
I'm working on an API that allows users to invite each other for events. When someone is searching for users to invite, I want to include in the response information about whether a user has already been invited. One way to do this would be to have the response return objects that look like:
{
"is_invited": false,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.