instruction stringlengths 34 36.1k |
|---|
It seems to me that update a property is always an 'event' and that all you can do with an event handler can be done in the property let/set routine.
And, in my limited experience, I never needed to raise an event without change a property.
So, I see them as a duplicate for a functional point of view and maybe useful f... |
Over time I become used to use the type of the returned value of a function as a piece of additional information.
For example:
A function that is supposed to return or an array if the arguments are correct and can find a result, can pass a specific enum when arguments are incorrect or the expected result cannot be foun... |
I am reading about OOD and came across Parking lot design problem.Parking lot has parking floors which has parking spots.The parking spot class looks as follow:
public enum ParkingSpotType {
HANDICAPPED, COMPACT, LARGE, MOTORBIKE, ELECTRIC
}
public abstract class ParkingSpot {
private String number;
private boole... |
I have a mobile app (iOS and android compatible) that needs to know if it's far or close to the user's laptop/ desktop (e.g. whether it's within 5 meters or not). I need to make it secure such that only the user's phone can connect to that laptop/ desktop, but other than that there's no other requirements.
Does anyone ... |
For my situation I have a device receiving string commands such as turn_on, pump, etc. Some of these commands also have arguments attached to them such as an int.
I have methods like this
void turn_on()
and some with parameters.
void pump(int milliseconds)
I'm trying to find an approach that allows something like thi... |
I am new to software testing and would like to know whether it's appropriate to draw a data flow graph that flows from initiation of variables to constructor and method.
Is there something wrong with this data flow graph?
class car {
string brand; // 1
int age; // 2
car(string brandName, int year)
{
bran... |
I'm working on my first ever software project. Being the only one working on it, I'm making the work breakdown structure and I know requirement gathering is an important phase in the development process. What I can't wrap my head around is how exactly is a software requirement different from a feature that the system n... |
Is an OS compiled every time it boots, or is it compiled once and the result used every time the OS is (re)booted?
When users change settings, is the compiled kernel modified at all?
If I am the one writing the OS, would I compile it and then users install it without need for compilation?
|
Lets say I wanted to autogenerate questions for a wikipedia page as a sort of comprehension exercise, how would i best go about that.
Using machine learning would be necessary but any other things i need to look into?
|
what i know is , in cpython when we run a code then its first compiled into byte code and the cpython interpreter( which is written in c interprets it) interprets the byte code and converts it into machine code. Does that mean the byte code is represented as c code by the interpreter and then its carried out as c code ... |
My boss say we should find a way to scale code reviews at our company. As it is right now, we have about 16 software developers spread across 4 different teams/squads, but soon the company will close a deal which will double the company size. With that, eventually we'll have dozens of developers. He recommend me checki... |
I'm a beginner at collaborative development, I started learning about merge conflicts.
And I have this question.
Is it possible for a developer to deliberately postpone merging because he doesn't want to be the one resolving a potential conflict?
If this isn’t the solution, what are the strategies that work?
|
I have a service which provides an endpoint that fetches from another service, saves, and returns an record.
Here are the details:
The caller calls the endpoint using an identifier (say a customer's student ID number)
The service checks DB for that student ID. If no record that has not expired is found, the server cal... |
I have developed a custom-made Python package, which provides 2 classes to play with: Stage and Step. They operate based on a Chain of Responsibility design pattern, and behave in a way where:
Both Stage and Step possess handle(request) method
Stage has a list of Stages or Steps underneath it
Step is the endpoint, whi... |
I'm trying to implement a safety feature that puts a timeout around a huge function call. Pretty simple, I thought, but it turned out much harder than expected; there's no built-ins for this in any of the C languages I've looked at, apparently because it's too complex under the hood. But JS engines do this all the time... |
I need a solution for decision making chain. There are number of criteria that may return true, false or be inconclusive. A non-functional code (Java) would look like this:
Boolean res = nullValuesCheck(fieldValue, node);
if (res != null) {
return res;
}
res = typeCheck(node);
if (res != null) {
return res;
}
r... |
Am new to unit testing, and I have been struggling with the right approach to test private functions. I have done my research, and am going with testing through the public interface.
My problem is the following, if I have a private function used by two public functions, I encounter test case duplicates, which I don't k... |
While investigating Wikipedia article on Qantas Flight 72 I've found "Potential trigger types" section that says (emphasis mine):
A number of potential trigger types were investigated, including software bugs, software corruption, hardware faults, electromagnetic interference and the secondary high-energy particles ge... |
I am building a three-tier architecture application that receives compressed (zlib) text records from a data store, decompresses the records into structs, and then serves the records to clients over the network, which run SQL-style queries on the records.
The issue I'm running into is I need this application to be able... |
I have a Kubernetes instance from DigitalOcean that has 2 worker nodes and 1 load balancer. Now I want to create a MySQL managed database cluster for the app that will run on that Kubernetes.
Question is: Does DigitalOcean offer enough resources for a scalable database cluster?
The plan that I'm looking at starts at $6... |
Our team is currently building out an application built with microservices. This application will handle many tenants (organizations) with a database per tenant design. Authentication is handled by Auth0. A user logins in on an SPA and all requests are sent into an API gateway where the JWT is authenticated.
Based on m... |
I have different services in a spring application that have a dependency on Jackson ObjectMapper, the unit tests rely on @InjectMocks to inject all the various dependencies to the class that is under test (including ObjectMapper).
Is this an acceptable behavior? Is there any accepted best practice about it? Should I co... |
I’m still really new to learning to program. Just learning the syntax for a few programming languages at the moment.
The courses I viewed for C# and Java touched only very briefly on getters & setters and it still didn’t make an awful lot of sense to me. So I researched them further and found that the whole subject of ... |
We are writing application service tests across our Data Service Class.
Currently writing tests liking add Product, remove Product, check for inventory after sale, etc.
They are all using the same data storage in a list, BeforeEach Method.
When they are all utilizing the same data set, I'm afraid changing one piece of ... |
I'm building a walled-garden e-commerce system where many users will add funds to the system. They can then spend these funds with merchants, who can then cash them out from their virtual account to real money in their bank account.
Due to implementaion details with our payment provider, every time a user pays in they ... |
I often use function closures for storing data (e.g. database URL), which doesn't change between function calls. Is this an (anti-)pattern? Does it have a name?
While developing apps, which recieve data, process and send data (using a variety of protocolls), I stumpled upon this recurring problem:
A functions needs 4 ... |
I have a class that is responsible for writing formatted binary objects to a file on a network drive with a 100Mbps bandwidth.
Each time an object is created (via lets call it w.addObj()) it formats it in its binary representation and written to file. This operation may take place millions of times, and calling write()... |
I need advice what is best approach to connect data between master and child table.
I have console application written in C# which scrape data from web, process data and insert them in table.
Master table with fields Id, OrdinalNumber, StringDate and child table with fields Id, OrdinalNumber, StringDate, Name, Amount, ... |
I feel this is a bad question because I probably do not understand what I am talking about. In my effort to learn about functional programming, I became stumped on understanding the idea of immutable stuff. I have been using C# as a hobby for years and I think I do not even understand OOP principles very well.
I use a ... |
We have a use case wherein we want to store incoming data and invalidate all the previously existing data pertaining to one parent entity.
ie Parent p1 --> has List< child> old_data ( already stored in the table )
now some new data comes in List new_data
PS the table only has one index is the foreign key p1.ID
EXAMPLE
... |
I'm comfortable with a lot of OpenID Connect and OAuth2 concepts in the context of HTTP-based communication between microservices. I'm currently leveraging Azure AD.
In the HTTP-based scenario I would typically use the on-behalf-of flow for communication between microservices where I need to maintain the user identity ... |
I'm making an online food ordering platform similar to something like Uber Eats. I have the menu items stored in the database which are then sent to the front end where I use a templating language to build the menu and create the initial modals (which are all hidden obviously).
Once you click an item on the menu the re... |
Imagine there is a number of filter functions that all perform filtering of items in a list based on different criteria. Say there are 5 such filter functions. All unit tested
Now imagine there is another function that takes a list of items, 5 arguments (not necessarily homogeneous), based on these arguments it decides... |
In our code base, we have several static or instance members that we would like to initialize lazily.
If the initialization cannot yield null, It's easy to implement.
Otherwise, one could use an additional boolean field that indicates whether the field is initialized, but that becomes noisy for many lazy initialized fi... |
I have a junction table, say for People and Locations
PersonLocations
PersonId | LocationId
---------------------
1 3
2 5
Now, Locations can belong to each other i.e. one location can sit inside another, which can sit inside another etc., so I have this defined by the Location table referenci... |
In UIKit framework, there are methods associated with app’s life cycle events like applicationWillEnterForeground(_:) which are called at appropriate times.
How can I make a process receive such events from an operating system? If the operating system has to be programmed to be able to notify the processes of system ev... |
My application publishes various messages (e.g., telemetry, changed-events, ...) to a RabbitMQ message-broker. The users have no access to the source-code and therefore, will need a separate documentation with all available exchanges, messages and their JSON payload.
How can i create/generate a documentation with this ... |
I need to generate videos that are several hours long from CSV files. I have a working solution, but it's unusably slow and am looking for alternative ideas.
What I'm currently doing:
using an image library to generate individual frames
use ffmpeg to concatenate all the frames into a video
Ffmpeg is surprisingly the... |
In OAuth / OpenID Connect, does the redirect url matter for server to server API calls?
I'm currently setting up Azure AD to secure our API's. The first implementation will likely only be server to server calls. All of the documentation shows that a redirect url is required. What is the purpose of this url in my sce... |
I'm currently writing some code to interact with an API that doesn't have any official libraries. The provider has given me two sets of credentials - one for testing and one for production.
I'm wondering what the best practice is for choosing which set of credentials to use.
Should I assume Testing (or Production) by d... |
I have json like below in our legacy system. In general, my json is very large. To make things simpler and easier to understand I have reduced the entries.
{
"clientSettings": [{
"clientId": 12345,
"key": "abc",
"value": false
},
{
"clientId": 12345,
... |
This is something that is puzzling me a bit.
I am seeing some people who like to implement DB-related integration tests (in the case of BLOBAs) to test the insertion with a Legacy DB in a CI pipeline, which I think bring very little value (while they require a fair amount of time for implementation) and bring a fair am... |
I have been working on a project that is being built around a microservices architecture. We are thinking on using a message broker, such as RabbitMQ, for both synchronous (via RPC) and asynchronous communication between services.
The team is constituted of Java developers, and all of the services are Spring Boot.
Supp... |
A bit of background:
I've been using Webpack with babel-loader for a while and overall the experience has been hugely positive.
Yesterday, I published an npm package of my own (to a private registry), and installed it into my "main" project that uses Webpack.
What I was surprised to find was that when I built the main ... |
In our database, we have around 150 different tables. However, there are a handful of them that are key, as in they get referenced pretty much everywhere. We also have quite a few reports that we pull across a lot of these tables and for a few of the items, we perform some calculations. We thought it best to just creat... |
I'm working on a big project with easily defined boundaries and domains.
The project includes:
Portal (news, articles, encyclopedia, users)
Forum (threads, posts, users)
Chat (messages, users)
Essentially, if I used the macroservice architecture - I would create 3 cross-communicating services (as listed above) and ju... |
I would like to create an e-commerce website that integrate other e-commerce. I can retrieve their products using APIs or feeds. The problem is that all these information are different from shop to shop and I need something to uniform and show them in my e-store. I've tried to build a Woocommerce plugin but it lacks in... |
I have a data model that is similar to the bank transactions. Simplified version looks like this:
01.01 +1000
01.02 -300
So I will have all the transactions stored in the database. Users will of course would like to know the balance rather than history of the transactions (700 in my example).
From what I can see ther... |
I am working on a UML diagram for social media website like Facebook:
The main class of this system is User, which has members as userid, email, phone, address, Friends, etc.
A user may follow a set of users. So several users may follow a given user, and a given user may follow several other users.
Does it make sense... |
The question is straight forward :
Personally identifiable information ( PII ) of an individual ( regardless of the persons citizenship) has to be on the countries server where an account is created due to compliance reason.
E.g: Your account information present on facebook, linkedin, paypal, global banks or Expedia ha... |
I am having trouble presenting my tableview cells containing a Collectionview correctly. I want to display a different animal in each section based on the firebase data. My problem is about every 4 cells the first 4 cells repeat(See images below). I have separate models for each animal and I am configuring each cell wi... |
In the new era of web components MDN (and probably the standard) suggests extending the HTMLElement class.
For a long time we've strayed away from doing that, what has changed now for this to become the suggested standard?
Is it a particularly good idea in the long-term, what happens if in the future the standard gets ... |
When compiling C programs to assembly programs and then to machine programs, does the assembler (e.g. the one used in GCC or other popular C compilers) perform the same tasks as the translator from C to assembly, i.e.
parsing
code generation
optimization?
How much is the amount of optimization done by the assembler c... |
If there is Class A and Class B and there is an association that B can be assigned to A.And the multiplicity is 1:M or M:1 from A to B.Example:
1.Room has Collection of Keys, and Key can can assigned to Room.
2.Match has a Referee, and Referee can be assigned to Collection of Matches.
I want to know, what would be corr... |
I have asked about the more nebulous 'system' and functions in general, but to explain my question let me just consider a pure function.
I think of pure functions as lemma/theorems/what have you. Given a function f and some conditions (inputs with some constraints), f applied to the conditions has some properties (e.g.... |
When using a git strategy similar to gitflow, can feature flags totally replace the Hotfix Release branch process?
When seeing bugs in production, we first make the change in the develop branch and test it. Then, we also merge fixes into the release branch or create a hotfix branch. Merges and cherrypicking are prone t... |
From Computer Systems: a Programmer's Perspective, about assembly languages:
We see that the Intel and ATT formats differ in the following ways:
The Intel code omits the size designation suffixes. We see instruction push and mov instead of pushq and movq.
The Intel code omits the ‘%’ character in front of register nam... |
i wonder what is the correct solution to ensuring consistency of a shared aggregate?
Problem statement
I try to model the registration at an event with reserved (and limited) seats (like shopping cart) that expires after n minutes when not confirmed by the applicant (like checkout). If all seats are gone, the user is a... |
I'm designing a monolith RESTful API that potentially sometime in the future may turn into microservices. I'm also trying following Uncle Bob's clean code as well. My question lies in structuring the Go code. Many times I see the following file structure for example:
|-- users
| --/ driver
| --/ entity
| --/ usescas... |
In Computer Systems: a Programmer's Perspective:
procedure calls may involve
passing data as arguments, and returning from a procedure may also
involve returning a value. With x86-64, most of these data passing to
and from procedures take place via registers. For example, we have
already seen numerous examples of func... |
I would like to have a relatively small and simple tree in C++. Each node would contain an integer. The tree should be traversable both ways.
I know it can be done with tree.hh by Kasper Peeters, but I am going to use BGL for other purposes as well. I've been learning BGL for some time, but don't have a firm grasp on t... |
Suppose we have two branches A and B which have been forked from master.
Both branches A and B make some changes and implement some unit tests. They pass all current and new tests, then are merged back into master. For simplicity, there are no merge conflicts.
Is it guaranteed that the resulting code on master will als... |
Given a repository which contains two different applications A and B (e.g. bootloader and RTOS), is it ok to copy source code from A to B in order to avoid dependencies (include's, adding A source files to the B compilation) between them, so they stay completely independent both at build-time and runtime?
Note: In addi... |
i have a case where user can filter and download multiple pdf documents merged into single file.
The client should display an error message when no document's meets the filter, and ask for confirmation when there are many documents because it might take a while to process them (let's say the confirmation should trigger... |
This is very closely linked to the question Legitimate "real work" in a constructor? but not quite the same.
I am interested in having feedback on whether this is acceptable or has any risks.
in C#, I instantiate a class:
var f = new Foo(DoSlowComplexTask());
it seems the same as doing:
var x = DoSlowComplexTask();
va... |
I have n sets that each contain some elements, for example:
{2, 3}, {6, 3}, {2, 7, 3}, {7}
Now the goal is to find the minimum number of elements that occur in all sets. For this example it would be 2 ({3, 7}). Some more examples:
{2}, {4} - minimum is 2 ({2, 4})
{4, 15, 3}, {3, 2}, {24, 4, 2}, {24}, {15, 6} - minimum ... |
I have two camera devices that are able to find a specific hardware illuminated point in an image, as well as measuring the physical distance to the surface (and some more stuff I chose to leave out, as it doesn't affect this problem right now), and the application uses the point and distance information independently ... |
If I am correct, an assembly language uses the program stack to store data.
Is it correct that the program stack is partitioned to frames, each of which is for a call to a procedure? So there is no part of the program stack, which is not associated with a procedure?
If an assembly program doesn't call any procedure, ... |
The problem I have relates to an existing system in a specific business domain. I've simplified it into a very similar 'Library/Book' relationship to articulate the problem. Answers such as 'why would you do it that way' are not helpful, as this is very similar to what I have, and need to solve for. Help that reflects ... |
Can one design an extension to any product without contacting the product developer?
For example, Does Grammarly have any contracts with Microsoft for Microsoft Word?
Here I like to create an userscript for a website and like to commercialize.
|
I am looking into the revamping my organization's application by moving from a monolithic into a microservice-architecture. My database is a multi-schema shared in one database. Each of these schemas is currently being distinguished by a different username, while the rest of the settings (url, password, dialect, etc..)... |
I'm learning to implement RESTful APIs, and the concepts of Controller and Router are common in many frameworks, along with the MVC pattern in general, so I'm encountering them everywhere.
From this question and googling around I understand that they are not the same thing, as they are responsible of very specific, and... |
Let's say we are in a company that sells coffe mugs, providing a Domain-Driven Design approach for their architecture needs.
According to common DDD practices (i.e. in literature by Vaughn Vernon and Eric Evans, nicely summarized in this Medium article), a good starting point is to identify Core Domains, Generic Domain... |
Is there a good way to search for duplicate subgraphs in an immutable directed graph, where edges and nodes may be labeled?
I was thinking I could try to name the nodes according to their position in the graph, but that isn't trivial when you have loops.
Comparing the two subgraphs arising from two different nodes shou... |
I do not know how to properly formulate this question, but I am trying to find the best algorithm to get the nearest integer number where every set of numbers (including decimals) give an integer number when doing multiplication. Example:
Assuming:
X = 232
Y = [2, 5, 1, 0.1, 0.0625]
The final number will depend on bot... |
Im starting to develop a visually-simple but infrastructural-ly robust real time multiplayer game to show off my backend skills and hopefully get a job at Blizzard or something like that.
The game is simple: a multiplayer snake game.
I'm aiming to have a game session supporting up to 8 players, all connecting to a sing... |
In COM programming, each COM object exposes a queryInterface method. You provide it a type that you want to "cast" the COM object as, and if it supports it it'll return you a reference to its implementation of the requested type.
It's sort of like a service registry, but there's a pseudo-semantic that all the interface... |
We are given a task to create an Web Service API for a mobile application. The problem is we have to use a legacy database that is not normalized and its very tedious to work with. We are accustomed of using Object-relational Mapping for implementing the Repository layer including the database so that its easier and ef... |
The ISP says that the client should not depend on things what are not needed. As a solution small focusing interfaces (contracts) can be used:
interface RegisterUser {
User register(String username);
}
class UserService implements RegisterUser,LockUser,FindUser,... {
...
}
class UserRegistrationClient {
private... |
As I boot up Eclipse for C++ with the "Darkest Dark Theme with DevStyle" installed, it spits out quotes--one per day. Yesterday's was:
A bug in the code is worth two in the documentation.
Talk about ambiguous! What does that mean?
A Google search for it (and this one too) shows it is a rather popular quote.
Possible ... |
I am looking how agile methods can be applied for setting up a chained-application (made of several services for example) developed by several teams. In particular, I think the common sources about release-cycle and environment layers (DEV, UAT, PROD) are missing a step where all applications should start to connect wi... |
There is a parent window that is the basis of the program, and there are several sub windows under it. Editor is one of the sub window and I'm making it. The code is as follows:
// This is Code-Behind
public partial class MyEditor : Window
{
private static readonly Lazy<MyEditor> lazy = new Lazy<MyEditor>(() => new... |
Inside my business logic, I have something like a pipeline with multiple actions. Each action wrapped into try/catch and can handle exceptions by himself (logging, saving state for retry ex). And I have global exception handlers who also log all exceptions, can retry the operation and returns details to a client if it ... |
There are many discussions related to whether it is better to have only one or multiple exit points per function, but it is not clear to me which statements can be considered as exit points: only return or some other ones as well?
For example, should we consider throw and break as exit points?
Are there 2 or 3 exit poi... |
Suppose there's a root <App /> which houses multiple components, one of them being, say <SearchBox />.
App component houses the app state (such as searchResults array) and iterates the results underneath the <SearchBox onResults={this.onResults}/> as <SearchResult url={url} title={title}/>
Inside the SearchBox componen... |
My situation is that i am trying to model an inventory system in a game, In the game there are items that can be placed and retrieved from the players inventory. For example; player inserts a sword item into the inventory, players takes an armor item from the inventory.
I understand that type casting can be used howeve... |
Let's say, we're using an OAuth / OpenID Connect (OIDC) flow (in a Zero-Trust situation) to secure two APIs: ServiceA and ServiceB. To implement some of the functionality of ServiceA, it depends on Service B. ServiceA is calling ServiceB on behalve of the end user.
How would we deal with tokens in this situation:
The ... |
I'm doing scientific computations using Python.
So far I have a module core and a class Simulation inside. There are many instances of Simulation at the runtime but all of them must share the same "problem setup". So far this problem setup is represented by global variables and functions in the module core with sophist... |
We are building a microservice architecture.
We have one service which imports a set of data (usually, ca. 10MB). Another service should do some analysing and manipulation stuff on these data. A third one should persist the manipulated data into a certain storage.
Unfortunately we don't know what is best practice to se... |
I'm developing a multi-database application. There is one admin database and many customer databases which are identical in structure.
I also have a generic RepositoryBase which looks like the following:
public abstract class RepositoryBase<T> where T : IEntityModel
{
public IDbConnection DbConnection { get; set; }... |
I am wondering how I would validate some actions in my domain when a parameter of an action needs to be validated, but that parameter's entity is actually in a different domain so I can't retrieve it.
Let's say I have the following situation:
// "Document" Domain
public class Document
{
Guid Uuid {get;set;}
Gui... |
I am developing a project using C++/CLI and WinForms. It is a geometry project, which is why I have to use C++/CLI, because of the C++ geometry library CGAL. I chose to use WinForms for the UI because compared to the other C++/CLI windows UI options it seemed rather easy to use. However, after some research online I re... |
I have Document and ExternalDocument classes in my system, where ExternalDocument extends Document. The main distinction is that ExternalDocument holds onto externalDocumentId and externalEventId data in order to correlate with the external system.
Documents may be overwrote calling document.overwrite(a, b, c). When ov... |
What to do when your client keeps jacking with the system you developed for them
I've had a client in the real estate training business for six years now. We have an ongoing weekly minimum time arrangement. It's nice knowing there is always X coming in. Over the last several years I have developed a very large LAMP bas... |
Currently when working in a scrum team in a software service company, who has a clean business domain. I am working on adding new features to an existing module. As the existing module is legacy, and new features need to be integrated to the system all the times, I sometimes feel the need to refactor on the legacy code... |
I've encountered the infomral definition of foldr in a couple of books.
I've attached an image from Bird and Wadler's "Introduction to Functional Programming" (1988), but I've seen the same informal definition in Hutton's "Programming in Haskell" (2nd ed).
In the image attached I'm referring to the 1st and 3rd lines, a... |
I read everything and its opposite about how to organize its code. Of course, I try to follow the SOLID principles, but since I consider myself quite a beginner, I would need some outside advice on how to put them into practice.
This concerns the general architecture of the site which I detail the layers below :
Contr... |
I have been tasked with creating a unified UI for my current company for our Blazor Apps. We have 15 or so apps and we need to add more.
Our current requirements are:
UI appears the same
The Menu must be dynamically generated from a DB
With these requirements I can't just create a component library with a Layout Comp... |
How much should I factor in potential future developer error when writing code? This works better with a few examples:
switch(something)
case 1: return good;
case 2: return fine;
case 3: return okay;
default:
thrown new Exception("Should never happen, you probably forgot to add your new case)
Or we have... |
As far as I know, throw-away prototyping involves creation of prototypes in iterations where each prototype is discarded after one iteration. For incremental prototyping, the resources I referred to don’t state a dissimilar explanation... What exactly is the difference between the two?
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.