instruction stringlengths 34 36.1k |
|---|
For a web app I am working on I have a pretty basic relational database. I access this database through a RESTful API and generate the markup in React once the data is retrieved.
If I find myself constantly manipulating/processing these JSON responses on the client-side just to structure these objects into more friend... |
I'm looking for a known design pattern or algorithm that can be used to effectively determine a set of available options to be presented to a user based on previous decisions.
An extremely simple example of this could be Year > Make > Model where Model and Make are dependent on the prior selections the user made.
I'... |
We are using Janrain in our app, but I have to create an interface to make this service easily replaced (because Janrain is so custom!, it does have common things in Oauth however)
However, I'm getting a hard time trying to achieve this.
What I don't want is to have, in my main UserManager service, a JanrainClientInter... |
EDIT: This question led to another, namely Representing handlers on UML diagram.
I'm trying to create an Activity Diagram that shows that a collection of objects is handled by a collection of handlers. Something along the lines:
Objects objs = { ... };
Handlers handlers = { ... };
for (o in objs) {
for (h in handl... |
We faced an issue with an API "init" method, and trying to understand if we must use GET or POST http method in context of REST.
Preconditions: SPA on the frontend which communicates with our backend using REST API. SPA is meant to work with a 3-rd party service through our API.
Description: When user loads the SPA, f... |
In learning the merge sort, the examples show the list of items being split in half over and over again and then merged again.
Why not just start with iterating over the individual item pairs in the list sequentially if the initial split action always splits the list into single individual items?
I understand that it i... |
I have a performance issue with a few methods in my Service Layer. Methods that are causing me troubles have some logic, but it's db connection that takes over 95% exec time. The problem is unfortunately hardware, the machine is just slow. But, let me explain the software problem first:
The scenario goes like this (sim... |
One thing I always struggle with, when designing software, is to find a good way to keep track of an object's status.
For example, let's say I wanted to keep track of a car being built. It could have a status of "Paint job completed". But from a different perspective, this status could also be considered "Ready for as... |
I have a mobile app who consumes a api service. I have a class to manage all the operations (get, post, put) who throws exceptions if the result is not 200.
The app was originaly designed to be mostly offline so my services where like this:
public async Task<bool> GetMailList(int idUser)
{
t... |
I am working with huge point clouds (1 billion points). I need to process and display them but because of the size of the data, I can't have it all in memory at the same time.
First of all, I am not asking for a tech that does that (CloudCompare, Potree, Terrasolid, etc.). I'm asking about a file format solution to thi... |
Naming things
There are only two hard things in Computer Science: cache invalidation and naming things.
-- Phil Karlton
Naming things seems so trivial, before I read this quote, I would have thought this whole question to be off topic here. However, a well chosen name can make such a huge difference in readabil... |
I am developing a project that uses serial communication to interface between a micro-controller and my computer. I want to be able to pass what variable I want to change as well as the data to be assigned to the variable. Would this instance require use of a pointer or an "address-of-operator"?
Function
void xyz(int... |
I'm trying to learn more about the DevOps trend and what DevOps actually is, and how it could apply to my situation (recently fuelled by the Stack Overflow survey results starting by mentioning DevOps). All my research so far points to things like under DevOps, developers assume responsibility for deployment and automa... |
A useful principle in computer programming is DRY (Don’t Repeat Yourself). I am trying to follow this rule as I am refactoring a large .NET Framework MVC project by breaking it down into separate solutions.
One problem that I am still unable to resolve to my satisfaction involves a set of C# libraries (static function... |
It makes sense to me that .gitignore should only include files that the project has to produce inside the source directory when you run some configuration or build step. All else that pertains to personal workflow should go into .git/info/exclude.
Let's say I'm starting a new project using, say, CMake so that there is ... |
This question is a follow-up to Representing multiple actions for sequence of objects on activity diagram, but isn't strictly related. The question boils down to:
How to present in UML patterns that behave differently depending on how network of handlers is configured.
In simplest case I have the following:
<cfg>
<... |
Why do some developers in C for example chain together assignments of variables like this:
i = j = k = 0;
or sometimes formatted like
i =
j =
k = 0;
Is there some underlying complier optimization here? Do hardware registers overflow into the next loaded variable or something? Or is this syntactic sugar?
|
I have done a lot of BDD reading since the beginning of the weekend. At the moment I am reading about the imperative style v the declarative style. The imperative style is often described as an anti pattern like here: http://fasteragile.com/blog/2015/01/19/declarative-user-stories-translate-to-good-cucumber-features/... |
I have a data-driven legacy system (has a Java Swing client and a JavaEE application server) in my workplace, This system uses a single database for querying and modifying data.
Recently we've been asked to write a new web application that implements some of the already-existing features of the legacy system.
The appli... |
Are there any implementation or support differences in element.style.setProperty(property, value) and element.style.property = value?
Are there any compatibility/browser support issues with one form or the other?
What are the differences of each syntax?
Is either form considered a "best practice"?
|
I'm creating a website which will collect posts from facebook's pages to show to the users posts they are interested in (as my graduating project).
I'd like to be able to rank the posts that contain the words which are queried.
Hence, I use (solr)for full text indexing which allows me to effciently get the posts conta... |
I'm writing a slack bot that interfaces end users with an API.
That API only method of identification is the raw "login:password" encoded to base64 (it doesn't answer back a token) ...
Currently in test mode, I'm just asking users to send their credentials to the bot and then the server can make requests to the API wit... |
I am working on a Xamarin.Forms PCL social media app project. People can like posts and comment on them which is saved in MySQL. I would like to add an activity page.
What is the best way to calculate users activity, I don't think UNION will work since the comments table has a different structure than the likes table.
... |
It's about trying to understand the architecture behind how updates to web application is done.
I've been working on a non-public website that has bunch of records displayed in a UI, now the intelligent part of this application is that if I delete something in the database through API's without touching any button with... |
I'm writing an API server. The framework we're using is Rails + Pundit + graphql-ruby, but I guess this question is framework-independent.
We have authentication + authorization implemented on the resources on each different endpoints; and we want to make sure that the endpoint which requires login, are properly protec... |
Imagine a simple drawing of let's say a duck. And you have an photo of it in your database.
Now a user takes a second photo of the same drawing of the duck. What approaches exist to check if both photos show the same drawing?
Is it possible to extract the vectors and compare them afterwards? I'm completely new to this ... |
What is better solution? Eg. an object has a lot of single settings. Keep all these settings in one table or divide these features and store in separate tables with relation 1:1? Some features are required for all objects, other only for specific types of objects.
One solution could be store all required fields in tabl... |
There is a dictionary in my class with informative, short string constants as keys that identify certain parts of the solution, like "velocity", "death_star_power_output". My colleague suggested that I use VELOCITY="velocity" and DEATH_STAR_POWER_OUTPUT="death_star_power_output" to index into this dictionary throughout... |
In my previous Java job, we tended to avoid defining interfaces for everything unless we genuinely had multiple implementations for it. This may just be my opinion, but if there is only one implementation, I don't see the value in an interface - we're not really writing generic code, that might be used as a library.
Ho... |
So I like test-driven development and frequently I have wanted a programming language to assist with the creation of test routines. I have wanted to define the domain of a function and then have some test 'buddy' generate some random test input based on the domain, some test data deliberately inside the domain and so... |
I have a DTO like below
class OnlineProfileDTO {
@JsonProperty("likes")
SummaryDTO likes;
// lots of other complex fields similar to above
}
class SummaryDTO {
@JsonProperty("count")
int count;
}
Now whenever I need likes count in a DTO to DBEntity converter, I need to check if onlineProfileDTO.getLikes() ... |
This question is a result of an internal debate involving R&D, DevOps and Automation departments of the company I work for. Here's the nutshell of the debate:
automation: We need SSH access to all and every container during and after tests to automate (at least partially) RCA, if we don't have this, a lot of test fail... |
Modern webapps have multiple microservices that may be on multiple domains (e.g. subdomains) and providers (e.g. both AWS and Google Cloud; or Google Container Engine Google App Engine within the Google Cloud).
Yet there are reasons to present these together. For example, Content Distribution Networks and security serv... |
I was wanting to create a program consisting of 3 elements:
A central component with no UI which will work on HTTP traffic and trigger one or more “worker” elements as needed
A monitor component which is an optional frontend to the central component which will read logs and send data to a central component through a m... |
I'm currently developing a Python program with a GUI based on Qt 5. I use a MVC template I found on Github.
Let's assume that a single check box was checked or unchecked and the model was updated. Changing the model causes the view to update itself because the view is an observer of the model. Updates of the view are d... |
I am working on a small application trying to grasp the principles of domain-driven design. If successful, this might be a pilot for a larger project. I'm trying to follow the book "Implementing Domain-Driven Design" (by Vaughn Vernon) and trying to implement a similar, simple discussion forum. I've also checked out th... |
In the spirit of minimising state I always have a desire to mix data types for a given state property. For instance, if I were creating a React page that rendered a list of items that could either be the entire list of items, or a filtered list of items, I might want to have a state property called itemList and another... |
I am working for the consumer oriented company which has mobile app as main product.
Our mobile app has 100K monthly active users and is developed using Cordova + Kendo Mobile + Telerik Appbuilder (which will be discontinued in couple of days). We are thinking about migrating our code to native solution (either real na... |
I'm currently developing a minor project for school and I'm supposed to use a three layer architecture in the project.
I'm working with C# in .NET and I'm also working on Windows Forms, and with the help of Entity Framework i've made a database (Model First) connected to the project in a separate solution. After the da... |
I want to expose my business logic via WCF service in the intranet environment. I have N-tier architecture, pretty simple:
Database -> .Data (DAL) -> .Business (Service Layer) -> WCF
So, far I have 4 services in Service Layer, but only one WCF service. I here comes the problem. My WCF service uses all 4 services. I'm u... |
How can I name an abstract class that has a common part of view of my two panels? One of them is for creating an object and the other one is for updating it. I want to keep these view in different classes to maintain SRP.
|
Is it normal for a DAL to have actual logic? For example, my Repository implementation is in the DAL layer (IRepository in BLL), if the data it needs isn't in the Local DB, it needs to scrape various websites to gather the data (and cache it into the DB). Is this normal? Or should the DAL just be a go between the DB... |
I'm storing some temperature, voltage and current data every 10 seconds to a log file. This file is supposed to be retrieved later so we can read the data and display it. Time requirement is 6 month worth of logs and the space requirement is under 6 MiB.
The protocol I came up with looks something like a fixed record o... |
In order to avoid a confusion within a method signature comprised of the same types, a class can be introduced to make it distinguishable from others.
Let me support a text description with an example in Java.
E.g., from:
public void foo(String bar, String baz, String qux, String quux);
to:
public void foo(Bar bar, B... |
I have a scenario as following (you can think of it as a distributed Wireshark system):
For a single capturing session, there are about 1 ~ 10 traffic capturing nodes distributed in a LAN network. Each capturing node will capture raw message data at speed about 1 ~ 1000 records/second for about 1 ~ 10 hour. In the mean... |
This is regarding designing a search api. We have 3 tier architecture now using Spring MVC. All communications are via REST api.
UI <-> Business <-> Data(sql).
Now to implement faster search, we are planning to index data from sql. So any write to data-layer, will be indexed in es as well.
BL (writes)-> DL(writes)->El... |
In a recent 1 on 1 w/ my team’s product owner, we had a disagreement about how much work should be done on a project or feature before presenting it to the team.
The PO is used to creating specs up front as the starting point and presenting that to the team. Furthermore, he feels as though external (at least in our org... |
I made WPF application for a client-side and hosting database in a server side ,
I know there is something called REST API to transfer data between a client and server
I don't know this method and also i don't have a time to learn it because the project should finish less than one month,
I am thinking to make client a... |
Well I am newly graduated and placed in a small scale project based company. When I joined , the boss (project head) gave me project code for understanding what work I will be doing hence forth. I got stunned by looking at the code because it's hefty more than 10 thousands lines divided in between multiple functions ... |
We have ServiceA with these endpoints defined:
/devices:
get:
queryParameters:
make:
type: string
repeat: false
required: false
model:
type: string
repeat: false
required: false
responses:
200:
body:
schema: Devices
... |
I am developing a new desktop application from scratch using C#, before opening the visual studio and start typing in the keyboard I want to prepare a solid design for my software. The main challenge for me is how to handle errors and exceptions. I know that .Net Framework provide a good error handling but in addition ... |
Let's say I have objects that have relationship references. These relationships could be parent-child, siblings, actor-reactor, publisher-subscriber, etc. but I don't want to restrict the relationships to any particular type of relationship. I want to allow the user of the framework to provide any number of relationshi... |
I'm facing the following issue: I have a very simple aggregate root Product, and a product contains Image entities.
Right now in code this relationship is expressed as a Many to One relationship like this:
class Product:
Image[] images;
Now it happens that I need to make that relationship a Many to Many relationsh... |
When is it more appropriate to use asynchronous calls from the view to get data vs prepopulating it server-side when creating the instance of the viewmodel?
For instance, if my view has some dropdown menus that need to be loaded with values for the user. When might it be better to add List to the viewmodel vs making a... |
Is there a feasible way of testing SQL queries that contain things like CURRENT_DATE and NOW() in a unit test?
For example:
public function deletePastEntries(): bool {
$sql = "DELETE FROM queue WHERE period_end < NOW();";
return $this->db->query($sql)->execute();
}
And in my unit test:
class QueueTest extends ... |
I'm creating an application which's architecture is based on Uncle Bob's Clean Architecture concepts and DDD. Note that it is BASED on DDD, so I gave myself the freedom to differ from strict DDD.
To create this application, I am using C# with .Net Standard 2.0
One of the principles of DDD relates to Value Objects. The ... |
With OOP what is the recommended way to pass an instance of a class which is restricted - such as read-only properties or less methods available.
Below is a Vector2, which contains multiple methods for manipulating it's properties such as the setters or the add function.
class Vector2 {
private _x: number = 0;
priv... |
I am taking a software engineering course and got an understanding of basic concepts used in designing solutions for businesses.
We come up with requirements, do use cases and user scenarios and it all makes sense in the business context.
However, I am more interested in video game design and I am wondering what sort o... |
Let's say we have a registration system that finalises the creation of an account by SMSing the user their new account details.
This system could be used by people all around the world, so let's say we're using an online API that can send SMSs internationally regardless of the recipient's carrier. Because we want to ma... |
I have a system that interacts with a REST API as the data source. This system is based on DDD and all of my current models are CRUD models. There is one model that the REST API is only able to query as a full aggregate, but only able to write as entities within that aggregate. The reasoning behind this API design is t... |
I am working on a USB stack in C. This stack will be open source and used in various different projects.
Various configuration options are available, which enable or disable large chunks of code and constant data structures. As this is an embedded project it is important to minimize the footprint of the stack, and one ... |
I would like to use DRY beans on my client-server application (DRY: Dont Repeat Yourself).
It is not a problem to me if it is highly coupled: I know that my DTO will have the same form as the database beans (Entity class in JPA).
The DTO have the advantage to loose coupling between application, but if they are copied ... |
Background
I designed a social-media application (such as Facebook) where there is this strong concept of audience-based content system.
For example, let's say this user A can create posts (public, private or groups only), based on that configuration, the post will only be available to that audience.
Solution
What I di... |
I'm managing a team in .net.
They are writing unit tests, use them locally on a regular basis, and love it. However, they keep pushing to have the unit tests kept as a separate project and only want to run them on a communal build server once a week or so.
In contrast, our JS teams are running tests on the build server... |
Imagine that you are developing a front end client that will consume an API. You're working on the login page and want to display errors to users below each field, in this case you want password related errors below the password field.
You submit your login information to the endpoint, the password is incorrect, and th... |
I found some java source code under MIT license on Github, but it is not included in any maven repository. I asked in issue to publish it somewhere, but nobody answered and looks like this repo is not supported actively (contrubutors may not answer for few months).
Can I publish this project to maven repo by myself wit... |
In my team, the Business Analysis is also a scrum team member. He will prepare all user stories to the Product backlog, but his tasks also should be managed with timeline/estimation.
Should we put those preparation tasks into the Sprint backlog together with development stories, or should we have a different way of tr... |
I would like to sort a list of people into buckets, as duplicates, by an email comparison, but I can't seem to find an efficient way.
Specifications
A person has 5 email fields, so in order to know if one person is a duplicate of the latter, I must compare each of his emails to each of of the latter's.
A might be dupl... |
Is a microservices architecture a good approach for developing a survey
application with the following features:
survey creation
online or offline data collecting
Reporting
|
I've been reading a few go blogs and and more recently I stubbled upon Peter Bourgon's talk titled "Ways to do things". He shows a few examples of the actor pattern for concurrency in GO. Here is a handler example using such pattern:
func (a *API) handleNext(w http.ResponseWriter, r *http.Request) {
var (
n... |
I am trying to build a derivation tree for the program
x = 42
using the specification for ECMAScript 2017. I see that there there is an AssignmentExpression which has the production rule:
LeftHandExpression = AssignmentExpression
however, I don't see any rule that allows an AssignmentExpression to be a literal.
Maybe I... |
I am currently creating Excel import modules for some complex data. I didn't plan it well and I have met code reuse issues. I have made first modules and I realized that next modules will need some methods from these I have already made. My first option was to solve it by simple inheritance hierarchy. Unfortunately I c... |
I am planning to improve my knowledge of Clojure and algorithms at the same time by implementing some known data structures in Clojure (e.g. linked lists, skip lists, bloom filter, etc.). However, I learned recently that this might not be a good idea.
[... T]he fact that getting an optimized solution is so difficult
... |
I've recently been reading Clean Code and there was a really nice example in java of when it is beneficial to break down a complex if statement condition in to a function rather than use a comment.
// Check to see if the employee is eligible for full benefits
if ((employee.flags && HOURLY_FLAG) && (employee.age > 65))
... |
How can I handle change requests to already finished user-stories?
Let's say there is a user story which describes how the user wants to list entities.
The story describes further:
which information of the entities should be shown (as columns).
under which conditions entities should be highlighted (background color)
... |
I've lately been very interested in reactive microservice design with streaming and event-driven architectures.
When one writes (i.e., manages) services, this paradigm works extremely well by simply responding to published events on topics.
However, we don't always control the implementation of all the services with wh... |
First, I'm still learning to do things in the best possible practices. I would like to know what would be a best practice when dealing with database queries. I've seen codes that query inside the loop to check whether that data exists or not. So let's say I have a set of codes shown below.
// assume that institutions a... |
I'm working on the data model of a service describing houses and flats. This involves storing quantitative physical properties of certain features of the premises, for example:
Speed of the Internet connection in Mbps
Length of a swimming pool in meters
Noise level of kitchen appliances in dB
The quantities will alwa... |
I'm creating an application that is composed using different modules (core, course, grades, news). I'm using clean architecture for the different modules but I'm stuck trying to pass data from one module to another module.
The idea is plug into one application (app1) several modules or use them in another application... |
I'm using Playframework with Java and I'm attempting to choose between a few choices for creating valid User objects (which will then be persisted into the database in my business layer). Play uses Forms as a way to help with validation.
So, inside my User class...
public User {
@FooConstraint
private String f... |
I'm trying to understand how a 2d or 3d map would be saved, and I'm trying to figure out quad trees. So like is each node represented by characters in a file and inside of that is the next one?
What exactly would the file look like, if its just a bunch of characters? Does the order of in which they are in the file sig... |
I have a proprietary application that I want to distribute and sell. The application uses a GPL v3 licensed binary/library.
Since I don't want to distribute the source of my application and also want to provide convenience to my users, instead of supplying the GPL v3 library with my application bundle, can I provide a ... |
I've recently been looking at C++ static analysis tools. One thing that confuses me is the terminology used with these tools:
Some tools are simply called "static analysis tools" (e.g. CppCheck), others are called "sanitizers" (e.g. ASan, TSan, MSan, UBSan) and others are called "linters" (e.g. PC-Lint).
Is there an a... |
I'm implementing a metadata parser of image files from all formats. I want to write tests for it. One trivial way to do so is to have test image files of all formats as a resources for the tests, and actually to read them as input. This approach may work but as far as I understand from unit test methodology, unit-tests... |
I want to generate a test scene for a unit-test (big file parser). What will be faster, to have a test file and to perform I/O on it, or to generate a large memory buffer using some static parameters during the compilation?
|
I.e. something that doesn't employ separation of concerns / use any form of UI architecture such as MVC, MVP etc.
An example would be a Windows form that had a button which, once pressed (user interaction), grabs data from a database (model), checks it against some business logic and then updates the UI, but all of thi... |
I am a beginner to the event-driven data architecture using Kafka / Kinesis as the centrepiece (currently Kinesis) and I have some questions regarding how to build a WebSocket API on such a structure. My specific use case is I have about 4 different data streams coming into Kinesis, I combine them into an 'aggregate st... |
It is often stated that Modbus/TCP isn't a real-time protocol. It is also "known" that Modbus isn't a real-time protocol. This despite the fact that the original Modbus protocol is highly deterministic.
In fact, as far as I can tell, the reason why it has historically and industrially not been considered real-time is b... |
I want to use a software which is licensed under the BSD, in my project.
I come up with two ways.
I create a directory for this component and copypaste the original LICENSE.txt file in this directory, and create a LICENSE.txt file for the whole system in the project directory.
I create only one LICENSE.txt in the main... |
I basically want to know if it is considered a good practice to persist the errors that happen on the client side of a web application (typescript/angular for example) by logging them to files?
Or if i can ask in a different way: What should i do with the errors/exceptions that i catch on the client side? (besides disp... |
Some background to my question: We have a traditionally windows-only C++ code-base which we are in the process of porting to linux. Parts of the system have been running on linux for many years, but some parts have never been built using any compiler other than Visual Studio. Most of the code is in Subversion, and we u... |
I’m finding it hard to avoid data duplication or a shared database for even the simplest microservices design, which makes me think I’m missing something. Here’s a basic example of the problem I’m facing. Assuming someone is using a web application to manage an inventory they would need two services; one for the invent... |
I'm working on a Windows application that is used for tracking document review and audit information for my company. The back end is a SQL server database and most of the user tasks are basic CRUD operations on the data that resides in SQL server. Most of the controls (listboxes, comboboxes, grids, etc.) are populated ... |
By these days I work in a legacy code that uses JAVA.
The project has a code tightly coupled and low cohesion.
All my teammates suffer to make changes in the software, one reason is that we haven't any behaviour test to secure that changes in software won't broken everything.
At the company that I work, the managers d... |
I'm working on javaFX project using Hibernate and H2 database,I'm trying follow the concept of MVC design pattern ,so I have created 3 packages :
models :contains POJO classes
2.1 views.fxml:contains fxml files
2.2. views.controllers :contains the controllers classes of fxml files
3
. dao:contains classes which they ... |
As a beginner I'll try to explain my problem as good as I can:
I'm currently trying to program a "simple" ECS. My basic idea is that I have a base "Entity class" which includes all sorts of functions for adding and removing components. Now I want to create some "templates" for entities, e.g.:
Entity Sprite:
Contains Te... |
Take the following example which loads an interstitial ad every 10 times user does XYZ in the app, under certain conditions. It is called in multiple places in the code base:
public class AdHandler {
public void showInterstitialAd() {
if (Subscription.isSubscriptionActive()) {
Log.i(TAG, "Subs... |
I'm working on an implementation of a webform decoder and am looking to support the nested webform pattern employed by PHP and Ruby/Rails (possibly amongst others).
PHP: parse_str(); Ruby: Rack::Utils.parse_nested_query()
I've noticed some inconsistencies, for example (behaviour is the same in both languages):
foo=One&... |
How can I observe ripple effect using coupling attributes alone?
I first find the common coupling metrics for a set of deprecated classes in a project, like CBO(Coupling Between Objects), RFC(Response For Classes), Import/Export coupling, Afferent coupling(Total no. of incoming edges to a deprecated package), Efferent ... |
After many years, I still unable to determine the correct way to define a class/function to play sound. Suppose my app may need to play some sounds, for example: button click, error popup,... How should I define the function?
** Method 1: one single function for all sounds**
//simulate languages features that enums are... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.