instruction stringlengths 34 36.1k |
|---|
I want to do something like Facebook does. We can see any time where we're logged in. e.g.:
Windows PC · New Delhi, India Edge · Active now
Windows PC · New Delhi, India Chrome · 8 minutes ago
Xiaomi Redmi 4A · New Delhi, India Facebook app · 10 hours ago
Now, I have created a table in database that stores mainly use... |
I am looking at a scenario for creating an aggregate instance from a trigger an a different aggregate.
I've incorporated some logic in my DDD and Event Sourcing with Onion architecture learning scenario around User Registration and creation of a User Account.
Currently I have a simple Registration class instance which ... |
Apologies if this is a repeat of an older question but I did attempt to find a similar question and didn't have any luck. I'm going through the tutorials at www.w3schools.com for writing XSDs and XMLs. I have a basic understanding of namespaces but my question -- why do many XSDs that I've seen contain a reference to h... |
Since I'm learning the MVC pattern, this might be a very naive question.
I know that when something happens on the view (e.g. user clicks a button), the view calls the controller which in turn updates the model (e.g. set a flag to true). However I can imagine some scenarios in which the model changes without user inte... |
Our company is in the early stages of starting to use microservices. One question that came up the other day was 'is scheduling/calendar a micro service'?
We have so many monolithic apps that have built their own calendar/schedule - some allowing appointments to be scheduled in the morning and afternoon and some more g... |
The background
In MVVM, we tend "not" want to couple windows to view models for various reasons. Though from the very second screen on your application you start hitting this conceptual grey zone.
The problem
You see viewmodals tend to want to open windows/Views (its just a fact of life). Windows/dialog APIs tend to ... |
I am developing a REST API which accepts JSON using Spring Boot. I use Spring Security for authentication. I have a use case where I have two services, one to test connection to a 3rd party system and other one to fetch data from the 3rd party system.
api/system/connection
api/system/customData
When I call the first ... |
As you know Facebook saves login sessions and we can see them in settings where we've logged in.
Now, they show IP address, Phone name (if logged in with phone) and App name in the phone and Browser name in case we use browser.
I want to store these info for my site using PHP and JavaScript. One way is to use inbuilt f... |
I am currently making a console program about buying property in a city. Properties can be bought from the city by someone, transferred to another person, or returned to the city if the person who has ownership dies.
I have created 3 classes: Person, City, and Property. My Person and City classes both have vectors of ... |
I want to create a mobile app(iOS and Android) for business need, ex: the business is Health and Beauty. So I need a mobile app for sale some goods and service. However, I need push notification to who is subscribe my topic like, health tips, magazine and new product etc.
So I plan to create:
Web application back-end ... |
I am new to programming, I have been trying to get my head around this.
Context
My project is about defining investment packages for various construction projects within a country based around an economy model. There are 5 regional models, and I am writing about a company working on the interface that will allow inte... |
I'm confused I use to build mobile app couple of years ago and I know that android is java I read some framework like Ionic HTML/JavaScript Framework that can export to mobile app. I going to have android projects soon and I will going back to java for mobile app, I'm at web development. I saw this that Ionic framework... |
I am working on a web app which uses Google oAuth flow and Drive API to list user's Google Drive files. With the access_type set to online, my app doesn't receive a refresh token.
My question is, once I receive user's data, which is just meant to be shown so storing in DB is not an option, should I store that huge data... |
I am researching cohesion topic and found out that some claim TCC metric should only include public methods, some other sources claim all methods. Would it be wrong to use either approach? Why private methods should be excluded, as some suggest?
|
This turned out to be a rather interesting problem contrary to my expectations.
Imagine a simple chat app, a user registers then can add other users to their contacts list and start conversations.
I want to be able to show in real time each user's online status (for simplicity just online/offline). The problem is how t... |
I'm still a beginner when it comes to domain driven design, and I am trying to model something like an RPG's battle system as a bounded context. I am trying to model a bounded context in which a Combatant has a list of abilities, and each Ability has a list of effects that it would apply. For example, a common Effect... |
I'm currently trying to create a system for a specific tournament but I can't figure out how to generate the matches table.
I have a tournament with <T> teams.
Each team needs to play vs each other team exactly once.
The tournament location has <M> fields which can be played on at the same time (Therefore limiting the ... |
I stumble across this case somewhat often, and I'm surprised about finding so few similar discussions around the web. This question is very related, but my problem is that I want a method that does the more general "do X if Y" rather than "do X if needed". The answer in that link is to use the prefix Ensure, but that w... |
I ask because I found no answer to this, maybe because is too obvious (I think there is no thing like "legally obvious").
Imagine that I make a small library (DLL) or a styling template (CSS) or whatever, and I want to make it public and open source (yay!).
Until now, I used to license these kind of things with GPLv3 i... |
I've been reading a lot of comparisons between NoSQL and SQL. I feel like NoSQL might be the way to go but I'm still uncertain. So here's my example:
I want to be create an inventory system. There will be user accounts with the usual details (email, username, etc.). Users will be able to create stores and lists. Stores... |
Writing a User object in Swift, though my question relates to any strongly typed language. A User can have a bunch of links (FacebookProfile, InstagramProfile, etc). A few questions around this.
Is it good practice to wrap links in their own object?
struct User {
var firstName: string
var lastNam... |
I am designing a state diagram for my software. I want to represent the following scenario
The application is in state X
---> (state X)
It can have two events/actions, eg. action A and action B
If action A is performed, it goes into the same state X and again action A and
action B are available.
But, if action B is pe... |
As an experienced software developer, I have learned to avoid magic strings.
My problem is that it is such a long time since I have used them, I've forgotten most of the reasons why. As a result, I'm having trouble explaining why they're a problem to my less experienced colleagues.
What objective reasons are there for... |
We get problems on production systems every now and then, most of which can't be replicated on dev/systest/uat for following reasons,
We don't have enough data on dev/systest/uat e.g. production has million rows... but our other environment only have few thousands
We don't have right data structures, depth of data etc... |
Subj. Atm I'm using Selenium and Python, but the same applies to any other scraping solution.
I'm wondering:
which of the options outlined below are optimal/recommended/best practices
if there are existing solutions/helper libraries, which keywords I should look them up by.
To stay objective, "optimal/recommended/be... |
We are building a new product in real estate space and the end users of this product are not so tech savvy. To have better user experience with our product, we want our users to find relevant things quickly and easily. Apart from a simple UI, a universal search bar seems to add value.
The search bar with auto-complete ... |
@Component
public class RepositoryContainer {
@Autowired
public CommentRepository commentRepository;
@Autowired
public ItemRepository itemRepository;
@Autowired
public UserRepository userRepository;
@Autowired
public PostRepository postRepository;
}
In this way, I just need to inject a ... |
Please see the code below:
public class Person
{
public DateTime DateOfBirth;
public List<Offer> Offers = new List<Offer>();
public Person(DateTime DateOfBirth)
{
int age = DateTime.Now.Year-candidate.Year;
if (DateTime.Now < candidate.AddYears(age)) age--;
if (age < 18 || age > ... |
Ok, I'm working on DynamoDb-based caching. We have an API where each call costs us real money and the information retrieved is "fresh" for 2-3 weeks, so it makes sense to cache it.
There's no problem with calling dynamoDbClient.get(apiUrl) and retrieving the stored JSON response. They have batches - 25 batch items ... |
I am developing a (Java) library providing an API to read a file in a specific format into an object. The format is basically a map, and specifies valid values for some of the keys, and valid types for values for others.
E.g., the value for colour may only be one of red, green or blue, while the key date must be provid... |
We had a discussion over this topic at the work not long ago.
We have the following situation:
A legacy database which is currently the base for the main operational application in our company.
A new content management system that should receive master data information from the mentioned database. That master data wil... |
What is the cleanest way to obtain progress from a class that will also be used in a no-gui environment for the purpose of displaying said status in a JavaFX Gui?
Example:
import java.util.ArrayList;
import java.util.List;
public class ExampleFetcher {
public List<Entity> fetch() {
final List<Entity> resu... |
For the simplification, I am talking here only about the time, invested into the project starting from the task being defined for developers and functionality being passed to testers.
AFAIK, the mostly used tool for support of the project management is JIRA now. Using it, we can find how much time was used for differen... |
Suppose there is a Page class, which represents a set of instructions to a page renderer. And Suppose there is a Renderer class that knows how to render a page on screen. It is possible to structure code in two different ways:
/*
* 1) Page Uses Renderer internally,
* or receives it explicitly
*/
$page->renderMe()... |
I'm part of a small team that currently uses an Access database for scheduling a larger team's availability. This has presented some issues with corruption of the Access database. Additionally, I want to implement additional functionality over time.
I've set out to create an application for the 4-5 of us to use that wi... |
I have a Report class that is basically an interface for creating HTML reports generated via a Python template engine. The Report class currently generates the report but also has a few methods dealing with retrieving/uploading data from S3. These S3 methods are mostly agnostic to what I would consider the core part of... |
How can we safeguard REST API to be accessed only from trusted clients? Let me explain the scenario, lets say there is an API which will be accessed from mobile application MA and web application WA. Besides these two applications, this API should not (and must not) be accessed by any other client.
Key Points:
I canno... |
I have a function/method which throws some exception when database is being called.
I was writing Junit tests and I was told to have good coverage. So, should I write Junit test which catches exception.
I think it don't make any sense, since I have to mock the database to do so.
So whole scenario will be like this:
pu... |
Is there an operator equivalent of nor? For example, my favorite color is neither green nor blue.
And the code would be equivalent to:
// example one
if (color!="green" && color!="blue") {
}
// example two
if (x nor y) {
// x is false and y is false
}
|
We have several ongoing projects and need to figure out the way to manage the repos.
The current situation is Project A is in production, in a SVN Repo A. Project B is in development for another client and is actually project A with some add-in features, in a SVN Repo B. So every time we have a fix on A, we need to wai... |
I can see several post where importance of handling exception at central location or at process boundary been emphasized as a good practice rather than littering every code block around try/catch. I strongly believe that most of us understand the importance of it however i see people still ending up with catch-log-reth... |
I am wondering how do big development teams do it, when they all work on one project.
Options are:
1 virtual machine in cloud that they ssh into and push updates via ftp ?
each developer have their own local virtual machine and updates are being controlled by git, when merged together by master branch on cloud?
any... |
I'm creating an application which, so far, has an identity service(using identityserver4), a front end, and a calendar service.
The user logs in via third party(say, google) and grants permissions to the application to manage their calendar.
When the user logs in, identityserver stores the access and refresh tokens i... |
Is there an automated approach to generate a grammar (which could be used later in a compiler tool such as ANTLR or similar) from given examples of a language?
With more detail:
assumed a technical language such as Java, C or (in my case) MQSC, and some source files of that language, is there an automation to derive t... |
I'm building a website where I plan to support multiple languages. Not only via UI, but via the content too.
I have several tables where I have text columns such as "title", "name", "description", "body" and so on. What's the best way to do so? Will I have to create an additional table for each one where I have text... |
Quick question, I've been digging into CQRS and Event Sourcing and there's one thing that I have not been able to find info on, what happens when your Write Service crashes and you need to start it back up? I understand how you can recover your Read Service by replaying the events, that makes sense to me. What I can't ... |
In my (primarily C++) development, I have long adhered to using out-of-source builds. That is, my source usually sits in a /project/src directory and the builds live in a /project/build/bin/release, /project/build/bin/debug directories. I have done this because it keeps my source directories clean from intermediate f... |
We're starting to work on microservices to rebuild our legacy application, piece by piece. We started by building a register module which is responsible for the whole register process.
To simplify, let's say the RegisterModule will use a CustomerModule to persist a customer, and then a PhoneModule that needs a customer... |
In Clean Architecture, Robert Martin talks about the necessity to "decouple the structure of the tests from the structure of the application". He notes that a test suite that has a test class for every production class/a set of test methods for every production method is deeply coupled, and thus fragile. He thus advoca... |
I'm currently building an app that includes sales promotions. There is an option in the promotion that allows the manager to have a start and end date. I do not want the manager to have to manually select the winner, but I want my software to read that the end date was reached and auto close the promotion.
This sounds... |
suppose I have code like this
someFunction:function(userId){
var url=SomeClass.SomeNetworkConnector.SOME_URL;
if(url !== undefined && userId !== undefined){
this.openURL(url+"?userid="+userId);
}
}
Initially I think the name of actual constant SomeClass.SomeNetworkConnector.SOME_URL is too long, so I use a v... |
I'm a CS student and in order to practice my coding skills I'm trying to implement an e-book reader and I want some advice from more experienced programmers. I'm using C++\QML but I'll try to keep my problem non-specific to any technology.
Small preface
Once the book opened I keep it in memory. I also generate an array... |
I need to call a method that is available in a third party library, but it is a private method. There is no direct or indirect way to obtain the same functionality via public methods available.
I could do this in at least two ways:
Copy paste the class into my source code tree (the license permits) and change the meth... |
Imagine a program which exposes a REST service/gRPC service/whatever service, which uses several 3rd party libraries. These libraries can of course throw exceptions if something goes wrong, for example if the user tried to access something which he isn't allowed to.
The problem here is that it isn't possible to check b... |
I have a couple of classes that are doing the same thing: filling a series of object using data sources passed as a parameter. As I need two distinct of them, my interface holds the following contract:
// Arbitrary names, didn't find a good name for the application field yet
public interface DataMapper<O> {
/*
... |
I am trying to figure out how to measure the relative success level of a given (but unsolved!) Rubik's Cube state. My first idea was to calculate the number of overlapping "cells" in the destination (solved) state and the given (unsolved) state, and present this as the following:
number of actual correct cell positions... |
Say that I have the following one-to-many relationship:
If I don't want to store any information about the relationship, I can simply put the primary key of School as foreign key in the Student table.
But let's say that I want to store the date on which a student has registered in a school. In this case, can I still p... |
What is the recommended way to reference other classes within a container class while keeping everything decoupled?
In the below example, I'd like to automatically add to the SceneGraph the constructed Path.
class SceneGraph {
constructor() {
this.children = []
}
addChild(child) {
this.children.push(chi... |
I'm building an Android application, and trying to follow the Clean Architecture pattern.
I am a little confused on what my entities should look like regarding some of my use cases.
Example
I have a list of channels, and each channel have programs.
I want to display a list of the current program for each channel, and w... |
I have some doubts with Agreggate Roots and working with Entities.
Imagine we have a Box object, which contains Potatoes. In this case and in a DDD point of view, the Aggregate Root would be the Box object, so in case we want to add Potatoes to the Box, we have to do it through the box object.
Now, imagine we have to c... |
I have several Oracle database where my in-house applications are running. Those applications use both dba_jobs and dba_scheduler_jobs.
I want to write monitoring function: check_my_jobs which will be called periodically by Nagios to check if everything is OK with my jobs. (Are they running? Is it Broken? Is next_run_... |
Background: there'a a gazillion types of virtual machines in Microsoft Azure each having different performance and price. Such virtual machines are paid per hour. The goal is to decide how to get "the most for the money spent". This can be also reworded in terms of electricity spent for a certain amount of computation.... |
After reading the book; I understood the following:
1) Entities should implement equality and compare by ID.
2) Value Objects should implement equality and compare by all properties in the class.
I still believe that my understanding of point two is correct. However, I am confused about point one because of the follow... |
We have a microservice that reads in large data files, each row containing information about Accounts.
For each record found, it will then go off and do other "stuff" and that stuff is distributed across other microservices. As such, we need to look at using correlation IDs to tie distributed transactions together from... |
I am looking to perform a large overhaul on a complex simulation system that simulates several instances of several vehicle models in a classroom training environment. For example, 24 students may be running simulations on three different vehicles for maintenance and operation. Instructors will be required to have ta... |
While reviewing some code, I noticed the opportunity to change it to use generics. The (obfuscated) code looks like:
public void DoAllTheThings(Type typeOfTarget, object[] possibleTargets)
{
var someProperty = typeOfTarget.GetProperty(possibleTargets[0]);
...
}
This code could be replaced by generics, like so:... |
Hopefully this is the correct channel for such a question and my quest for further knowledge.
I've currently built a significant platform which allows clients to communicate with our API, which in turns allows "items" to be pushed to a print queue.
Most third party developers and app users have no problem consuming the... |
I'm torn between using DI and static utility classes on my code.
I currently created a DateUtil static class that is only meant to be accessed statically. This class is responsible for just creating and manipulating dates using a variety of libraries with absolutely no external 3rd party dependency.
Everything looks f... |
I inherited a Visual Studio solution with a Main branch, a QA branch off of Main, and a DEV branch off of QA. It seems these are the only branches and they've existed for the lifespan of the solution. The solution has 5 projects, and in our new version I want to create a different behavior for one of the projects, but ... |
I hosted a hobby NodeJS Server from my Linux and all is fine by accessing my direct IP.
Because I find this ugly and also less secure, I decided to route my domain which is set to Cloudflare to my IP. Then as I access the URL, I was prompted with an Authentication that I had never set up.
The question is, why proxy-in... |
I have a python package that I wrote and I want to use it within multiple docker builds.
However, I can't just install my local package situated outside of Dockerfile folder. And I don't want to copy the package into multiple projects.
So how do I keep my architecture DRY?
|
Is it a good idea to have individual/unique data sets for each integration test or should all tests reuse the same data? My idea for having individual data sets for each test is to have more control for each test to make it easier to update old tests as well as implementing new data. Instead of making sure the new data... |
I was reading this question recently: ID properties on Domain objects in DDD
The question talks about having an surrogate key in the infrastructure layer, which is a database ID. I use a Guid for this:
Guid id = Guid.NewId();
The answers then talk about having a natural key in the domain layer that identifies the enti... |
I have a RESTFUL api, one of the endpoints is receiving search criteria which contains property for "Title".
Should I allow consumers to send either null (or eliminate the property) or Empty string in this property and deal with both as the same meaning in this context ?
I mean, for me I shouldn't do search with null, ... |
I have a unit test similar to the code snippet below, it should check that the AddUser method only allows unique emails.
My question is around the Arrange part of this unit test, I use existing system code to setup the first user (class UserLogic), this is so that I have a user in context to perform the next parts of t... |
Note
I realise this could be subjective question to answer, but I don't expect an answer in the form of "Do this and everything will work out". I am aware there will probably be some decisions to be taken and that different approaches are better for different scenarios. In any case, I would like a review of the pros an... |
I have a class Tiles that looks something like this:
class Tiles {
public:
void AddTile(int x) { tiles_.push_back(x); }
std::vector<int> tiles_;
}
Now I want to create a class Tiles with data, i.e.,
class TilesWithData : public Tiles {
public:
void AddTile(int x, double data) {
tiles_.push_back(x);
da... |
I have an address as part of my domain. The address keeps information about country, city, zipcode, street and housenumber. It is used in multiple places - a company can have an office address, invoicing address and/or correspondence address; transports have addresses at start, middle and end points; couple of other pl... |
We have
int i;
which have 4 bytes lets have address from 1000 to 1004.
if we declared a pointer
int* p;
p = &i;
now is the pointer holds only 1000 or from 1000 to 1004?
The pointer holds the addresses then why we need to declare a datatype to a variable?
when we declare a datatype to pointer, can a pointer can be ... |
In my project I have some constants where I reference almost everywhere:
public sealed class Constants{
public static readonly int MAX_QUAL { get; } = 1080;
public static readonly bool CC { get; set;} = false;
}
Is it a good practice to store these values in in the application code itself, similar to the snipp... |
I was really glad that ES6 introduced the let keyword for defining variables. var scoping rules can lead to all kinds of issues, especially when working with loops and event handlers. Even when programmers used var in the past, they still almost always expected let scoping rules.
Variables declared with var are availab... |
I'm currently developing an application using reactive programming. Every entity creation or modification in the system publishes an event and no two entities can be created/modified within the same use case.
In this situation, there are entities that have to be created based on specific states of other entities. For e... |
I need to implement a class hierarchy and be able to implement it in multiple ways.
I want to create a logical representation of a query language, and then be able to parse it to/from different formats (XML, JSON, YAML, etc), and switch between them.
I tried to start with the classes below (Logical Hierarchy) to repre... |
I'm trying to figure out the best option to mark a database entity that could be closed manually or automatically. This entity already have a status that accepts OPEN or CANCELED.
Now, I would like to "close", but the close action can be manually or automatically, and I will need this information in the future to know ... |
I'm writing a really simple interpreted object oriented programming language with a C-like syntax. I've been looking into type inference and I've found a few implementations of the 'Hindley-Milner Type Inference' system.
Most are in functional languages, which I can't read, but I found this one written in Python that ... |
As an example, say you are writing an app in Java.
Your app communicates with an API server written in Python.
The Python server communicates with an SQL database.
You also have a website for your app written in JavaScript.
With 4 different languages, it's easy to end up repeating essentially the same data structures 4... |
In a nutshell what I need is a simple good practice for multiple (loosely coupled or tightly coupled), git repositories
I would love to hear there is a good framework for that, but I have read a dozen other s.exchanges threads and most simply give a compromise solution, and only one suggested "have a good practice" ..... |
I am storing information about Widgets in my database, and each Widget has one (non-unique) transformation function associated with it. My problem is how to associate Widgets with their transformation function.
My first instinct was to use an enum for the transformation function. I am using sqlalchemy for my database O... |
Is there a way to implement the traveling salesman or purchaser algorithm with constraints between locations? For example, I have to grab item X before item B, c before D and F,G,H in any order.
|
I'm in the process of designing a server responsible for serving files that are between 10MB and 50MB in size.
Initially we will run two instances of the server (lets call them fs1 and fs2), with future plans to switch to a micro-service architecture, where the server instances will grow or shrink depending on the load... |
We all know that Scrum works very well for a traditional team where team members come into work each week/sprint, agree goals and meet commitments.
However open source projects are often very different:
People tend not to work on Open Source projects full time
While some projects have a group of core contributors many... |
For example, if I have a game which have some components, which has Player and Enemy,as well as the parent container,Game, e.g.:
Version 1:
public class Player{
private int hp;
private Label hpLabel();
//some other properties
}
public class Enemy{
private int hp;
private Label hpLabel();
//som... |
Say I have a data model, which looks like this:
public class DataCustomer
{
public virtual System.DateTime CreatedTime { get; set; }
public virtual Guid Id { get; set; }
public virtual string FirstName { get; set; }
public virtual string Surname { get; set; }
public virtual string FaxNumber{ get; s... |
While working on a web (JEE based) application I saw some different ways people have instantiated loggers in different classes. First way is classic way like,
private static final Logger logger = LoggerFactory.getLogger(AbstractPersistenceObjectDAO.class);
but as JEE applications are CDI enabled in some managed classe... |
My understanding of story estimation has been that one should estimate the size of a story as it would be for an imaginary, average developer — a bit like the "reasonable bystander" concept in law. That is, you should not estimate the story's size assuming you have to do it.
To give an example: in my previous job I wa... |
The Eclipse Scala IDE (and Intellij Idea, too) has, together with a standard REPL CLI, an artifact named Worksheet, that works like a persistent REPL log: the whole file is compiled and executed at save time, and the results are in-lined as comments. It is a great tool for API exploration and design, and initial testin... |
I'm currently working for a company that uses VSTS for managing git code. Microsoft's "recommended" way of merging a branch is to do a "squash merge", meaning that all commits for that branch get squashed into one new commit incorporating all of the changes.
The trouble is, what if I do some changes in one branch for ... |
Assuming that the entire product team has agreed that implementing some automated end-to-end tests* is worthwhile in the first place... By what criteria should the workload of implementing automated end-to-end tests be distributed between developers and dedicated QA (automation) engineers (or some other role)?
*I'd pre... |
When planning our database, we ended up with a setup like this:
We have Company, Product and Person.
There is a many-to-many relationship between Company and Product, through a junction table Company_Product, because a given company may produce more than one product (such as "car" and "bicycle"), but also a given produ... |
I am trying to figure out the best way to keep objects in memory without having them scattered everywhere within the code.
For example: I have a PyQT menu system which interacts with objects. Currently, these menus are able to create and modify an object by hitting code outside of their menu-related files, but afterwar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.