instruction stringlengths 34 36.1k |
|---|
The big image is catalog or ad blocks that comes from catalog table. And small images are the actual products block that comes from product table.
There may be more products and more catalog. attached image is just a layout sample.
Please refer the below image link for layout.
https://i.stack.imgur.com/f4KxN.png
|
I have a set of types that can be customized by formatters. A formatter is a function object defined as Func<string, string, string>. Client of a library may than choose to implement FormattedLoggerBase with one of formatters provided or write new one.
public abstract class FormattedLoggerBase : LoggerBase
{
... |
Studying Inter Processes Communication in Operating System, I've discovered that asynchronous communication can be built on top of synchronous communication. But, it's not clear to me how can it be done.
Can you explain to me ? :)
|
In one of my projects, I had to name some variables and functions that belong to the person using my app. I named them userCard, getUserInventory() and so on. I named them like that cause there were variables and functions that belonged to other persons, like opponentCard, getAllyInventory() etc.
Now, I have a model cl... |
Let's say you have a permission system with which you can specify things like: user U is a member of group A, which is a subgroup of group B, which is a subgroup of group C, and all members of group C have access to object O. Then, you can query the system like: "does user U have access to object O"?
As far as I can t... |
Recently my team has inherited a code-base with an interesting problem.
The system keeps historical records by having multiple listeners on the same event. These listeners execute serially, so if we have listener A, B, and C, B would wait for A to finish first before C and so-on.
Each listener updates a separate table... |
Currently we are debating over securing our multiple micro-services.
The major concern is that the JWT token provided to us will expire before the call is finished. (This is in the synchronous design)
Here are three proposals:
Client App has an 'ensure(int minutes)' method before lengthy calls, calling token provider ... |
I'm trying to figure out is there a common name for object's interface if our intent is to show that this group of objects has date of creation and tracked dated of last modification. It is an entity in DB.
Have thought about IHasModificationDate and ITrackable. But I'm sure that other programmers outside of the soluti... |
My team needs to design an API which sends objects to a queue in the cloud and retrieves objects from it. The data is inserted into the queue as byte[].
We have 2 ideas until now which I would love to hear your notes/ideas about them:
First version:
public void push(String object)
public String retrieve()
Notes: To s... |
I'm struggling a little bit with Domain Driven Design because there are so many names and concepts to grasp.
Today it striked me to know what is exactly the difference between an 'application service' and an 'use case'. Are they the same thing?
|
I'm working on an MVVM project and trying to preserve separation of concerns. Our current architecture has an entity framework model and MVVM light view and viewmodel projects. I'm working ViewModel first so I'm passing those around with a datatemplate in the view project to get the proper view.
Having to type chec... |
The application I'm developing requires that some data is obtained through different channels. As this is a network process, I have decided to use async programming.
I have designed the following interface to represent all the possible channels:
public interface IMyDataChannel
{
Task<MyData> GetMyDataAsync(/* param... |
Developers create scripts to help in their work. For example, to run Maven with certain parameters, to kill unneeded background tasks that crop up in development, or to connect to a certain server. The scripts are not core build scripts nor are they used in our Continuous Integration server.
What is the best way to man... |
Please see the class below:
public class Customer
{
private readonly IList<Order> _orders = new List<Order>();
public string FirstName { get; set; }
public string LastName { get; set; }
public string Province { get; set; }
public IEnumerable<Order> Orders { get { return _ord... |
I currently have a website, made of about 20 micro-services and a (still too large) main monolithic web application. The monolith and multiple micro-services each run queries to the same database, each time having to deal with login to the DB and formatting/running the queries.
I may switch our databases from SQL to N... |
When you use the concept of polymorphism you create a class hierarchy and using parents reference you call the interface functions without knowing which specific type has the object. This is great. Example:
You have collection of animals and you call on all animals function eat and you don't care if it is a dog eating ... |
We are developing an application where providers can offer their products and consumers can buy them (sort of marketplace). We try to apply DDD concepts into our model design and the implementation follows a microservices style. This implies that the data belongs to a Bounded Context (BC) and only the microservices wit... |
In the Wikipedia article for “tracing garbage collection”, the following claim is made:
...most modern tracing garbage collectors implement some variant of the tri-color marking abstraction
In this abstraction, objects are grouped into three sets: white, black, and grey. The basic tracing algorithm enumerates all the... |
Consider the following command-line program manage-id. It does these things:
manage-id list (list all usernames and user-ids)
manage-id show <username> (shows username's id)
manage-id clear <username> (erases username's id)
manage-id set <username> <user-id> (sets usernames... |
I'm looking for information on the best approach to message validation in asynchronous-messaging-based services (i.e. services that pull messages from some sort of message queue or broker, rather than providing an HTTP-based API or something similarly request-response oriented).
In an HTTP API, if the message is invali... |
I am designing a system to receive data from various types of sensors, and convert and then persist it to be used by various front-end and analytics services later.
I'm trying to design every service to be as independent as possible, but I'm having some trouble. The team has decided on a DTO we would like to use. The o... |
I am writing gui application. I want to implement following structure:
project tree with nodes of different type and behavior (i.e. when right clicking or selecting there can be different menu options)
Editor window, which can be dynamically splitted vertically and horisontally, to add more edit areas. Each edit are... |
What kind of NoSql data modelling is best suitable for the following requirement?
This can be visualised (NoSQL-Document) as a Collection of Records where each Record contains nested Documents.The nested document entities at different levels are either flat or tree structure based. A Record is structurally a single en... |
I'm writing a reusable library, and I'm looking for a way to handle the exceptions that might occur during the processing. For example, I have the following class:
public interface IObjectFetcher
{
public IObject GetObject(int objectId);
}
public class WidgetFetcher : IObjectFetcher
{
public IObject GetObject(... |
Note: I use term "resource" in opposition to memory here, resource here is file, socket, etc.
Is there a language implementation that uses M&S GC (but not necessarily only that kind ¹) that is able to automatically free the resources (like file handles)? If yes, how it is done?
By automatically I mean that user can mar... |
I am writting a module where i am creating a rate for a list of product, and the rate for the product are assigned to different Store.
The rate can be created in a group of Store, with Multiple Store, and Individual Store.
As shown in the image Below.
a. Group of Store
A Store group is selected from the list of group.... |
By theory please correct me if I am wrong, it says that an int can take upto max 4 bits in case of number 9.
I haven't coded it low level languages but I assume that the datatype int in c and python shouldn't be different.
I want to know what is the reason that in Python an int is taking 24 bytes
Also if someone can e... |
The most obvious criteria for me is for component re-usability, as well as internal state management but aside from that are there are any other good reasons?
For instance, I could have a component called ArticleFeed.js. Within ArticleFeed.js I could have a child component known as ArticleFeedItem.js OR I could just ha... |
I don't have a particular coding problem on hand this is just an excercise to improve my thought process.
Few months back I started learning about functional programming( mostly in R) and I fell in love with it.
Once in a while I try to think of problems that might be(correction: that I might find) difficult to solve i... |
Under the REST architecture principles, a RESTful application should be stateless, therefore each time I invoke an ASP.NET 4 REST service (with GET verb) that pulls tens of thousands of records, the REST service paginates them with in chunks of 10 (with OData v4), which makes the UI lightweight because it only loads 1... |
This question has been asked quite a few times on StackOverflow and I would like to get an understanding of the concepts and process rather than directly solve a problem. I found the following post where the explanation was nicely detailed but have some follow up questions which I hope someone can elaborate on.
video s... |
What is the best practice for REST API call from and device (Android, iOS). I am getting extra parameters/fields in JSON response, while calling an API. Throughout the the application there are several API which contains extra params in it.
Should I ignore the extra params or I rectify my API for less needed fields. Wh... |
We're using a similar concept to Event Sourcing to store the data/actions of a collaborative system we have running.
The system has some 2-3k users that use it daily and it's growing.
As time goes by, the codebase evolves and the data we already have stored needs to be updated to match newer formats. This is a rare sce... |
I have several objects that implement an interface, and several repositories that perform CRUD operations these objects.
I'm given a GUID and I don't know which class the object is, but it's in one of them, and am using the repository to get the object by its GUID.
The repos return different types.
class Obj1 : IInterf... |
There are several posts and other contents in the internet that claims against naming classes ending with "er" (like manager, controller, helper...). I personally agree with that, but what alternative names could be given to MVC controllers in the scope of web development? I came up with "entry points" or "end points... |
What would be the right way, according to the Middle-ware paradigm/design pattern to transfer resources (like connections to some IO devices).
It is not part of the Request, and it is definitely not part of the Response.
Is there a third object each Middleware step transfers to the next step in line?
The specifics of... |
We use Selenium webdriver + SpecFlow for testing our Web application.
For some functionality, everything is clear.
But imagine the situation: some questions arrive to Web user from external system he may answer. The test should "test" if the user can see those questions in appropriate view and successfully submit some ... |
In Android Framework there is a string.xml file that houses all the strings for the application.
This allows for easier re-use and possible internationalization. My question is, is there any precedent/good reason of doing this in a web application?
|
What are the differences between a demo and a prototype in software engineering?
My research taught me that a prototype is typically the minimum viable software needed to allow users to test its functionality.
Please provide an example to clarify the differences.
|
I am trying to refactor a large and complex application to use DDD principles as and when I get time.
I have a class, which is completely isolated from the domain (it is only used by an application service) but part of the ubiquitous language. It looks like this (an old version of it):
public class CurrencyCalculato... |
Let's take two simple Rails models, Post and PostRevision.
class Post < ApplicationRecord
# Attribute: Status (ex: draft, public, private, deleted)
# Attribute: Views
# An owner, likely a belongs_to relation. Perhaps a has_many relation.
has_many :post_revisions
validates :post_revisions, :presence => true
... |
Context
Suppose I program a blockchain which doesn't require proof-of-work and deploy it on 3 servers A, B and C.
Now suppose server A and B receive requests to insert a new block with some data in the blockchain. Both A and B modify their local copies of blockchain. Before the modifications, the local copies of the bl... |
I have an ASP.NET Core 1.1 application which uses dependency injection and is splitted in 3 layers (web, business logic and data access).
I'd like to access to some values of the configuration file in some methods of the business logic layer. Which way would be more correct to keep a clean architecture?
Pass the confi... |
I have a resource that can be updated in two different ways. I will try to explain using an example.
Lets say that each Person is assigned a Task. So to update the task, I have
PUT /people/{personId}/task
and I send the task details in the body.
Now I need another endpoint to update the task assigned to a person. Thi... |
My coding style for nested function calls is the following:
var result_h1 = H1(b1);
var result_h2 = H2(b2);
var result_g1 = G1(result_h1, result_h2);
var result_g2 = G2(c1);
var a = F(result_g1, result_g2);
I have recently changed to a department where the following coding style is very much in use:
var a = F(G1(H1(b1... |
You know how it goes: there is some small repetitive task for which you found a way to quickly automate 95% of the work. You create a script, run it, manually fix the output, and you're done. Of course you don't commit the script, as it doesn't match the company quality requirements (it doesn't have documentation, nor ... |
I'm working on an application which contains an element that needs to make several http calls in a set order, to perform an action successfully. (Interfacing with an external system's API.)
We have written code that is functional, but struggled when trying to write appropriate unit tests to cover it (not least the HTT... |
I have an app with an optional login where some functionality requires the user to login.
When checking if the user is logged in I use a framework that runs an async function that requests an access token from the keychain or our server (depending on if the token needs refreshing) with a completion block telling us wha... |
From a REST API, we write to the database. We want to store who was the person that triggered this change. We have this information at the controller layer. The saving happens at the repository layer (We use spring boot, and have a service layer in between for business logic).
How can I stop leaking the auditing inform... |
Maybe I'm not the first to ask this, but I've searched up and down the stack and I am yet to get an answer to my question. I have learnt CSS, and I also have a basic idea of the C programming language. While learning C, the syntaxes and the way it is coded strongly reminds me of CSS.
For example:
Comments both in C an... |
This question follows on from my other question here: How does an isolated class (or group of isolated classes) fit into a Domain Model?
I have looked at a few domain models online:
https://github.com/vkhorikov/DddInAction
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.DomainModel
https://git... |
I understand the rationale behind why most of the HTML character Entities were created, but I don't understand the purpose behind the ampersand HTML entity. & contains more bits than a & symbol, and it even has the & inside it already!
Why was it decided that ampersands should be encoded in the format that require... |
Among other things, the CQRS has a rule that each of the methods has one responsibility. So we can't have this in the model:
public class Store {
public Item getOrCreateItem(int id)
{
//logic
}
//....
}
and this in the controller:
Store store = new Store();
Item item = store.getItem(1);
We m... |
I have a general question pertaining to Cyclomatic Complexity. Please have a look at the attached source code:
private void downShift(int index)
{
// index of "child", which will be either index * 2 or index * 2 + 1
int childIndex;
// temp storage for item at index where shifting begins
Comparable temp... |
I have a huge set of over a million numbers of variable lengths.
['773', '2267', '8957251', '170597519', '373590109', '982451707', '999999937', ......]
Now given a bunch of digits, say 3 and 7, I intend to create a subset of all numbers which contain those digits. That is:
['773', '373590109', '999999937', ......]
Th... |
I am trying to implement clean architecture (https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-architecture.html) on an Android app.
As an example, let's say that all the app does is monitors a user's CPU temp and displays a hourly and daily average. Data is stored on the device and periodically downsampled. The... |
Java provides methods for saving data permanently. An object that has to be saved has to implement the interface Serializable. But there is one problem with Java's object serialization: The objects can not be changed. If I open such a file, i see some cryptic symbols. But sometimes I also want to change the data outsid... |
Suppose I have an application that accepts an arbitrary stream of objects. Some of those objects appear multiple times in this stream. The job of my application is to filter out those duplicate objects from the stream and pass a duplicate-free version of the stream to the next application. This is usually trivial, but ... |
Some time ago I had to code review a unit-test fixture like this one (C# code):
public class ServiceFixture : Service
{
[Fact]
public void Test_DoSomething()
{
Assert(DoSomething(), SomeExpectedResult);
}
}
So Service is the SUT, the class under test, and ServiceFixture is the test fixture. And... |
I have member function that looks like:
Point find_the_special_point(Image img);
However, this function may fail to find the point (for example the img does not contain a special point at all).
What is the right way to make the function return in some way that the point was not found?
I thought of some solutions but n... |
I have setup a docker-based development environment having the following images as you can see in docker-compose.yml:
version: '2'
services:
phpBB_dev:
build:
context: .
dockerfile: Dockerfile
args:
XDEBUG_HOST: 172.17.0.1
XDEBUG_PORT: 9021
UID: 1000
GID: 1000
image: 'pcmagas/p... |
So, this is going to sound like an accounting question, and on top of that might be a little too opinion or discussion-based for Stack Exchange. But we've been going back and forth on this a little bit so I'm curious to know what the dev community thinks.
If you're building an accounting system, obviously at some point... |
I'm building a WCF service project. It has a few layers, like Data, Business or Hosts. I usually also added "Clients" folder and "Proxy" project inside. So that anyone (who wants to use my service) can reach out to the repository, grab Proxy project and adds it to his own project.
Does it make any sense? Is Proxy class... |
What in your opinion is good practice to handle the case where I want to have re-usable and shared logic that collects and returns my data from the database?
For example I have Multi Page Application and one day I decide to make Single Page Application out of it. I don't want to re-write much.
This brings up the ques... |
public static Func<string, Task<T>> MyMethod<T>(
UserCredentials credentials,
Func<string, string, string, Task<T>> func
) =>
async (value) => await func(credentials.user, credentials.pwd, value);
I'm having difficulty discerning the purity of the function, because obviously T(int) resu... |
How can I measure ActiveRecord's performance?
My query has where and an order by clause, and on top of that I want the top row:
User.where(…).order(id: :asc).limit(1)
Knowing that the order by forces the parsing of the whole table, how much of a performance gain can there be in using .limit(1) as opposed to use [1]?
|
I'm trying to get my head around DDD but I'm stuck.
This is how I setup my project:
Data Access Layer
-Entity models that map to the db
-Db connection stuff
-Repositories implementations
Domain Layer
-Models that represent the DAL entity models
-Repositories interfaces
Application Layer
-MVC application that us... |
I receive sensor data as a binary stream of bytes. This stream is not always the same length, and does not include the same data set each time. If the sensor did not send a field, it is simply absent, not null. The first 62 bytes of data is always predictable, but after that it's all up in the air.
However, the messag... |
I develop an open-source project. According to this webpage, you should increment the "MINOR version when you add functionality in a backwards-compatible manner".
Suppose I'm developing two distinct features in a backwards compatible manner. Should distinct features always be part of separate releases, or can they be b... |
Many of Laravel's build-in framework libraries use closures as arguments. What is the primary purpose of this coding style? Is it just to gain more control over the configuration of the function, to use "functional style", or does it provide dependency inversion of some sort?
I'm curious because I wonder whether I sho... |
I am designing redux actions for a user signup. Signup process requires three entities to be created User, UserProfile and an Offer and involves side effects to handle async server calls.
I wonder what actions should be introduced to make them clear, readable and not overcomplicated. The minimum set of actions I can t... |
So I've got this java assignment for college and was just wondering if anyone here could give me some feedback as to what I've been thinking some of this means.
I've got a .csv file with building details - Here is a sample of the data I'll be working with.
Now part of the assignment states -
Entries in the building... |
I have this application containing 2 parts:
User-facing SPA web served by Apache
NodeJS API server
When a user go to the SPA web, Apache will do authentication and prefetch data for that user by making a POST and a GET request to the API before serving the page. This works fine for normal days, but it is pretty slow ... |
I'm trying to understand the implications of structural typing vs. nominal typing. From reading, I've managed to gather that one of the key advantages of nominal typing is the ability to declare an interface that can be used with third party libraries where you can't edit a class declaration to add an interface. Unfort... |
Let say I have an Apache server that needs data from external API before serving the page. I wonder if there is a limit of requests an Apache server can make and wait for response. Or does it depend on the physical server?
|
I have a Circle class and a LineSegment class, and I want to implement a method that returns two points (or one, or none) for the intersections.
How do I know which class to put this method in? Would a separate "middle-man" Intersections class be better?
|
I am confused on how to apply DDD principles for the design of domain entity clusters with Aggregate Root. According to my understanding, Aggregate Root enforces business validations and all entities within that aggregate should be accessed from its root. But this is leading to a huge aggregate of linked objects.
To g... |
This is a systems architecture question.
I'm in the process of planning an online platform that will collect people's medical information. Because of the extremely sensitive nature of the data being submitted, I want to ensure complete anonymity.
A profile would be created that would contain all of the data, but none ... |
Suppose I have an application written in C++, which uses WxWidgets (or some other library) for gui. When an end-user installs my application, how do I make sure they also install the necessary dependencie(s).
Should I include the source/header files for the library within the download, such that they get compiled with ... |
I'm working on an application which can be added to third party websites. This means that this app runs in the browsers of the users of a third party and I don't have control over what runs in their server.
My problem is that my app needs to load data from my own server. How can I secure my server so it does not leak d... |
I am trying to decide whether BDD is suitable for my project or not. I was reading about BDD here: https://en.wikipedia.org/wiki/Behavior-driven_development and here: https://agilewarrior.wordpress.com/2015/04/18/classical-vs-mockist-testing/
In the first link BDD is described as outward in, which is supported in the ... |
I'm beginning to sketch out an automation rules system (e.g. letting users define "when X happens, do Y"), and I'm not sure how to monitor for triggering of those rules.
How do apps like, for instance, an email service provider handle that? With ESPs, you can often define arbitrary criteria, and when those criteria are... |
I am trying to write integration tests for a client-server app. The client app runs on a user's machine and connects to the server app running on a specific Windows server, network-serverA. The server app also accesses files on a different network server, network-serverB.
In this post, the author mentions that integra... |
For example, lets say I have this class:
public class Account {
private String username
private String email
private String phoneNumber
private String zipCode
private String website
}
Each of these fields could potentially be separated into their own class:
public class Account {
private Userna... |
This is similar to: https://stackoverflow.com/questions/1278831/unit-tests-in-production-release-code# but more specific.
At the moment the DLL I ship and the DLL I use for unit testing have different access. When doing unit testing, since I test each individual functions/classes, I add __declspec(dllexport) to functio... |
Is it common to use "timestamp" to mean with time zone and "datetime" to mean without time zone?
|
Is it better to unit test using a mock library like 'nock' (nodejs) or to just test the server's http requests directly?
Here is an example of my Express server test for testing if my server is up and testing for yelp data being served from my server.
test.js:
describe('Express server', () => {
let request;
befo... |
I've recently learnt about "NewSQL" databases like:
Google Cloud Spanner (proprietary)
Microsoft Azure Cosmos DB (proprietary)
CockroachDB (open source)
also see How does CockroachDB compare to MySQL or PostgreSQL?
also see How does CockroachDB compare to Cassandra, HBase, MongoDB, or Riak?
VoltDB (open source)
I... |
What should a constructor contain?
In both cases, all three arguments are needed for the class to work.
Which approach is better and why?
1)
class Language {
LanguageRepository languageRepository;
Language(LanguageRepository languageRepository) {
this.languageRepository = languageRepository;
}
public void... |
I'm writing a library to be used by several applications.
Some interfaces which my library declares and uses, and which are implemented by the application, look something like this:
interface IOpaqueHandle : IDisposable {}
interface IPaintFactory
{
IOpaqueHandle Create(string configData);
}
interface IPainter
{
... |
Reading this:
https://renenyffenegger.ch/notes/development/web/URI-URL-URN-IRI-URC
URCs provide a set of attribute/value pairs that describe properties of URIs like authorship, publisher, copyright etc.
Is that synonymous with the query string found in here:
https://stackoverflow.com/questions/ask?authorship=foo&publ... |
As the title explains the question, let's assume that we're using versioning as major.minor.revision.build. What should the initial version of a software build be? 0.0.0.1 or 0.0.0.0 or anything else?
|
I've been reading/watching a lot of Robert C. Martin content. I've come across him saying SQL is unnecessary because of solid state drives. When I search other sources to back this up I get a bunch of random articles describing the difference of SQL performance between hard drives and solid state drives (which is relat... |
From AWS documentation:
A Kinesis data stream is an ordered sequence of data records. Each record in the stream has a sequence number that is assigned by Kinesis Data Streams
I don't see any connection between those 2 sentences. Also, the documentation doesn't explicitly specify what type of ordering it is.
After a s... |
I am not from a IT background. An idea is generated is being worked upon now. Initially we started with Waterfall methodology and now using agile. Want to understand how exactly this agile methodology works. Please don't consider my questions in a wrong way. Request for your inputs.
There is a bug found in between of ... |
Background:
There is a UI Client and REST Webservice.
The user interface form allows you to create a complex object.
The complex object is composed of primitive types (string, integers,...), and nested types (reference types). Each of the nested types is accessible through a REST resource endpoint as well as the comple... |
I'm trying to find a way around the integration of Google and Facebook login for an Android application using the Clean Architecture.
My application has 3 Android Studio modules :
presentation : contains the Interface Adapter layer of the Clean Architecture (Presenters), along with all my UI (Activity, Fragment, Cust... |
Downcasting means casting from a base class (or interface) to a subclass or leaf class.
An example of a downcast might be if you cast from System.Object to some other type.
Downcasting is unpopular, maybe a code smell: Object Oriented doctrine is to prefer, for example, defining and calling virtual or abstract methods ... |
I have a question about best practices given the following scenario.
Requirements
There is a daily process that has two steps:
Query configuration data across dozens of database shards
Perform many intensive jobs based on that configuration data, across a cluster of applications
The first step is lightweight and can... |
I came across this SESE page: What is a proper use of downcasting? (for C#) -- and it talks about when to downcast, and the possible downsides to it.
In Python sub classes are slightly different
Example:
Suppose I have the following abstract class:
from abc import ABCMeta
from abc import abstractmethod
class Weapon(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.