instruction stringlengths 34 36.1k |
|---|
I'm working on a PHP web application that depends on a few 3rd-party services. These services are well documented and provided by fairly large organisations.
I feel paranoid when working with responses from these API, which leads me to write validation code that validates that the responses match the structure and dat... |
...to prevent messing up with data updates, such as prices, titles, of the products that are placed in an order.
Namely, a customer buys 3 items: for $5, $10 and $33 and pays for them. All is well. When I as an owner of a shop step in and, before I've delivered those products to a customer, decide to descrease the pric... |
I am writing a paper trading system, and what I have works, but I can't help but feel that there's a better way to partially close a stock position; what I currently have seems a little overboard.
Partially Close Scenario: Customer A buys 100 shares of stock X at $1 then, later the customer sells 80 shares at $2; leav... |
I wrote a small video library app. It renders private Vimeo videos for paid subscribers.
The owners of the app would like to reward users who watch videos. My first implementation was to trigger a watched mutation at 80% of the video playback (this was not ideal but clients demand features). Users have figured this out... |
Oftentimes, "dirty" is used to represent unsaved code, memory, or files. For example, a file can be "dirty", meaning it's unsaved, memory can be "dirty", meaning it's been modified but hasn't been written to RAM, and Git reports its working tree as "clean" when there are no uncommitted changes.
I understand why you wou... |
We will finish a sprint with stories tested and "Done" and thereby closed in Jira. They often sit in a branch somewhere until someone remembers we have code waiting to be pushed live. Or worse, we go to push something live and someone will pipe up with "oh that also includes xyz change...", or even worse we push one ch... |
I am working on a system where I am planning to send a large amount of data in a message to an event queue. About 150 or so small objects. I know the technology should be able to handle this, but is it good practice?
|
How should I set up my project when I want to run the present version of a class against previous versions? I'm interested in issues related to code organization, file naming, and source control.
I have a stable version A of my code, and am working on some accuracy improvements for version B. (It's a forecasting model ... |
Is there a standard on db alter scripts (both data and ddl), should they be re-runnable if so what are the reasons for making them re-runnable.
The only web pages I could find are telling me how to do it, but i want to know why to do it?
|
I have a library (npm package, LIB) which is used by the application code (APP). In a release of APP, multiple features are worked on parallely. Sometimes these features need support from LIB, so the changes need to happen there too and LIB used semvar.
When multiple features like F1 and F2 are being worked on in APP, ... |
I am writing a client facing library and wanted to check if the below approach sounds reasonable? This library is a service that consumes HTML and creates a greeting card.
I feel writing Services and ServicesImpl may not be necessary and I only need ServicesImpl because the content in Services and ServiceImpl will be c... |
I have a block of code that branches into 2 pathways, let's call them the "simple" and "complex" branch, based on user input.
Either the simple or complex logic has 4 steps, let's call them A, B, C and D. A, B and C each have 2 different variations depending on whether we're in the simple or complex branch.
In the comp... |
I've got a project with an HTTP API which returns data from a database. The layers it goes through to get to the API look like this:
DB -> Repository -> Controller
I'm looking to restrict the results which are returned based on the permissions of the requester. Should this be included in the repository layer, or the co... |
I am trying to plant a garden. Certain plants are good for some plants and bad for others, and I am trying to find the best order of plants: most adjacent friends and no adjacent foes, as defined in this table:
Num Vegetable Friends Foes
1 Watermelon 7,4,3 8,6
2 Tomatoes 9,8,6,5,1 7
3 Su... |
We are struggling in deciding scope of end-to-end tests. As per our understanding, we have automated the form exactly the way users interact with it. below are the steps user perform while submitting the form.
Step 1. User fills the form
Step 2. If all the validation passes. We submit the form using an API.
Step 3. We ... |
So I'm currently playing around with web development as a project, and I've been looking at React recently. My current issue is that I'm having trouble distinguishing between front and back end seperation.
From my understanding, the front end is the UI that the client interacts with, and the back end is the server itse... |
i have a problem in my scalable Pub/Sub application that it can not take more than 30 RPS when big amount of sessions are open against it.
first i will explain the application structure.
the application is a spring-boot embedded tomcat with 200 tomcat threads.
it is like i said a Pub/Sub application with multiple inst... |
I've looked through similar questions and tried to Google what I'm trying to do, but I haven't found anything concrete.
What I'm trying to do: where I work, we use an HMI/SCADA system that displays tags, machine states, and other standard SCADA functions. Recently, I figured out how to send HTTP requests from the SCAD... |
so my project is that I'd like to pull data from a bunch of different services/API's and show them in a single dashboard. SSO is a requirement so I want to make sure the user doesn't have to put in their password over and over.
The system already has SAML2.0 set up with ADFS which is configured as the identity provider... |
In my opinion it should not since it violates single responsibility principle, but I am finding myself often calling both.
Edit: here are the 'boring' details:
As you all know, we cannot escape the existence of an Util class. It simply exists. I have a static class Util that has some helper methods, and there dwells ... |
My web app is built around classes that I call widgets. Their goal is to be reusable and modular, to suit different scenarios. For example, I have a widget called BreadcrumbWidget which has two functions:
addHome(): adds the "Home" breadcrumb.
addBreadcrumb($title, $url = null): adds any number of breadcrumbs.
I ha... |
I have been doing problems on LeetCode recently, and keep getting stuck on some graph or tree problems. I understand the underlying concepts of Graphs, Trees, and different methods of traversal just fine. For example, I can code a tree from scratch by creating a class for the Node and then passing the root to a functio... |
I am building an app where you can invite your friends to join the platform and discuss various topics. (almost Reddit).
Functionality: When you create a topic you can enter the email of users you want to add. If some of the users are not registered with the platform, we send them an email, asking to get onboarded and... |
We have some entities in our code:
-"View" and View has some attributes and also contains one or many "SubViews"
-And each "SubView" has some attributes and contains one or more "Tweet" entities.
So far so good. User edits Views/SubViews/Tweet (adding/removing tweets from subviews, adding/removing subviews fro views et... |
The first alternative can result in lines that are too long, and so reduced readability in some web browsing.
The second one can result in a better web readability, but might annoy command line debugger users.
Example:
blah_bleh_blih_bloh = something(arg_a, arg_b, arg_c, arg_d, arg_e);
blah_bleh_blih_bloh =
so... |
I'm currently designing an IoT device that connects to a home network and an app to communicate over said network. I'm trying to find a way to reliably connect to the IoT device/ make the IoT device easily discoverable. I've had a few ideas on how I could do this:
Local DNS. - however, not all routers support this so ... |
Recently I was asked to refactor some code that leverages JavaScript's array.reduce() method because other developers felt the code hard to read. While doing this I decided to play around with some JavaScript array iteration performance benchmarks, to help me validate various approaches. I wanted to know what the faste... |
Assume I have the following two functions:
function storeObject(object) {
// Connect to database
// Prepare query
// Execute query
}
function retrieveObjectWith(id) {
// Connect to database
// Prepare query
// Execute query
// Parse results
return object;
}
And that I want to write te... |
Is it mandatory to implement a REST API even if it doesn't make sense?
I have created an app consuming REST services from other apps. Now that I have the final result, I wonder if it is needed to implement my own REST API, because as I try to implement it seems that the API has the same funcionality as the APIs I'm usi... |
I'm pretty new with C so I have encountered many doubts with pointers.
I've already search a lot about this but there are some things that still are not clear for me, and I also think this will help other beginners:
I'm currently working with something like a binary search tree, more specifically a dictionary.
In both... |
I am planning to do the university project with the Desktop application + web application + mobile application, I have planned to use languages for these 3 as below:
Desktop application: Java SE
Web application: PHP
Mobile application: flutter with Dart
Database: Mysql
Now I have a problem with how to connect these 3... |
Given I have a message bus that can handle commands and events. A command handler can dispatch an event. But should an event handler be able to dispatch another command? Or should event handlers only be able to dispatch further events?
Example:
PostReceivedEventHandler subscribes to PostReceivedEvent, invokes Validate... |
In a couple of my programs, the program needs to know an IP address and a port to which it should connect or send data to.
The solution I have right is to ask for user input via the console - but this just doesn't look like a good solution to me for passing the parameters to the program in the long term. In a later st... |
As I'm spending more time working with SQL, I'm starting to feel like this language promotes logic obfuscation. Here are some examples:
An INNER JOIN in a query can act as an implicit filter that reduces the result set into a subset. However, to understand what is being filtered, you needs to have knowledge of the tabl... |
I am playing with my simple personal project - a simple REST API application and I am currently struggling with a kind of design problem.
The problem:
How to insert an operation ID (request ID, an identifier of each operation) into each "layer"?
Context:
Let's say I have a UserRepository trait (interface) with 2 imple... |
The project I am working on is a SaaS application with multiple payment tiers. Each one has multiple limits for different actions. One example would be that a free user can only create 1 space, a premium user can create 5 spaces, and a pro user can create unlimited spaces.
I am thinking about a system that has the foll... |
We will be streaming data from Phones (<= 5000) to a server. We were previously sending the data using MQTT to AWS IOT. Now we want to run this locally. Estimated size per second to be ingested is 5000 phone * 500 bytes = 2.5 MB to 5 MB. 5 mBps = 5*8 mbps i.e. we are looking at something like 20 to 40 mbps. This is not... |
We have an SSO application that provides authentication for a native mobile application, as well as for a web application. There are some features that the web application has that the mobile application does not, such as account management. We would like to keep the user logged in (without having to sign in again) w... |
In general terms, what's the added value in using the techniques described in the iconic book "Modern C++ Design"? Is it simply the ability to write reusable code that's easily extensible? Or are there particular classes of applications where development can be greatly facilitated through the use of such techniques?
|
In SAP ERP (probably in other SAP systems as well), you have transport orders which you could see as "commits" i guess in git. These transports are send from development to test or production system and then "activated", which means compiled in their terms.
With git you normally solve this with different branches or ta... |
Say we have a boolean variable indicating whether an input array is 2D or 3D (just an example). Is it acceptable to name it is_2d_or_3d instead of is_2d, to make it clearer that if false, it indicates the input is 3D?
I've personally been doing this for quite some time. I don't remember if I picked it up from some guid... |
I have some external SDK library that makes IO calls (either networking or database) in the form of blocks, like so:
SomeClass.doWork(success: {}, failure: {})
Now I need to chain about 60 different calls because we are working on data replication where each operation is distinct enough that it's not the same, but the... |
I'm trying to understand what microservices are and MINIX's microkernel architecture seems to be a good analog. (I'm a systems engineer.) In my understanding:
Microservices are like user space drivers
That applications don't ask the kernel to do all the work. Instead they send requests to various services (drivers) t... |
I'm currently evaluating Event Sourcing and CQRS for an implementation of a new business requirement at my day job. While I can't really speak about the actual business problem, I can give a few reasons for why we think that Event Sourcing might be a good fit:
great auditing capabilities based on the history of events... |
My question is related to designing new software. Let's say I work in a medium-sized company that has a core product. Now we want to start with new software (purpose of the application is different than the core product) with a completely different approach. There is a document with the main features from business poin... |
I am working on a WebAPI application which follows the layered approach like Controller > Service Layer > Repository Layer > Entity Framework Core (SQL / Cosmos) The view is in Angular.
In many of our API, we have some transformation required on the Request object (DTO - request send by UX) to a domain entity that my r... |
How to tell if we have unused require expressions?
For example:
require 'colorize'
require_relative './helpers'
puts 'Hello, world!'
This is a very simple example but there can be larger/complex cases when after some refactoring we forget to remove the requires, is there an easy way to identify those unused requires... |
I'm trying to find the correct flow to manage this kind of development, where A and B are two independent features, and C is a third feature that relies on A and B.
An obvious approach would be to develop the three features in a sequential way, such as:
----A----B----C
But I want to be able to push A and B for review... |
I am looking for a way to automate deployment of configmaps to our dev/qa/prod environments. Right now our applications rely on kubernetes configmap/secrets that we manually apply in the cluster using
kubectl apply -f {name-of-configmap}.yaml
This is fine and all but before I send my code to our dev environment for in... |
Solution as it is right now
I have this solution where I gather information from a proprietary product of a different company in various sites. The solution is based on a single go binary that contains everything needed to run the application (even an embedded sqlite) and is deployed to Windows computers running the pr... |
I'm working on a project that is a API with many controllers and modules. Which of the following is the best architectural practice to organizing my API controllers by dll (.NET 4.7 WebAPI)? Why?
OBS: Each item is inside a module is a dll
One dll for each controller. Each csproj contains only one Controller.cs file:... |
I found this also happened in my team although he may have exaggerated the situation a little bit.
Scrum is a way to take a below average or poor developer and turn them
into an average developer. It's also great at taking great developers
and turning them into average developers.
Everyone just wants to take something... |
I realize this is a subjective question, but after studying F# and functional programming I've seen the benefits of immutability.
Now, I'm thinking of getting rid of mutability entirely in C# unless specifically required. In essence, where before I might have written a function with a signature like -
public static int... |
Java collection streams were introduced in Java 8, which came out in March of 2014.
By that time, we already had well-established mechanisms for manipulating collections in several other languages, at least two that I can speak of:
In C#, Linq provides extension methods such as Select(), Where(), etc. including collec... |
I have a collection /users/{userId}/tools
and I want to GET and POST to that collection. Can I have different representation of that object based on the method?
For example, for POST I want to send only
{"name": "Toolname", "material": "MaterialName"}
so I built a DTO with only that 2 fields.
And forGET I want to retr... |
Assume that there is a library and it provides an interface to its users in order to callback them. Users implement this interface and receive notifications from the library.
Let's say, ICallback is the interface, and Notify1(arg1), ..., Notify5(arg5) are the interface methods.
interface ICallback;
+ Notify1(arg1)
+ ..... |
Is it doable, desirable to organize project classes, dependencies in Tree/DAG structure?
To be more specific. In applications (not libraries) we have always some entry point, am I right? Some main class. Here we keep some core dependencies, which have other dependencies and so on. We treat it as root of dependency tree... |
The following is an example requesting an explanation for one specific file in one specific filesystem, not helper classes generally.
I have configured a LEPP stack on a CentOS server. The server hosts an API which is built using Slim PHP Framework. There is an official skeleton repo on Slim's github.
The repo has a ba... |
In the Model-View-Controller pattern, I do understand the role of each component.
The Model represents our application's domain model. The View presents this information and the controller manipulates business logic.
I do not understand from any diagram that I saw, who knows about whom. Does the View know about the Con... |
Let us say that for a web application, inside the source code of the app you created a function called calculateAmount. Inside the
web app, you need to call that function.
But for some reason, due to the need for 'automation', you want the
app itself to 'think for itself', at which stage of the program, which function... |
On multiple occasions, we've deployed frontend code to production only to find out the backend (REST or GraphQL) hasn't shipped their side yet. Worse yet, we unexpectedly find out a param name changed which may throw an error. Another example: the backend removes an API thinking that clients no longer use the removed A... |
I'm developing a social network with Django (Python) + Postgres SQL. My site will have a chat feature so that users can communicate to each other in real-time, and the communication will be only from user-to-user (so there won't be chatrooms with more than two people).
Let's say that in the future my social network has... |
Background
Simplifying, assume I want to write some tool for code-analysis, which tell me which files - class/module - are/have some kind of network interface(s). No matter if it's REST Controller, DB connection, RPC or simple socket.
Restrictions
I want to achive this automatically. What do I mean by that? I don't wan... |
There are different methods for recognizing classes in UP methodology:
noun/verb analysis
using CRC analysis
using RUP stereotypes
other sources
I have read above methods fully detailed in UML 2 and the Unified Process_ Practical Object-Oriented Analysis and Design (2nd Edition)-Addison-Wesley Professional (2005) boo... |
I am at the stage of implementing a my 1st ever view, after developing a Model and Controller, however there is a problem.
I have been reading this article on MVC, which is what I have been aiming for when implementing, but I kind of went off-script when making the Controller because I didn't remember to look back at i... |
I know that Tensorflow use symbolic model-building APIs where the developers can use them to build static computational graphs.
Whereas Pytorch offer imperative programming paradigm where it performs computations as it goes.
Could anyone help me understand the development paradigms of Scikit-Learn, Keras, Caffe and Th... |
I'd like to try to create an application where 2 players can play chess online. The (possibly) novel feature would be that the process for joining a game would be similar to how Typeracer works. The first player creates a lobby then shares a link. The friend can then click the link to join the session immediately.
Howe... |
We have data in Kafka which we need to export to multiple destinations. Each message key is to be exported to one destination.
A destination can be a REST endpoint, a file, a database etc.
Each exporter can have its own speed or rate limits and one exporter should not slow down the other.
In Kafka, the parallelism is d... |
This is something that has been bothering me for quite some time, I tried different approaches over the past year but I always come back to reflect on this, so I'll throw myself out here !
So, first get some common ground: if we follow the blue book, transaction handling should be done in the application service. We op... |
To reiterate the question - what does it mean to have a weaker or stronger postcondition when overriding a method that only does side effects with another one that only does side effects?
P.S. What about a mix of side effects & return values?
|
I'm developing an application where one of the main components of the app heavily relies on a third-party framework to work. The choice of framework is highly volatile and it is likely that business requirements will change in the foreseeable future, meaning that there's a good chance the framework I currently am using... |
We've got 2 very large platforms for our services & jobs.
Both platforms consists of 20+ servers hosting 1000+ services/jobs.
Each job/service is essentially a java web application.
Both platforms are managed centrally, which allows us to get a holistic overview of the platform, as well as drill down capability to each... |
I'm a firmware developer and I'm interested in applying the SOLID practice in low level programming especially in Hardware Abstraction Layers in ARM microcontrollers.
Every example I come across on the internet is implemented in C++ or C# or Java and it seems a little hard to follow those patterns in C.
Is there any ex... |
I am currently working in a team, which, when I joined them did not do any sort of unit or integration testing.
Over the last 2 years I have bit by bit pushed dotnet unit testing to a point where it is now considered part of day to day workflow. Integration testing have also had a place and are coming up once again as ... |
I am new to UML sequence diagrams. I saw a few YouTube videos and a few tutorials such as this one.
I have a system with multiple inputs, that can interact with the system asynchronously. For example, first the input 4 (out of 5), secondly the input 1 (out of 5), etc. How do I represent them in a UML Sequence diagram?
|
My web application has a UI. Some aspects of the UI can be changed (e.g. the language, the theme, the text size). As a concrete example, let's assume that I have a "theme" dropdown box available on every page.
Now, when a user changes the theme, the current page should reload with the new theme, and the new theme shoul... |
This question may sound strange to you, but I am learning C++ all by myself. I have nobody whom I could ask for mentoring and I would be very glad for some advice.
I have started recently to program in C++ (about 3 - 4 intensive months with about 6 - 8 daily hours). My background is Java and I have done some bigger pro... |
I'm trying create a .NET Core project and followed some guides to create a basic architecture
Jason Taylor - Clean Architecture with ASP.NET Core 3.0
Sample project
Clean Architecture Template
I'm not using an ORM like Entity Framework, I want to use raw SQL for my Maria database so I'm using the official MySQL Conne... |
I have a software product I am going to release soon. It is built with Java/Spring/Tomcat and will be installed on the customer's local network.
I plan to sell this to corporate customers and I want them to buy an annual renewing license to run it.
I am imagining something like the customer provides me with their comp... |
Should Developers conduct Sanity Testing in Dev Public Server, before sending code over to QA team?
We are developing a Property Application. Our company utilizes C# .Net Core with Angular, and Devops process in Azure cloud.
After software engineer codes and tests locally; by getting all latest changes from Azure Git... |
Sometimes when I look at other people's code I see functions that make a bunch of assumptions about the inputs but do not explicitly assert their assumptions. For example, look at the code below:
def func(a: list, b: list, c: int):
total = 0
for i in range(len(a)):
total = a[i] + b[i]
return total/c... |
I'm planning to work with different libraries that use different conventions. One uses snake_case, another one uses camelCase. This leads to code that looks like I can't make up my mind:
Some_Result result = namespace1::this_cool_function() + Namespace2::thatOtherCoolFunction();
Is this just a suck it up and deal with... |
I mean the question in the sense of: Should the occurrence of simple loops on collections in code in Java 8 and higher be regarded as code smell (except in justified exceptions)?
When it came to Java 8, I assumed that it would be good to treat everything with Stream API now wherever possible. I thought, especially when... |
I'm migrating my current application to multi-tenant setup.
Now I've multiple rabbitmq workers to process async job, publish and consume integration events, and other stuffs. I'm planning to use vhosts in RMQ (1 vhost per tenant per service).
Right now, I'm still not convinced about what approach to take to implement... |
I am trying to program a little game and for that I need to determine which's players turn. I am solving it firstly with a Nassi-Schneiderman diagram with a variable turn whic can be 1 or 2, but my problem is that I end up with too much branched decision blocks. (In the first round player 1 begins always, the player th... |
Using github as an example, www.github.com is the website people visit and api.github.com is the REST api server programs will visit. But they probably share some codebase and in my case they share a lot.
We actually developed the rest server first for our mobile apps then we decided to develop a website because we had... |
I'm working as a software developer for around 8 years now and have worked with mostly companies offering outsourcing services.The challenge so far was mostly - learn the new tech, showcase through a prototype/POC and implement it in the assigned project. Over the years, technologies changed, but nature of work remaine... |
Write the impact of software architecture on Requirement Analysis
I was given the above question in my assignment. I have studied about Software Architecture and Requirement Analysis but I'm still confused by it.
Does Software Architecture have any impact on Requirement Analysis?
I have gone through my teacher's lect... |
In a refund tech scam, tech scammers use Chrome Developer Tools to edit the HTML directly on the victim's bank webpage through a Remote Desktop (Teamviewer, AnyDesk, etc) to fool their victim into thinking that they received a 'refund'.
I was wondering if we could detect if the innerHTML of the victim's bank balance h... |
I am very new to Data Structures and Algorithms. I want to use recursion + stack/queue in a grocery store inventory program that I am making. However, I can't come up with any good ways of using recursion in a manner that contributes and is relevant to my grocery store inventory system.
I know recursion can be used for... |
I work on a small component in an embedded device (sensor). This component :
Every 5 seconds, sends requests to other components using sockets
(get health check status, operating status etc) and stores the
response in memory.
Creates a socket, listens for incoming requests from UI. And sends the stored stats.
To keep... |
I would like to have the following interface:
Resource {
public:
void copyInto(Resource* src) = 0;
}
But in order to implement this, the implementation would need to know (or make assumptions about) the implementation that it is copying from.
When i instead have a copyFrom method, the problem would just reverse, mean... |
I'm wondering if there's a standardized name for the following refactoring:
class Foo:
def do_something_awesome(self):
my_bar = Bar(42)
return my_bar.reticulate_splines()
Here class Foo is explicitly coupled to class Bar because it relies on that class name to create the my_bar object. If I don't like this e... |
I am planning to make a service which will have simple REST APIs and will have a database in backend. I also wanted to add a logic to listen to notifications emitted by other service and there is some business logic which will update the row in the database.
For updating the database row from Notifications, I can think... |
So I have an engine in progress that's structured like this:
entities are simple ids (unsigned short)
components are stored in pools which are static members
systems are stored by the manager, and all inherit from a single base
What this looks like in code is like this:
struct transformComponent {
const unsigned ... |
I'm more or less learning the MEAN stack (have yet to start on Angular, so currently using straight vanilla JS for front-end) and part of what I'm building for my portfolio is a drag-and-drop form builder.
Currently the form has sections, which contain questions, which can contain multiple options as well as multiple f... |
Assume there is a class Shape. The class has two functions area() and perimeter().
Let's say Circle and Square inherit from Shape and override these methods. Obviously the results are going to be fractional.
What is the best way to set a precision value for the results. Say the user says PRECISION=2 or PRECISION=3 and ... |
I'm working on a C++ project which is currently divided into "sub modules" / "components". Each of these are compiled into a separate library (components are usually 10-20 files).
The libraries are linked to tests which ensure that each component works as expected.
I've now started to work on the "main" part of the pr... |
Is there a logical reason why the integer is upgraded to 32+ bits?
I was trying to make an 8bit mask, and found myself a bit disappointed that the upgrade will corrupt my equations.
sizeof( quint8(0)); // 1 byte
sizeof(~quint8(0)); // 4 bytes
Usually something like this is done for a good reason, but I do not see any... |
I have been pushing unit testing lately. This is a new skill for my team. I have had 10+ years experience writing unit tests, but I am basically the only person on the team with any experience with this at all. I have been struggling lately with how to budget for learning these skills. Forcing people (me included) to l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.