instruction stringlengths 34 36.1k |
|---|
We're designing a system to define user groups. The groups will be used to run queries, to target promotions at relevant users. For example, to send a "$5 Free if you come back this week" offer to users who haven't shopped at a particular merchant in a while.
A group is defined by a set of filters, of which there are... |
I've been building a monitoring system that checks whether a device is alarmed or not, and if so, sends notifications to relevant users based on how long a device is in a particular state. Here's an example of the criteria I'm building around:
1.) If a device has previously operated in a non-alarmed state for more than... |
Although the Java docs specify, that Weak references are primarily for canonicalizing mappings, you will find many, many, many people on the internet stating, that the WeakHashMap is perfect for storing object metadata during its lifetime. However, nobody bothers to make a comprehensible AND appropriate example.
Using ... |
In one of the products I work with we have an aggregation root with a lot of domain logic, and now I have a requirement to make one small piece of behavior configurable.
To give an example, let's say I have an entity and this entity has many schedules, these schedules tells me if they are on time or not and they have d... |
Assume following domain model:
An [Order] consists of a number of properties, as well as a list of [OrderLine]s.
For our purpose, an order is fairly crud-like with very little business logic.
Consider the following user story: a user retrieves an order. He then deletes one order line and adds 2 more. Finally, he saves... |
Our frontend web software contains, inside a file called url.js a variable used as URL root for REST webservices.
var url = "https://devappserver:8080";
During development on developer PC, for testing purpose, the variable is often changed to
var url = "https://localhost:8080";
The problem is that often developers c... |
I'm working for a company that will be renting smtp server capacity similarly to MySMTP. Our end users use a 3rd party email marketing frontend application configured with the details of our SMTP gateway to send emails. These frontend applications do not support custom HTTP APIs and only work over direct SMTP protocol.... |
I'm going to explain my question with a concrete example where this question has cropped up:
I'm working on a large-ish Django project with a few people. Django automatically creates migration plans and saves them to separate files when the database model is changed. Edits to the model may be applied on different branc... |
My company wants to do microservices and has created an outline of their plan (see below) (focused on dealing with files). I am not sure this is really microservices since I thought each microservice would have an individual data store? Also, they seem like one-offs that have no dependency on each other so in the end i... |
Whilst designing Java applications, I have come across a common pattern where I am writing an application that receives orders from a user and saves them in storage. When an order is stored, it can also be retrieved via its ID, and also some action done to it, e.g. have its cancelled flag set to true.
The common issue ... |
I have a repository for a project that contains both an executable and a library.
My repo
|->src
|->my-exe
|->my-lib
I am now working with a company that wants to use my library in their project as well. They want to vendor (i.e., make a one-time copy of) a subset of my repository in their repository.
Their rep... |
For the sake of personal use and for the educational reasons I wanna make a Java wrapper around a certain service's web API. That is, no additional software is required to use it on a client machine - just my code.
I also want to make that wrapper reusable and possibly utilized by other people who might want to access ... |
I'm getting in a heated debate about the Single Responsibility Principle and some code that I wrote. I feel strongly that I am right and would like some unbiased feedback.
Basically, we have decided to log a certain way in our api methods. Since this code is exactly the same across all api methods I wrote some code to ... |
I'm new to programming and I've discovered something that causes me confusion and frustration: Translating business logic into actual code. I'm trying to develop a set of questions I can ask myself that will help me get to the level of detail I'm going to need to meet the logic requirement.
Do programmers have a set ... |
I work in a manufacturing plant that has tasked IT with creating a shop floor scheduling program (that is very badly needed). Based on others experience, would it be better to take less time and build out a basic framework that is usable and then build upon that by adding features or start out by creating a fully imple... |
I am currently reading a chapter in a textbook on Processor Architecture and saw the following statement:
The less precision there is, the less space is occupied by a program variable in memory. Further, there is often a time advantage, both in ferrying the operands back and forth between the processor and memory, and... |
Does this algorithm have a name? I've listed three examples of it below. I'm wanting to document some code that uses this algorithm, and I don't know what to call it. My version is way more complicated but it is fundamentally this.
Example 1:
var maxValue = Int32.MinValue;
foreach (var value in new [] {2, 3, 4, 4, -3, ... |
I have seen a very nice effect in many applications which i don't how how it is achieved.
There is, usually, a list (eg. with emails) and the app populates it gradually with the emails putting them in order. They usually have a sliding effect to place the emails in the right line in the list.
Now, what I would like to ... |
I have a problem with design a few simple classes. I want a four classes: one recursively delete directory, another copy one dir to another same way. Another two does same as first two but they add observable behaviour: calculates few parameters like estimated time or percents of doing operation and fire up observers.
... |
I am currently working on a solution that involves showing millions (a hundred, maybe more) of records from a database, but only a small subset per page (maybe 20-30 records a page)
The site has been created as a WebForms application
Database is Intersystems Cache, (luckily the SQL side only, no globals)
Intersyste... |
I am writing an application that I've split into multiple jars including re-usable infrastructure libraries, each has their own versions (BOM managed) and git repositories. I'm doing this for a number of reasons.
some of these would be reusable if I decided to start writing a completely different application, and I m... |
I am looking into the logic behind applications like Unity3d, that allow you to write code with JS, C# or Boo, and then compile in a common language (I believe it is plain C++), making the editor independent from a specific language. Allowing users to write code in either language (or all of them at once, in different ... |
I work for a software company that makes business information systems for a large enterprise. We do systems for invoicing, payment, planning, etc. The enterprise uses SAP for their core system, and our systems use SQL Server with PHP as the application layer.
So far we've always used XML files to communicate between SQ... |
I'm constantly trying to acquaint myself with different programming concepts, and I recently looked deeper into ranges.
In Haskell a range is basically a literal that expand to some kind of array.
In Ruby (and Python I guess) it is a completely different type.
My question: What are use cases for ranges except iterating... |
We are developing a Rest API for eCommerce website which will be consumed by mobile apps.
In the home page of an app we need to call multiple resources like Sliders, Top Brands, Best Selling Products, Trending Products etc.
Two options to make API calls:
Single Call:
www.example.com/api/GetAllInHome
Multiple Calls:
ww... |
I'm collaborating with a friend to, as a challenge, create a bot that can beat the best human players at a browser-based card / board game called Duelyst. It looks like this:
It was my original plan to build very basic machine learning from the ground up but he suggested we look into options in this list of JavaScript... |
Suppose, my application consists of many components, where users need to fill theirs information, something like this:
-Select city
`-Select library
`-Select book
`-... a lot of components like above
So, application has determined data flow, first user need to select city, then library, then book, etc.
The data f... |
In the simplest form, our (near future) project consists of a end user program, that directly connects to databases and apis.
This is obviously bad as then the end user program consists of sensitive data such as usernames and passwords.
How do I avoid this properly?
searching on the web seems to point to Remote Method ... |
When I want to design architecture of system in diagram, I usually take some architecture patterns and give them the system identity.
For example, a simple system for school management with Layer Pattern can be:
But MVC as architecture pattern dose not easily gets the system identity in diagrams.
I don't know how to ... |
A popular high level architecture choice in modern program is a REST-based microservices system. This has several advantages such as loose coupling, easy re-use, limited restriction on technologies that can be used, high scalability, etc.
But one of the problems I foresee in such an architecture is poor visibility int... |
I'm new to programming and I'm trying to develop a template of questions I can apply to business rules that will help me extract what's needed to begin coding.
Do programmers have a set of questions they ask themselves or any kind of template they use to assist in this process?
Example rule:
Business Rule 2:
There m... |
I've noticed that some languages like C, C++, Java, Perl, and .NET Visual Basic have "block" scoping which means that a variable will only be defined within the specific code block it was declared in.
For example (C++):
if (true) {
int x = 1;
}
std::cout << x << std::endl;
This code will fail to compile since x is... |
I have a model, the model has 2 strings; foo and bar.
foo is what it is, it will be one of x amount of possible values (it's not an enum, though).
bar is entered by the user, so I want to validate it. But I want the validation to be driven by foo, and I want to use Remote validation (to do it remotely).
My suggestion:
... |
I am working a project which involves back-end Restful API and single-page front-end app. I am wondering if the back-end API has to implement all sort of data validation logic , which is also to be implemented in the front end input forms?
|
Imagine the following git repository:
/
/ProductA/product_a_main.py
/ProductB/product_b_main.py
/SharedLibrary/shared_library.py
SharedLibrary is used by both ProductA and ProductB.
ProductA and ProductB have different release schedules.
Any advice on how to handle branching in this scenario? I imagine one model wou... |
Our colleague promotes writing unit tests as actually helping us to refine our design and refactor things, but I do not see how. If I am loading a CSV file and parse it, how is unit test (validating the values in the fields) gonna help me to verify my design? He mentioned coupling and modularity etc. but to me it does ... |
I need to write a service that reads data (a row) from a database, sends out AWS SQS messages, and finally deletes the data from the DB.
Let me explain using an example.
I have a database table D, the service S, and SQS queue Q.
Every minute, the service S, reads one row (R1) from D, parses it, and sends a SQS message ... |
I'm working on a library that can represent LED strips virtually. My main class, LEDStrip, is abstract and has a couple abstract methods, like getLength() and setColor(int index, Color c). This lets whoever implements the class focus on just a few simple methods and let the parent class do all of the processing (such a... |
Take for example, a simple web server in C's loop:
while(1)
{
/*accept connection that comes into server_socket and assign
its handle to client_socket*/
client_socket = accept(server_socket, NULL, NULL);
/*send data to the client thru the client_socket*/
send(client_socket, http_header, sizeof(ht... |
Recently I got interested in scheduling problems or rather dynamic scheduling problem. The problem is that I want to develop some kind of layer in my application which will be polling circa about 50-100 e-mail boxes on regular basis. I do not have any control on IMAP/POP3 servers, I cannot customize or modify them in a... |
I'm looking at the rewrite of an ASP.NET application, from website / dataset techology to MVC / EF. This question is about a particular function that I need to research. I'm so new to EF that I don't know where to start. This question is about where to start.
The current application acts on complex data objects which... |
I'm referring to the two types of react components - presentation component and container component. In a more platform-agnostic description, is the container component just an adapter for a presentation component and the rest of the system? Or is it an instance of some other pattern?
|
There is considerable cost (and pain) for developers to debug external libraries due to the fact that many libraries are distributed in two editions: one with debug information, other without. The developer has to search and download debug files, and point the debugging environment to their location. This is often a p... |
Using Three.js Revision 51 (Yes I know the latest is 84) I am getting a screen tear at random times on the load of my page. It seems like it's 50% whether it's a hard refresh or a fresh load of the page, it seems like it will have a 50% change to have this gaping black jagged shape in the middle of the object. But othe... |
I have a method that I need to test that has multiple cases that need to be tested, and each case requires a few lines of code to test. Before long the test function is 50 lines long and it is a bit difficult to find the failures. (No, this function is not able to be reasonably split into reasonably small and easily te... |
Node, Express, and MongoDB are really connected so I can understand why they are frequently used together. For a web app of medium complexity, can I get away with only using HTML/CSS and EJS for the front end? I don't really understand how AngularJS fits into the MEAN stack. Can someone elaborate?
|
I have many django projects witch looks the same: there are some Config models and some models user actions Results.
The task is to make a one point of Config models contol, keep the history of changes and have authorization (let's call this project Control UI). And I think django admin will be good for it and django-r... |
The Development Team is responsible for creating/updating the definition of “Done”.
According to official Scrum framework, WHEN is it most appropriate for a Development Team to create/update their definition of “Done”?
WHEN is it most appropriate for a Development Team to initially create the definition of “Done”?
WHE... |
Lets say I have a JavaScript class that takes a whole lot of settings in the constructor, and then only have one method that the user of the class might want to call multiple times. Here's an example:
class Doer {
constructor(settings) {
this._settings = settings;
}
function doIt(params) {
... |
Imagine a system that has a large number of servers. Each of them has a number of settings:
Some specific to the server
Some specific to the region
Some common across all of them
Maybe you can have some custom groupings, like this group of servers is for reading only
etc.
Current practice I have in mind is a simple p... |
We recently had a company (netsuite) come by and mentioned how their e-commerce software was open source. When I asked if I could see the source code, they mentioned I had to either:
Get with a training specialist (and not see the source code).
Buy the software to view the source code.
Could you even consider this... |
I worked for a client a number of years ago (who I won't name to protect the guilty) that would periodically have information like the following in their View logic:
if (client == "a") {
// ...
}
else if (client == "b") {
// ...
}
else {
// ...
}
Their platform was ColdFusion (yeah, don't laugh) and this was ... |
TDD and general best practices around writing tests say that we should test the behavior and not implementation.
Hypothesis:
In that context, EasyMock.expect().andReturn() should never be used because expect().andReturn() will fail if the expected method is not called on the mocked object.
Instead, expect().andStubRet... |
Here is the framework
We have an SQL database in which our database model lives in. On the other side, there is a bunch of code using and filling that database.
Here is what we want
We want to put both, the database model and the software code, under version control to be able to go forth and back within
different ve... |
In my application users compute some engineering data (physical quantities like lengths, and weights).
Currently the core formulas work on and assume English system, but user can select English or Metric system to work in. If English is selected, no special provisions are required, everything is done in English.
But i... |
Recently I've had an argument with a teammate that I was "not consulting them before reverting" because it makes them "look like an idiot". (For context, this is a university project, and the revert was over code placement.)
This makes me wonder: What is the norm for informing the committer that a revert needs to be do... |
I believe I have learned some/many/most of the basic concepts underlying functional programming in JavaScript. However, I have trouble specifically reading functional code, even code I've written, and wonder if anyone can give me any pointers, tips, best practices, terminology, etc. that can help.
Take the code below. ... |
I am trying to learn ways of DDD and related subjects. I came up with an idea of simple bounded context to implement "bank": there are accounts, money can be deposited, withdrawn and transferred between them. It is also important to keep history of changes.
I identified Account entity and that event sourcing would be g... |
I have some categories that users can favorite and track, the actual category names and details are stored in the DB but the items belonging to each category are fetched via api.
When a user adds a category to its favorite list I call the api fetch all the items belonging to the category, and store the actual category... |
I'm struggling with Object Oriented Programming.
From a conceptual point view, are instance methods contained in objects (like instance variables are)?
I am picturing objects like this:
|
EDIT 2017/02/13 - Check the repo as it is now. The first example is solving with SRP in mind, but later on introducing other principles of SOLID.. I should've explained that better.
I'm trying to get a good example down of a violation and how to solve the SR principle. I want to be sure however it is good, and that I'... |
I have a question related to relationships between aggregates in Domain Driven Design.
I have the following situation: I have an aggregate (questionnaire) which has some children (questions). The questions are entities, but because they are inside the questionnaire aggregate they can have local identities (i.e. questio... |
I have 3 types of users who might login to my website: Admin, Instructor, Student.
I already have tables for Students and Instructors , and each one has its unique properties .
Now I want to create the login page. Many tutorials use role-based authentication in similar cases, but In my case , I have already created ... |
During development with MVC I figured out this Architecture (based on Symfony Framework but I need to apply it more generally on MVC Pattern base software):
In other words each model is a Facade of my business Logic. Usually is in this Form:
<?php
//Namespace definition
class SomeModel
{
public function __construct... |
I am trying to check if my array A has an instance of object B at the current position, since it is an array that can contain two types of objects (B and C). I do not want to use instanceof, so I'm wondering what other alternatives I have?
if(A[i] instanceof B)
|
Javascript is a single threaded language but when developing point-and-click adventure games, it's often advantageous to have 2 "threads" running, the rendering/logic thread and the game scripting thread.
The rendering/logic thread runs every game-loop to render the scene and move the characters around and so forth.
Th... |
My current project is to implement a kind of WinMerge clone to compare two files.
I am using C++ with the Win32-API (WTL, ATL, that stuff), and I already designed an UI for this. However, I am now sitting here, thinking about a design on how to manage the whole file comparison and the data flow.
Following problem:
I ha... |
My application is a Java program that controls a robot (which is essentially a raspberry pi hooked up to a lot of devices). There are many devices on the robot that have semi constant address values or pin numbers. Currently in our codebase you'll see a lot of static constants defined like:
static final long SLEEP_DURA... |
This is the problem: I am designing a framework that is basically getting chemical compounds, perform operation with them (or among them) and return results.
At the moment I have a class that holds all the operations(like mix, centrifugate, separate, heat up and so on). I create a sequence basically by hand, including ... |
I've been looking at ways to monitor for changes in things like price and availability on e-commerce sites via visiting browsers, with three constraints:
the sites often don't have much ongoing development effort behind them, so the solution needs to be simple to implement
there should be minimal impact on how quickly... |
Coming from Python, if C does not have array bounds, how does it know where a[1] starts?
int a[3][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
b = a[1][1];
|
Usually on Symnfony framework I use the provided depedency Injection container and on Controller I load the models as a service. To be more In detail on a current project I am having the following services.yml:
# Learn more about services, parameters and containers at
# http://symfony.com/doc/current/book/service_conta... |
Now I'm trying to understand Actor model. I know main concepts like everything is an actor etc. I see a lot of words like "it's very good from performance point of view", "no locks because there is no shared resources and messages are immutable". But I still don't understand some points:
In case of old school CRUD app... |
I'm currently working with the following abstraction.
public interface IFileRepository
{
void Save(string identifier, byte[] content);
Task SaveAsync(string identifier, byte[] content);
string GetUri(string identifier);
}
Application services would use this interface to save files on a... |
I have a class constructor that needs to perform a couple checks. It is checking a file for the occurrence of a few tags. I use a function that checks for the tags and returns a boolean value depending on whether the tag was found. If the tag was not found it calls return, stops executing the constructor and sets the a... |
Earlier today I was working on a simple program from a textbook.
Although I solved the question with confidence and a clear robust solution, the solution wasn't perfect as it had steps which were redundant.
The more I optimized and tried to make it perfect:
The code became more:
- Unreadable
- Buggy
I became:
- Le... |
Imagine an engineering type web application where there is a screen that displays around 100 of unique data values. The user can "page through" the screen by clicking Right/Left arrows, and the screen is updated with the next page of 100 values. When the right page is found based on some specification, user can save t... |
What is the best practice way to restrict access to particular resources based on ownership. For example, if Adam created several posts (collection: /posts). And I want Adam to be the only user able to GET these, how can I restrict another user, Eve, from retrieving Adam's posts from the data store?
I can force a user ... |
Recently I started working on a project where a very old monolithic application is being migrated into microservice-based architecture.
The legacy codebase is very messy ('spaghetti code') and often an apparently-simple function (e.g named as "multiplyValueByTen") later reveals itself as "thousands of lines of validati... |
Theory is, that classes which strongly know and use each other should be in the same package (using package visibility for functions that are not used by the rest of the application), thus forming a concise, understandable interface. [Well-known classes (accessed from almost everywhere, such as loggers) should go to th... |
Well, recently I found a problem about licensing.
I have an open source project on GitHub, recently I need some codes which using GNU GPL, but my project is using GNU LGPL, so that's the problem.
So how can I use these code? I don't want to change my license. Ask for permission from the original developpers or?
|
Interface is used to implement more than one class but it doesn't have any code inside its methods... however the method that is called works with its respective function. Also, it gets very confusing when it is used in design patterns like facade. example: in case of PHP framework Laravel.
|
I'm trying to check my understanding of the kappa architecture. The main point I am trying to resolve is how, if at all, one unifies the processing of data under analysis and other pieces of data, such as a user changing a setting which could later affect data analysis.
For example, suppose IoT data of electrical usag... |
I noticed some strange behavior when working with submodules in Git, which is maybe not so strange to anyone with more experience than I. Well, what I am noticing is that whenever I make changes to any of my submodules, those changes seem to stage some sort of a change for a commit by the main repository that's contain... |
I want to ask for a review of my big data app plan. I haven’t much experience in that field, so every single piece of advice would be appreciated.
Here is a link to a diagram of the architecture: My architecture overview
Our app is webanalytics app. I know that already there are many of them however, we use it to analy... |
I'd like some advice on how to approach this problem. I have a database of ~3000 pictures of people. Their names are built into the filename but there is no standard format. Here are some common name formats: MarySue-042; henry higgins03; J. H. Doe; Jones, Peter; and M N Shyamalan, MD. Some have middle names and some ... |
When we mean e-mail payload, are we talking about the whole message provided after DATA command or just the Body part of the message (without headers like From, Subject, Message-ID etc)?
S: 220 smtp.server.com Simple Mail Transfer Service Ready
C: HELO client.example.com
S: 250 Hello client.example.com
C: MAIL FROM:<ma... |
Although this question takes a very narrow, concrete form, I'm more interested in the conceptual underpinnings of justifying an approach, and how I can apply it to the next problem.
Setup
I'm writing a tool that takes a list of AWS accounts and optionally, for each account, a blacklist of S3 buckets. The tools goes thr... |
The code listed below is intended to calculate some rotation data which will later get used in my rendering code.
renderer.cpp:
rendered_image renderer::common_tasks(render_info const& info) {
//info.radius is a float, info.min_image_size is an int calculated by taking the minimum
//of info.image_width and info... |
I am having trouble understanding the purpose of everything I am trying to do here. I have web api, mvc, and angular2 project linked by authentication provided by identityserver4
As in, why would I make a web api?
Does the user that connects to my MVC application communicate for information directly with the WEB API a... |
I am working on a large scale application that has both a web portal and a mobile application so therefore I need to develop an API..
I have decided to go with the following structure:-
Sailsjs (this will be the front end, everything inside the application itself)
lumen (this will provide the oauth client and also a ... |
I would like to track, for each backlog item, which event originated it. For instance: "Original briefing", "Meeting Jan", "Meeting Feb" ...
Using scrum, what is the correct way to track the origin for each backlog item?
I'm using visual studio online to manage my scrum project.
|
For context, I'm building a GTK+ application in C where a subclass of GtkApplicationWindow creates and displays a subclass of GtkToolbar and a GtkNotebook (a widget with multiple pages that can be displayed alternately by a member function). There are radio buttons on the toolbar to switch among the pages.
Should the t... |
I have been assigned to think of a layered microservices architecture for Azure Service Fabric. But my experience mostly been on monolithic architectures I can't come up with a specific solution.
What I have thought as of now is like...
Data Layer - This is where all the Code First entities resides along with DBContext... |
Imagine I have a set of choices having different set of values but also the chance to input a free value (usually a number)
e.g.
<select name="choiceA">
<option value="One">
<option value="Two">
....
<option value="Nth">
</select>
or
<input name="freeNumChoice type="number"/>
Not all combinations ar... |
In my project I have specified 5 sublayers for my DBAL:
Database Layer ( the database itself)
Database Connection Layer ( \PDO and a class that handles the database connections)
Database Request Layer( classes that actually query the database )
Database Model Layer ( All classes that represent 1 Database table each an... |
I was reading the Wikipedia article on Actor model and came across this line-
...bridging the chasm between local and nonlocal concurrency.
What is this "non-local" concurrency and how is it different from "local" concurrency?
|
I got a problem with lazy loading in combination with a foreach loop.
I'm working on a code first asp.net backend for a website, and sometimes I want to gather information spanning multiple tables/models.
For example, take this:
public class Foo
{
[Key]
public Int32 Id { get; set; }
public virtual Bar Bar {... |
I'm designing a simple scala wrapper library over a java library in order to make it more idiomatic scala. The problem I faced with is that all operations from the java library could throw an exception, which is RuntimeException, but very similar to IOException. So I'm wondering if it's a good idea to wrap all of them ... |
I am developing an small application, just to practice DDD. Afaik. invariants are the umbrella term of validation related to domain. So for example if I want to have only ucfirst names, then that is an invariant and I need validation in the property setter to make sure that this invariant is protected and make only the... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.