instruction stringlengths 34 36.1k |
|---|
For binary operators we have both bitwise and logical operators:
& bitwise AND
| bitwise OR
&& logical AND
|| logical OR
NOT (a unary operator) behaves differently though. There is ~ for bitwise and ! for logical.
I recognize NOT is a unary operation as opposed to AND and OR but I cannot think of a reason why the des... |
In C#, if I hide away implementation behind a facade, or the "pimpl" pattern, does the compiler optimize away the intermediate function call if all it's doing is calling an equivalent method from another class with the same parameters?
This is with dynamically created classes.
For example:
class A
{
internal bool P... |
Let's image we have a multitenant(organization) application having a separate database per tenant(organization).
The core of the application is a REST api service protected by an authorization server, in this case Identity Server 4.
For administration purposes a user can login into an administration panel with a usern... |
I´m creating my first eshop / CMS based on DDD / CQS concepts. I want to create application using BoundedContexts separtion as modular monolith at the first stage and maybe latter extract some BC as MiniServices.
I Want to ensure that I´m going the raight way, so I prepare Architecture diagram.
Diagram:
As you can see... |
Maybe this question is a duplicate. However, I could not find a suitable article in my research. If you know an informative, comprehensive article about this topic, please send it to me.
I want to reuse and centralize the utils I created for my Spring REST API for my future projects. That's why I thought I'd outsource ... |
hey i have a difficult question.
class DatabaseHelper
{
Database db;
String defaultShema;
public DatabaseHelper(Database db, String defaultSheme)
{
this.db = db;
this.defaultShema = defaultShema;
}
public void databaseOperation1(String selectData, String FromData, String whereD... |
Maybe that's simple, but I'm a little confused.
I have such a Ruby code:
def my_function(found_objects)
# ...
if found_objects.second
return CoreObjectFactory.get_object(found_objects.second, found_objects.first)
else
return CoreObjectFactory.get_object(found_objects.first)
end
# ...
end
I left retur... |
I really like keyword arguments because it helps me see what the variable actually is... on the other hand, often these variables are not optional, and kwargs are by default optional. How do use keyword args for mandatory variables, in a clean way?
|
Is it a good practice to have a list containing objects of derived types and then filtering it by type checking when need to call methods specific for one of the types? From what I read typechecking is some kind of code smell and it indicates that OOP isn't fully used.
I use common list for object of all subtypes becau... |
We have a pretty big monolith. We're currently looking at carving it up into micro-services.
Right now we have a file server micro-service (FS) that handles delivering files to clients based on certain criteria.
FS has it's own database that contains meta-data relating to each file. So when a client requests a file ... |
In my team, we are maintaining a monolithic application that was started in 2003. It is written in Java and has seen several successive layers of technical changes, growing to a hefty 400k-line application.
Recent business strategies decided by the brass now require that we move to containers. The goal is mainly, if n... |
So I'm trying to figure out exactly what my aggregates/aggregate roots are in my structure, and can't seem to wrap my head around it.
Database contains the following tables:
SALESGROUP
ID
NAME
ITEMNUMBER
ID
NUMBER
SALESGROUPID
DEALER
ID
NAME
BUDGETHEADER
ID
DATE
BUDGETVERSION
ID
... |
I have got a project in C++. Each of my classes has a method void assert_good() const. The usage of that method is solely for debugging purposes: if the object is an inconsistent/impossible internal state, then assert_good(); will make the program abort and leave an error message. Other than that, assert_good(); has no... |
I'm working on a web app where users enter a "room." The state of these rooms is loaded in the server's memory at all times, and is synchronized with the clients via websockets. What's the best way to handle rooms when there are multiple instances of my web app?
Should I...
A. Have some kind of load balancer that knows... |
I have started working with a team, in a scrum master type role, who has been using JIRA for a kanban type framework. Over the last 6-12 months, they have used JIRA to enter pretty much everything they do. This includes tracking whos on call, any HR/personal tasks like training and setting personal development goals fo... |
It’s a bit hard for me to wrap my head around an API that isn’t a web service.
I am sure they exist, because even as I use my phone, I’m sure the developers didn’t need to specify how to use the keyboard to display the letters, they just know they wanted to use it.
So my question is, can someone give an example maybe c... |
I have an ecommerce website wherein as soon as a new user comes on website then a new visitorId gets generated for that user in database and that visitorId cookie gets stored in his browser and in memory session of server. In his subsequent journey over the website we use this visitorId to map and store any information... |
I'm implementing an application that's made of bunch of microservices. Each of them is fairly simple, focusing on its own task. Let's call two of them Service A and Service B. They are both implemented in NodeJs and expose a Rest API. Now I need to run couple of cron jobs (some at 1m interval, others at 5m, 1h and so o... |
I have an entity with around 20 properties. Following DDD, I want to make setters private and allow mutation only through methods, since there are some rules I have to check.
But how should these entities being created? Should they have a constructor with 20 parameters? Should I create an intermediate writable entity t... |
So currently I looking for some hints from more experienced programmers. I am in the point where, when looking into my code it seems not readable, what is probably big flaw. So lets go to the code itself:
In one the classes I have method:
protected void createModelsCharacterisitcListGroup(Map<CharacterType, Map<Str... |
Let's consider the following scenario. I need to access a resource hosted on server X. I want to get this resource in a Y format, so along with my request I send the Accept: Y header. Unfortunately X does not support Y and I'm not not allowed to access the resource on X as well. I've included valid Authorization header... |
At several companies the term "game day" is used to mean testing functionality of a product in a production (or similar) environment. Specifically, testing a that an intended mechanism works as expected.
An example would be shutting down a master database and see that the replica database is being used instead.
But why... |
I am building a service that is servicing a lot of audio files. The issue is that I need to keep a record on what files are being accessed. My initial thought was to use BackBlaze B2 with CloudFlare but I don't really know if I will be able to get statistics out of this.
Do you have any general advice for someone that ... |
I am working on software which supports different hardware device generations. With each software release all device generations are supported, what means that each device generation is also tested.
To avoid huge amount of test we want to freeze development oft he HW layer for some devices, but continue to add function... |
Developing a SPA (with VueJS) that is talking to our own REST API Backend(Separate server). Normal authentication flow in the SPA:
User credentials after submission are sent to the backend and if authentication is successful a token is returned that is used in subsequent calls to the backend.
However we have some cust... |
I'm a front-end developer working as a member of an agile team. I have no clue how much of UI/UX must be done before every sprint and how much of it I can postpone for later.
|
I have a very specific localization problem that I have not had any luck finding specific information about in my research.
I have an app that I'm localizing that shows elapsed minutes(M), seconds(S), milliseconds(X) in the following format:
MM:SS:XX
I've been told by a friend that this will work fine in all European c... |
Are data transfer objects or POJOs meant to be final or can they be extended and create hierarchies for them?
It is not clear to me if such a value class is properly designed only as a final class and what are some good examples/designs of a hierarchy of DTO classes?
|
We are creating a SaaS multi-tenant (separate databases) with micro-service architecture, which causing a lot of discussion between me and my manager trying to determine if it needs to be multi-tenant or the databases can be related to the service no matter which tenant it is (each service with its serving data).
From ... |
I have a huge GIS related project with multiple parts which was originally developed for metric usage (meters).
Now I need to make a comprehensive audit of the system to come up with a plan to let it support imperial unit (feet) natively (not just convert at the display end because of accuracy concern).
What is a good ... |
I'm trying to design a system which can determine whether there is a difference between a field or not given two objects.
In my tool, we get multiple versions of the same title, with minor differences in each field. Now based on business rules, we want to determine whether the difference is significant or not. For exa... |
I have two feature branches that were recently merged, and I'm trying to examine the diffs as an informal code review after-the-fact.
feature1 with about 50 commits was merged into master and a merge commit was made on master. I had reviewed those commits and was satisfied with them. The merge was straight forward easy... |
I've read that the Heap File Organization is usually used to structure a secondary index. This makes me suspect that usually, a secondary index is unordered, as opposed to the primary index, that is ordered by the primary key attribute. Is this true ?
|
Probably best explained with an example:
In a .NET C# project, we have a library class for which several function accept an HttpContext as one of the arguments.
The thing is, that none of the functions actually need the full HttpContext, they just need one item from one of the collection properties on the HttpContext.
... |
I have a view which displays a list of items related to one thing, it allows creation, removal of, and updates to these items. All changes only persists when the user hits save. Is it okay to group all of these methods into a single request? If not, can you explain why not?
|
When creating a new class, should we always override the equals and hashCode even if we don’t intent at that point to use the class with any Collection classes?
Or is it better to wait till such a need arises before overriding equals and hashCode so as to be sure on what the logical equality should be?
|
I am building an application on windows forms C# that will run in real time 24 hours a day 365 days a year. This application tracks the time that components are out of storage.
I am running into a problem with daylight savings time as when it hits, it will alter how long the components are out, which i need to deal wi... |
Suppose I have the following interfaces, GameObject and Enhance.
GameObject:
public interface GameObject {
void prepare();
void use();
void cleanup();
}
Enhance:
public interface Enhance {
int increase();
int decrease();
}
Goggles:
public abstract class Goggles implements GameObject, Enhance {
... |
I am modelling a users management system, where users have a country of residence. I have modeled both User and Country as aggregate roots, and I am referencing the user's country by its ID internally.
The storage is a relational database and I have a UserRepository and a CountryRepository. Whenever I need the user's c... |
The Covariance and Contravariance feature is well supported in C# and Java collections. However C++ doesn't support them in their STL containers. Why is it so?
For example the below code will compile in C# and Java but not in C++. (The syntax will have to be translated to the specific language though)
class Base
{
};... |
We're currently developing a Spring application that uses jdbcTemplates for the repository.
We have a lot of functions that only require specific combinations of columns in our database. It would be wasteful to always fetch the entire objects. But separating the columns into their own table doesn't make sense semantica... |
I am making an online poker server in NodeJS. Currently, the state of the game is being sent to each client. So using debugging tools a client can see all the other player's card IDs. I would like to send the game state but modify it so that player card ID's are represented in ciphertext.
What kind of encryption protoc... |
I thought I understood what abstraction meant - refactoring code so that it applies to more general use cases. However I have recently learned that some types of abstraction may actually be indirection, and am questioning my understanding.
I'd like to see some a specific example (of code in Javascript - not a descripti... |
Overview of application:
A chat bot that connects via IRC, using TPL. As messages come from the socket (from .ReadAsync()), they are ultimately parsed and passed to a handler within the bot itself (Let's call this ChatBot).
An async long running task responsible for reading certain information from REST API's, and upd... |
I'm working on my first big C++ project and while I understand the language I'm trying to learn elegant design patterns using it. I have some low-level networking over a UDP sockets API where each message contains an incremented id to facilitate association of requests and responses. I'd like to use these to create a h... |
I'm trying to design an event-driven architecture based on Kafka for messaging but I'm struggling in managing event dependencies. Let's suppose the following service choreography:
Service A: emits A-created
Service B: emits B-created when processing A-created
Service C: emits C-created when processing A-created and B-... |
I just want to curious about adding a converter is a good practice or not.
I have multiple API and I always convert API return fields to my client fields.
Like=>
function ConvertFromAPI(apidata){
var result= new user();
if(apidata){
result.id = apidata.id;
result.usern... |
TL;DR - When designing classes for MVC use, is there "best practice" for how classes should be structured to eliminate property duplication and/or redundancy? I'm trying to avoid large (one-size-fits-all) classes with many (redundant) properties, but am also concerned about having too many isolated classes.
I've been ... |
I've noticed this while implementing a Rest-API today. We first define interfaces for each API method and the api contract for one endpoint allows (amongst others) two status codes: 200 and 204. Both may be returned when the request was successful, but the returned data isn't really important. The implementation might ... |
upfront I develop software for big data applications of which use is beyond my control (it ends up with a user), but I am not a trained software developer. So I apologize for any wrong terminology.
Now my question is: Is a class hierachy justified when implemented mainly/solely to aide static checking (checking at comp... |
I have been doing a lot of reading/watching on event sourcing but some things still do not quite make sense. My application is a warehouse management system where we have:
Deliveries of stock into the system
Movement of stock around stock locations (pallets and shelving bays)
Orders which contain order items (i.e. pro... |
I'm actually implementing my own Pose-Estimation/- and -Refinement pipeline. For this purpose I use one moving mono-camera. Then I take the consecutive images to estimate the pose and triangulate the points (nothing special). In the last step I refine the poses and 3D-points with a bundle adjustment approach.
Generati... |
As per Wikipedia: A compiled language is a programming language whose implementations are typically compilers (translators that generate machine code from source code). And an interpreted language is a type of programming language for which most of its implementations execute instructions directly and freely, without p... |
A small, neglected project has recently been reported by users as having time out errors and some object reference exceptions. As I am a recent replacement for a developer who was responsible for this project, I didn't have the solution installed on my machine.
In the process of trying to get a local build to run, I'm... |
I'm wondering how best to handle the scenario of releasing a mobile app that includes an incomplete feature behind a feature flag in one version and then the completed feature behind the flag in a subsequent version - and making sure users with a previous version don't encounter incomplete functionality.
Let's say I'm ... |
I'm researching DevOps metrics for school. One metric is called "automated test pass percentage." I found one article that says this metric is useful because it is good to know how often code changes are causing your tests to break. Does this metric tell you how many tests pass in your pipeline whenever code is committ... |
The state of my TypeScript/Angular app contains objects from the UI layer and from the business domain layer. I'm exploring store-based solutions (eg ngrx, ngxs) to keep this state in memory.
As I understand, such solutions define a single data structure for both UI and business objects, eg
export interface App... |
I'm reading some article about "prefer composition over inheritance", and heard about Forwarding and Delegation. After search for the different I found some source:
https://en.wikipedia.org/wiki/Forwarding_(object-oriented_programming)
https://en.wikipedia.org/wiki/Delegation_(object-oriented_programming)
https://www... |
I am looking into ways for implementing maker checker principle for various classes over our company repository. Basically the rules are as follows:
An entity is an object to be seen on a website (e.g. a blog post)
There is a creator of an entity with appropriate permissions/role (e.g. ROLE_POST_CREATOR) (in the origi... |
Introduction: We have a bunch of micro services (about 40) to serve our customers.
To facilitate scaling and audit-ability of selected few micro services we have decided to redesign them using CQRS and event sourcing.
Current Situation: We started out with a one to one mapping between read applications and write appl... |
I want to extend our api to a (better) v2 version.
I came up with the plan of adding a "v2" area and under that, cloning each controller into it. (basically v1 sometimes returns json, sometimes text, sometimes ysod and we're standardising our responses).
So we now support both v1 and v2 via:
v1 "abc.com/billing" <- s... |
How and where to describe data fields and their behavior in business requirements document?
I have business requirements document setup this way:
1.4 General Requirements:
Req # | Ranking | Requirement
1 | H | The system shall be breaking into two sub-systems; one for the POS Admins a... |
The Python Binary File Parsing Deep Dive
Intro
I'm an electrical engineer by trade, however my job has a lot of software engineering overlap. Recently something I've been working on is a Python parser for a binary format that has a varying record format. The format is STDF V4, which is a binary format created by Terady... |
On Wiki page for Factory method pattern, there is following example:
public interface IPerson
{
string GetName();
}
public class Villager : IPerson
{
public string GetName()
{
return "Village Person";
}
}
public class CityPerson : IPerson
{
public string GetName()
{
return "Cit... |
I'm writing a Python library in which various objects are represented as Python classes. However, the user is not supposed to create instances of those classes directly. Instead, there are a set of convenience functions to create them. So my module source currently looks like this:
class Foo:
pass
class Bar:
p... |
As a architecture design brainstorm, I am pondering on how should I define schemas for movie database where heavy text searching is delegated to document based database (eg. elasticseach) while rdbms is kept for relations and querying by ID.
Imagine having following entities...
actor (id, name, dob)
studio (id, name, ... |
Are their any objective guiding priciples to choose between named fields over compactness?
const replacements = [
{ from: 'apple', to: 'manzana' },
{ from: 'banana', to: 'plátano' },
];
function replace(str, replacements) {
for (const {from, to} of replacements) {
str = str.replace(from, to);
}
return ... |
I have a child view-model which notifies on a property change:
public class ChildViewModel : INotifyPropertyChanged {
private bool isSelected;
public bool IsSelected {
get => isSelected;
set {
if (isSelected == value) { return; }
PropertyChanged?.Invoke(this, new Property... |
I'm studying for an exam (software-engineering) and got stuck with the following question.
Developing a web application for stock in order to monitor (automatically) and to trade shares. You are responsible for requirement capturing. Explain why the following requirement is not recommendable.
The shares should be stor... |
When I'm saying "area" I usually mean some relatively large unit or service, which is a part of a whole product, i.e. API service, location service, warehouse service, etc.
Context: a project with 20+ separate services that has been in development for 7 years. It has been rewritten from scratch, so if it counts, its ov... |
First, I know - there are a lot of online resources that talk about the topic Exception handling - but yet there is still something that's unclear to me.
Consider having this code in an external library, called from another project.
public Task<List<Ident>> GetFoo(){
List<Ident> idents = new List<Ident>();
iden... |
I need to build an experiment based on a scientific paper in which a high number of agents have a divided visual field (with limited detection distance) and have to detect other agents in a 2D environment.
The visual field angle is evenly divided in N angles. One just need to detect wether there is an agent (or more) o... |
What is best practice when a unhandled exceptions occurs in a desktop application?
I was thinking about to show a message to the user, so that he can contact support. I would recommend to the user to restart the application, but not force it. Similar to what is discussed here: ux.stackexchange.com - What's the best way... |
I have a class that oversees some process. At it's core, there is a process method which collects data and processes it. There are a bunch of methods for retrieving the results of the previous processing step.
To have a better overview, here is how it looks like currently:
class Main {
private:
// resource1... |
I am looking into Event Sourcing.
One of the key points is about saving the differences to the event store rather than objects themselves.
This is fine in simple examples. However, I am struggling with the correct way to do this in the, more complex, real world (i.e. you could have an object with 20 properties on being... |
I'm receiving a JSON object which has many properties and the properties change (properties are added/removed) according to the type of the data in the JSON object. I'm expecting to receive many different types of data. Each property in the JSON needs a type of formatting.
Example:
// objectA
{
property1: 10
type: ... |
In a document editing web application such as Google Docs or Evernote, sync/save has to happen almost instantaneously to make sure data loss is minimal in case of a connection failure or a client crash.
A straight forward solution seems like to have the update end point called at short time duration or each time user p... |
I am trying to understand the difference between Reactive Extensions and Message Queue? Are they competing frameworks? Can they be used in conjuction? Started programming, and trying to understand this.
Reactive Extensions: " The Reactive Extensions (Rx) is a library for composing asynchronous and event-based programs ... |
In Microsoft Azure one can store secret values like passwords in Azure Key Vault, but also as encrypted variables in Azure Automation (these ones are stored in an Azure-managed Key Vault behind the scenes).
From a solution design perspective, if Azure Automation is used to trigger all the solution code executions, is t... |
I have a microservice, lets call it microservice A.
It talks to another microservice's REST endpoint, lets call that one microservice B.
I'm monitoring the health of microservice A using the Springboot actuator health endpoint.
I've had a code review comment that says that microservice A 'should' also be checking the h... |
As a practice I'm working on a CPU simulator (runs at about 1.78MHz) and I'm using a switch statement to execute correct opcodes based on the value in the IR (instruction register) variable. This switch statement needs 256 cases. While it may not be that big, the switch statement needs to be executed many times in a sh... |
I am new to DDD approach and need some advice.
I am going to use event site as an example. Say user can create event with start/end date. Event status can be running, expired, closed. Closed status can only be assigned by user manually after creating event. The other two status are calculated on the fly by checking the... |
In an Event Driven Architecture when there are more than one microservices say A, B that publish same Event say Order_Created and a service C listening to it, performs some actions and publishes an event say Credit_Reserved for each new event on this type. My question is, while I can keep a CorrelationId to track a ch... |
Basically, the idea is to have a new thread pool with a few worker threads in it every time a user log onto the application (a new user session is created).
Pretty much all the web applications I've worked with in the past had fixed amount of thread pools based on functionalities, but almost always performance issues w... |
I have global message queue with multiple different producers, and a cluster with N nodes of consumers. Each consumer receives a message and may decide to process it or to put it back to the queue if not interested. Each message has a relation to the project. The amount of projects is greater than amount of nodes (proj... |
I'm conflicted as to what is the best way to approach this problem.
I am writing a simulation in Python, which is parametrized by ~ 50 parameters. I have a JSON file where these parameters are set, so that it is simple to modify them and perform different simulations iteratively.
Snippet of settings.json (not actual pa... |
New to Apache Airflow and curious about how code and data are expected to be used across worker nodes in a multinode airflow setup.
When considering if ETL logic should be in the dags or in separate files called by operators in the dag, from here (https://www.astronomer.io/guides/dag-best-practices/) I see:
Try to tre... |
I am using HATEOAS architecture in my rest application and want to send internationalized success message that will be directly consumed by the client. I know we can just add a key in the response but want to know what is the ideal way architecturally.
For example, lets say i want to send a message Department created s... |
I'm designing a enterprise infrastructure monitoring application which has customized needs of access control, beyond roles and authorities.
The architecture include multiple nodes of REST API being load balanced, an angular client and an authorization server based on OAuth 2.0 using JWT.
These Rest API nodes are gener... |
Recently I was going through some of the source-codes of the best competitive programmers in the world. I found out that those people use a template while writing programs, preferably in C++.
I have some difficulty understanding those programs because of the fact that they first create their own macros/types using #def... |
I need to have compiled in a single file all the interfaces that extends a particular interface for doing some refactoring work (long story). I'm using Visual Studio 2019, but I didn't find any extension that would it for me.
I can create a parser to parse all ts files, but I don't want to reinvent the wheel if someon... |
Technologies : NodeJs, Kafka, Mocha
The issue : I have a nodeJS service which given a String returns events with a many data.
How can I test this using Mocha ?
In a simple scenario the service returns one event with some data attached.
In a more complex scenario the service publishes multiple events.
Is there a way ... |
I hope people will indulge me a potentially obvious question. I've worked in a number of organizations that have daily scrum meetings. Some organizations are really strict about only using the scrum for check-in (the "three questions" - what did you do yesterday, what are you doing today, do you have any blockers?) but... |
I'm creating a python module at work, and I have a config file with variables that change for dev or prod (i.e. S3 buckets). What's the best way to do this? Right now I have dicts in config with DEV or PROD options, but selecting this every time in the classes seems tedious (i.e. S3_BUCKET[DEV] etc).
|
I'm working as a programmer in a load cell manufacturing company.
We develop our own software for load cell manufacturing and testing purposes.
Quality Assurance Department of our company has requested to perform periodical verification and validation tests (once a year) for our released software which has been already... |
Games written using OpenGL are relatively easy to port to many platforms, and look and feel the same everywhere implementing their own UI. Web browsers have to solve a very similar problem. So, why don't we have web browsers written using the OpenGL specification?
Would not having the same specification for the graphi... |
I am working on some Linux kernel drivers for a specific embedded system (NVIDIA Tegra X1). I am using the kernel source provided by NVIDIA (L4T), which has its own default kernel config files. My goal is to make some modifications to NVIDIA's kernel config file to support my new drivers.
The complication is that when ... |
I could not find any official recommended indentation for the following idiom (straight from http://effbot.org/zone/python-with-statement.htm):
with open(path) as f:
data = f.read()
do something with data
or:
with open(path) as f:
data = f.read()
do something with data
IMHO, the first version is better at... |
Semantic versioning encourages using suffixes to indicate pre-releases: alpha, beta or rc builds. Their purpose is well known and documented.
It's also a given that once you create a build or version, its name should not change. All package managers or repositories that I know hence don't support this (NuGet, NPM, Bowe... |
I was reading a wiki article about DRM, and I found in the Development paragraph this:
Torvalds, as top maintainer of the whole kernel, holds the last word on
whether a patch is suitable or not for inclusion in the kernel.
So, how is it possible that one man holds the last word whether a patch goes in? In a project o... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.