instruction stringlengths 34 36.1k |
|---|
I may have a tough one for you.
I have a machine in the wild that is and will probably continue to be compromised. The machine is owned by a user who will be unable to keep it secure.
I must have this machine pull from git. It must also automatically install all pulls without restart (no startup solutions).
I would p... |
I'm developing a Python library, and I'm also developing some code that uses it. Currently they are in the same git repository, but I want to separate out the library part into a separate repo, in preparation for eventually* releasing it.
However, I'm unsure of the right way to work with two repositories. The library h... |
We are building a new application for a client to manage their cases. They are already using their existing system in which they are storing files associated to the cases in an FTP folder. There is an attachment table (~1M rows) which maps the cases with the ftp file location. As part of the migration the client also w... |
Hopefully, this is the right forum for this type of question..
We have a set of common entities which are 'shared' throughout the company - much like Master Data Services (MDS) data. Everyone has differing ways of maintaining said data...most of which are painful and/or lacking.
So...I created a working 'demo' using th... |
Clean architecture decouples an app's core from the presentation/UI layer. The UI is just a plugin, replaceable (eg, web-based to desktop) without impacting the core.
Many data science apps mix code, user inputs, text, graphics and other outputs in one notebook, eg, Jupyter. Everything seems coupled: the domain, UI, p... |
I would like your tipps about implemening a command line interface
to interact with a running java application.
Example:
The Java Application is a webserver and a cli-client should interact with it:
1 ) Start server application:
java -jar webserver.jar
2) Get status of the running application: java -jar webserver.jar -... |
I have a question about architecture in .NET.
My architecture is like this :
Projet :
- DAL (Data Acces Layer)
- BLL (Business Logic Layer)
- DTO (Data Transfer Object)
- IHM (man/machine interface)
DAL : Acces to the database (CRUD) It reference DTO
BLL : Logic Layer do all logic process and make the connection be... |
When I develop apps I reach situations like this frequently but I never found a best practice to solve it.
Imagine:
We have chats, each chat can have many message.
We have tickets, each ticket can have many message too.
Solution 1:
We create 3 tables: chats, tickets, messages, and we link each chat or ticket to its m... |
Apologies if the title is incorrect, I couldn't think of better wording. I have the following code
template <class E>
void ResolveEntityHit(E& entity, Projectile& projectile) {
static_assert(std::is_base_of<Entity, E>::value, "entity must be of type Entity");
entity.DealDamage(projectile.GetProjectileDamage())... |
I'm designing a system that acts as a master data service for what I shall here call boxes. The system is to be implemented in Java with a relational database (SQL) as the main storage. Each box has a ~dozen different top-level properties: ranging from simple primitives (booleans, integers, etc) to other objects and li... |
I have read on several methods to securing an API key like gitignore or placing in another file if using an application, but at some point if taken the time, anyone can get the key, even when apikey is in use or called, right? Other methods explain using a proxy which is well beyond my league. I am only aware of unders... |
I have to define the new way of working for a development team which goes from a one man unit, to a distributed team with programmers al over the world. The team will work with svn. This is a non-negotiable thing. I recommended that they switch from svn to git, but that is not going to happen. This is the first time I ... |
my requirement is i want to delete a Object A
A-> B-> C-
here if you want to delete A you have to delete B which is dependent on B , then If you Want to Delete B you Have to Delete C which is dependent on B and The Chain goes like this
i'm planning to Solve it using chain of responsibility design pattern , or is the... |
I'm currently testing a web service and I have noticed that there is only one error code ever return: 400.
However, the error message return isn't always the same. Here are some examples of the error messages I got:
XXX must contain only digits.
YYY: This value is not valid.
XXX: This value should not be blank.
Etc..... |
I need to produce some documentation to be compliant with IEC 62304 and, while reading all of the processes needed to be documented, I'm having a couple doubts about how to structure the whole lot of documentation.
My concern is about how to divide all of the documentation in separate documents and what should be inclu... |
I have few strategy class that calculate ranking. Those class implements interface with method scoreUpdates. Method scoreUpdates take two parameters( winners and lossers). Now i need add new strategies and some need more parameters. Should i add methods to base interface for this new strategy?
What is best solution fo... |
I recently came across a set of possibilities for creating rows in a table in my database. the scenario is that I am trying to populate a notifications table by different types of notifications data based on different tables.
Adding to the notifications table is done instantly after the adding of rows in other tables ... |
I've noticed this style of code a lot in frameworks like Symfony and Magento 2 (which is based on Symfony):
<?php
class Foo
{
protected $foo;
# construct function - not needed for question
public function getFoo()
{
return $this->foo;
}
}
Which makes th... |
I want users to be able to dynamically add 'columns' from the front-end of the website. I understand that it is probably not best practice to actually add columns to a table from the front-end, so I was looking for a better way to handle this.
The use case:
I am making an app with a determination table. The user can fi... |
Is there a protocol or a convention that supports REST (ok, maybe we should use HTTP here instead) processing chain and some neat features to help with that? Let me explain what I mean.
Let's assume I have some public REST service available. Using HTTP GET, I have multiple static pictures, GIFs and movie clips availabl... |
Let's say I use a Pair in this way:
Pair<Long, Date> signup = getSignup();
System.out.println("User with ID " + signup.getLeft() + " signed up on " + signup.getRight());
Is it a form of Primitive Obsession?
I could have something like
Signup signup = getSignup();
System.out.println("User with ID " + signup.getUsrId() ... |
What is good practice of settings up a database in potentially large project - creating tables and updating them - should it be done in code of the app or should it be done by external database related tools like phpmyadmin ? I mean I have two ways - create tables and set them up when the app starts, or I can do this s... |
This is a best practices question for release management of an app. But this scenario is a bit different than what I've been able to find myself.
Essentially my company maintains a fork of its own app. There are two versions of the app that will have different configurations of bug fixes / features. These fixes and ... |
Should I run my own webserver? If so, how do I do that? I'm running on Windows 10 with VS2017, IIS Express and MS SQL Server.
I don't need a domain name. Just providing access via IP-address is fine. I'm just looking for a cheap and easy way of enabling other people to help me beta test my apps.
Can Azure be used for t... |
Considering this pattern is used to support CQRS message bus, examples are buslane Python or MessageBus PHP
It uses commands to change the domain model, and publishes domain events
This looks great providing the separation, and encapsulating each domain write operation on its own classes, but doesn't that make an anem... |
I just started a new job and one of my first tasks is to create local nuget packages from the existing libraries, to help with versioning, maintenance, etc. This task had already been started by another engineer. However, he chose to grab many libraries that relate, create a project holding all these libraries, and pub... |
I'm really struggling with overheads of context switching. When I need to continue work on some part of the code after a break, it takes up to an hour to recall all the context of the problem I working on and tune up to work. How do you deal with that issue? Maybe you leave some prompts in the code describing context a... |
I am writing drivers for different devices to work with my embedded system. Currently I write any new driver manually but for the future I would like to automate this using a settings file. I figure I have 2 options:
write a single universal driver that reads the setting file and behaves accordingly;
write a code gene... |
Context: I have an open source project which uses JNI. While it's possible to build it yourself, I expect most users will use standard Java tools like Maven, Gradle, or SBT to download the JAR, which contains the pre-compiled binary image. This is no problem on Windows, but on Linux it gets complex.
I'm wondering how m... |
I am working on an ASP.NET Core application that grabs a model from a database via Entity Framework, and will pass a "subset" of that model to our Angular front end. For example:
I have a list of Users. On the user-list page, I would like to grab a list of User objects from the API and display them on the page. For eac... |
Given the formula to calculate instability...
I = (Ce / (Ca + Ce)) with Ce = outgoing dependencies, Ca = incoming dependencies, and I = Instability,
...should I include system dependencies (such as System, System.Data, System.XML, etc.) when counting outgoing dependencies (Ce)? Or, do I just count it as one outgoing d... |
I'm a junior developer that is given the ability to help shape my team's processes if I can justify the change, and if it helps the team get work done. This is new for me as my past companies more or less had rigidly defined processes that came from management.
My team is fairly small and somewhat new (<3 years old). T... |
According to the book, The domain layer should be isolated. In domain entity, you should avoid adding a property represents database PK (usually identity surrogate column called ID).
There is no problem in identifying a domain entity because by definition it includes a natural key. If this key is the same as PK, then ... |
I have in mind to develop a Ruby on Rails app with two different databases.
In the primary SQL db - let's say MySQL, for instance - I'd keep my app items, e.g. user profiling, user-user interactions and, in general, everything that's bound to a model, anything that I already know how is made.
Now the best part: I'd lik... |
I am wondering how best to slice up a Java Mustache web app which has:
Data layer (JPA, Repos, Entities, etc)
Service layer getting data from other company web services outside the package
Web/Controller layer serving up Mustache template pages
Important to note this is all in the same Maven module (I know).
What I r... |
In short, is instanceof a bad thing?
I had a code something like
Converted convert(Object o) {
if (o instanceof ClassA) {
convert((ClassA) o);
}
if (o instanceof ClassB) {
convert((ClassB) o);
}
throw new IllegalArgumentException(o.class + " not suported");
}
I didn't realize it can... |
I have data object's let say PersonDto (fields name, surname) and OrganizationDto (field name, type).
Then I have some common screen, showing such data, but screen title is something related to type of - Person/Organization.
The easiest way how to implement that functionality is to have field/constant in that class. An... |
I have been trying to figure out an ACL solution for my application which should manage API endpoint's access rights dynamically. Some said that I have an option of Spring Security ACL. I checked it but lack of documentation frightened me a bit. So that I started to design my own ACL implementation; since I did not sta... |
Hopefully not too academic...
Let's say I need real and complex numbers in my SW library.
Based on is-a (or here) relationship, real number is a complex number, where b in imaginary part of complex number is simply 0.
On the other hand, my implementation would be, that child extends parent, so in parent RealNumber I'd ... |
I am writing in C#, but this question may apply to other languages as well.
public class Test
{
int a = 10; // I created 'a' here
public void M()
{
int a = 20; // I forgot that I already have 'a' in the class and I initial it again ;
// do other stuff with "a"...
}
}
This way isn't ag... |
I have a specific problem in git which I havent found an answer to yet.
In gitlab I have 3 seperate repos. For my school project the teacher wants me to copy everything into a repo of his and wants to see all my git history.
So I would need to fork my 3 repos into his main repo, but I just couldnt figure out an answer... |
Assume there is any program that is supposed to be tested and you like to perform an equivalence class analysis on it. Let's say you identified six valid and four invalid equivalence classes. Then, how many test-cases need to be created in each case at least?
I'm not sure about that but I think because every equivalenc... |
I'm currently building a React Native application and wondering if storing device information such:
if my app has granted location permission
location service is turned on
last known user location
in the Redux store can be a good idea.
I have different components that needs to know this informations and storing in R... |
We're a small team of 3 senior and 1 junior developers and I've been tasked with introducing BDD within our development process.
To say there's a lot of confusion about BDD is an understatement and it's appearing within the team after I created some scenarios for user based behaviour.
My understanding of BDD is that it... |
I am member of the Apache PLC4X (incubating) project. Here we are currently implementing multiple industry PLC protocols. While we initially focussed on creating Java versions of these, we are currently starting to work on also providing C++ and other languages.
Instead of manually syncing and maintaining these, we wou... |
I'm developing a system, and I've had a question that might help other people.
The system would be written in PHP, with a lot of chance of turning a mobile app later, too. Normally, I would create it with a controller that would make the connection to the database, and others responsible for inserts, updates, etc.
Cons... |
I am trying to modify an opensource project (json serialization one: gson, I want to let it serialize/deserialize objects with circular references, which is not allowed now.
) to do it I have to change an abstract class widely extended.
I want to change the behaviour of that class with a strategy object so every child ... |
I'm trying to accomplish this scenario :
There are 2 types of users, let's say Admin and Worker, and there have different roles.
Admin can do a CRUD of questions, and also can create a room where the users can join to play together (this is just a name) but maybe is a good idea to create more attributes inside of it l... |
Immutable objects
In object-oriented and functional programming, an immutable object (unchangeable[1] object) is an object whose state cannot be modified after it is created
Wikipedia (https://en.wikipedia.org/wiki/Immutable_object)
Code example in PHP (see question below...)
class ImmutablePaymentMethodManager
... |
I wrote a small INI file parser as a library which I want to use in a bigger project. Following good practice I decided I should write test cases, too. But I fail to find a good start.
The library is extremely small (1 source file for the implementation,
1 header)
The library has few public methods. (parse(), get_sect... |
Is it possible to scale a low resolution image to a highier resolution upto the point with minimum effect on quality, sharpness and other notable attributes of an image.
|
I'm reading Clean Code by Robert C. Martin, and the phrase TILT inexplicably appears in some code samples. Example (it's in Java, by the way):
...
public String errorMessage() {
switch (status) {
case ErrorCode.OK:
// TILT - Should not get here.
return "";
case ErrorCod... |
I am trying to improve the architecture of a system where data flows between 3 systems. Every minute, there are thousands of items generated on App 1, which are sent to Midpoint in the following way:
App 1 sends items (through REST API) to Midpoint
This happens on an "as-and-when" basis: App 1 will keep sending item... |
I would like to ask if there is any powerful method we can use to combine the Id's to a single field for faster search and retrieval.
My case is like this, I have a table that stores ID's of companies.
ID | CompanyName
1 | Company A
2 | Company B
3 | Company C
I have another table where there is data that need to b... |
I just started looking into programming language design and came across the term intrinsic but could not find any good definition of this anywhere.
I hope that someone here can help me with a good definition to broaden my understanding.
The description of the word in the Cambridge dictionary says:
Intrinsic (adjective)... |
I know that @RolesAllowd annotation can be used to provide role-based access control to REST endpoints and I am currently using that with RestEASY.
I need to know how it is working behind the scenes. Can anybody please explain to me how Java validates the roles mentioned in the annotation.
So far I managed to figure ... |
When writing unit tests, I want to reduce the cognitive load of the reader as much as possible. One thing I've noticed that bothers me is that the variable names of the thing that is being tested are often varying quite a bit in my and my teams code. The variable is often named similar to the component in question. As ... |
I've been asked to design folder-like structure (in java, but I expect this solution to be language agnostic).
There is one root, just like / on linux. Then, it can have almost indefinitely nested folders and files inside. Now, here's the catch: I have to be able, to track some of file details, like size, on every lev... |
I'm wondering about Unit Tests. Let say i got a code ( in C#, but language is not important here):
public class SOT: ISOT
{
List<string> _internalCollection = new List<string>();
public string CurrentCollectionName { get; }
public void AddItem(string item)
{
_internalCollection.Add(item);
... |
Imagine the application I am building as a normal media playlist (Video / Music). On the client side, I select the files I want to play (Files are located on server), and I send its paths to the server as an array of objects. Converted to JSON the object would look like:
{
"mediaFiles":[
{
"type":"pho... |
Are there any algorithms related to the following problem that could be usefull for solving it?
I have a convex hull built on some point set.
I would like to simplify it (reduce number of points) by still keeping its perimiter (or area) as small as possible. New simplified polygon should not intersect the original hull... |
I am reading the following link to learn about system designs of various systems. (This is a paid link, I am attaching all explanations below.)
In an attempt to explain the system design of Instagram the above link gives us the following requirements:
Users should be able to upload/download/view photos.
Users can perf... |
As far as we know, the User Stories are the way a requirement is defined in bounded context with acceptance criteria. On the other hand, the Product Backlog enlists all requirements, i.e., new feature, enhancements, and existing production issues.
This is not clear, if or if not, the Product Backlog just consists out o... |
I was hoping that someone could explain to me in the simplest way possible and with an example, what abstraction is with regards to Oop. I've read articles online and I just don't get it. I'm hoping a simple coding example would help it sink in. I understand it's the concept of hiding complexity from the user and I ... |
I am developing a "platform", I have an MVC site that will hold all the main data, as well as our generic API, uses Microsoft authentication to create an account, then our employee MVC will add the data to the database that will allow the user to start consuming our API. I have a custom API for one of our customers, us... |
One of the database systems I work with (I'll call it database A) was essentially sharded into 3 schema-identical copies. This was easy to source control, and when a change was made to any of the copies, it would go to all the copies.
A few months ago a change was made. A new database was created (not sharded, I'll cal... |
I am trying to learn CQRS in my spare time. Say I have a class like this:
public class Person
{
private Guid Id {get; set;}
private Guid Name {get; set;}
private List<Order> orders;
//Methods and constructor go here
}
I am thinking of a scenario where it would be beneficial to persist the Person class to th... |
I'm looking for failures in this "token based login" design, besides the UML "syntax" errors. Theoretically speaking, it will do the trick when implemented on an small project.
If true, sorry about my english.
Thaks in advance.
EDIT: Is 1) this model something useful and clear? 2) Will it work when implemented? 3) Besi... |
Lets say we have some configurations stored in a database for how we should acquire some data. One of these fields is an AcquisitionStrategy which denotes how we will acquire the data.
I want to add a field that corresponds only to a subset of the rows in this table that have an acquisition strategy of HTTP. Should I ... |
I have a data access layer, which currently communicates with a database.
public interface IDao<T> // T is my DTO
{
Write(IEnumerable<T> dtosToPersist)
}
public class Dao<T> : IDao<T>
{
private readonly IBulkCopySaver<T> _bulkSaver;
private IEnumerable<T> _buffer;
public Dao(IBulkCopySaver<T> bulkSave... |
I am implementing an asynchronous remote (to aws S3) logging handler (in python, but it doesn't matter) supporting 4 modes:
Immediate: the messages get written immediately to S3 - I am
trying to avoid this mode
By queue size: the messages get stored
into a linked queue, and after reaching a certain size (say 500ko),... |
While a fundamental concept, I don't understand the statement "every CLASS in Java is a subclass of the class object," which is often quoted in JAVA tutorials usually in the inheritance section.
I thought this statement would be true if stated in reverse: every class OBJECT is a subclass of a class." Here is why: in OO... |
So at a high level, we have multiple projects/solutions in company and we need to keep them in 1 source control.
Since the number of projects is around 50, we are not creating individual repositories for each of them but instead are all in same repository.
Our branches reflect the environments which is Dev, QCT, STG, P... |
I am implementing Authentication from scratch (php).
I reached a point where I have different types of users (admin, author, editor etc.)
After dealing with this, I realized I can allow multiple account login at the same time (the login pages/paths are different for each user type).
Would it be a good idea to implemen... |
I am new to unit testing, but finally getting started.
I have been running into a situation where my unit test names apparently grow too long to readable due to the multiple parameters and combinations of them. For example, consider these hypothetical test case names resembling my actual test case names:
GetAllEmploye... |
I am reading Eric Evan's Domain Driven Design, and I encountered this concept on p108. I am having a hard time grasping the concept, in spite of the explanations mentioned on the pages 107 and 108.
Here is an excerpt of the topic from the book:
Medium-grained, stateless SERVICES can be easier to reuse in large
syst... |
why every startup and every big company uses #wordpress ? what is the benefit of using it ? fast management , easy to use , customization instead of creating one with html , css , js and back-end (php) ?
|
I created a CSV export that works like the code below. There is a LinkedHashMap where the keys are the column title and values are functions where certain properties are read.
By reording the lines where entries are added to the map, one also reorders the csv column representation.
Column header and data are connected ... |
I work on several projects and sometimes they share a common base. How do you work with version control?
Here's an example:
I've got a boilerplate Wordpress plugin that I reuse. On each new Wordpress plugin project I create code I want to add to my boilerplate plugin. Currently I'm manually extracting libraries & fixe... |
Edited: Update is at the bottom
There could be a common or best practice for this scenario, but I am unfamiliar with it. However, it could very easily be a matter of subjective opinion on how one wants to implement their classes. Either way I am hopefuly to get some opinion from the spectrum of class designers here.
I ... |
I was wondering if there is a way to get the values of every case in a switch statement?
When you provide a not implemented case, I would like to throw some exception and provide a list of available case values.
switch (partName.Trim().ToLower())
{
case "engine":
//something
break;
case "door":... |
Still trying to wrap my head around microservice architecture since I'm used to a monolithic approach
Suppose we try to build a extremely simplified Uber booking system. To simplify things we let's say we have 3 services and a gateway api for the client: Booking, Drivers, Notification and we have the following workflo... |
I'm using the MVVM design pattern in my application which is comprised of,
A Xamarin.IOs project (View Layer)
A Net Standard project (Common Layer)
A Xamarin.Android project (in the future) (View Layer)
In the Xamarin.IOs project, there's a Delegate class (NotificationCenterDelegate extending UNUserNotificationCenter... |
I currently build applications that are fairly monolithic. I have a one or many code bases that compile into one single binary/package and deployed on a cluster of docker containers. All of the data is stored on a single MySQL database, a redis cluster and possibly a NoSQL database for some of the data.
In this case, t... |
Using a website with Javascript as example.
Let's say I have script A which only performs a specific function on page Foo. For example something like sorting elements in a list.
Script A is only added to pages that have a list that needs sorted via javascript.
In the javascript we access the list with document.querySe... |
My parent class has a vector field
I want to force child classes to push in that vector as many as items they have. At least one item
example:
class Options {
protected:
vector<string> optionItems;
public:
void printItemsInConsole(){
// prints items on console
}
}
class Main... |
I like to create a finite-state machine for the given text below. While solving this, I came accross with several problems I listed at the bottom. (This example is in terms of testing (where you later derive tests of a specification which is in form of a state machine).)
Following specification of an elevator is given... |
I'm building a personal project, as an introduction to DDD, I'm doing a little bit of analysis and can't get my head around it.
My ERD looks as follows:
To go over it, as an admin you can setup a restaurant, you can add multiple tables to the restaurant, and you can setup workdays ( like the days the restaurant is op... |
It is pretty obvious that any interpreted language CAN also be compiled. For a long time I thought that it was not necessarily the other way around. Then I discovered Ch which is an interpreter that can interpret the whole C language. It also supports parts of C++, Java, Matlab, Fortran and C-shell.
This made me draw t... |
I'm storing data which logs whether or not a user has logged their attendance for a given day. Some days are unimportant (holiday, weekend), so those are also stored.
The two requirements are that:
Calculating the number of logs and missed logs can be done quickly, and
The structure is scallable for whenever new user... |
Which one of the following way is recommended and why?
Date d = Date.from(curr);
Date d = new Date(curr);
Can you also provide some examples behind the reasoning?
|
I'm studying domain driven design (DDD) and came across terms: Event Driven and Event sourcing. I know it's about publishing event from producer to consumer, and store the log, so my question is:
What is the difference between Event Driven and Event sourcing?
|
We had a interesting debate today over what our REST API should default to doing when validating a request body where unexpected fields are present. I think we ended the conversation in a good place, but it brings up somewhat of a meta point of whether or how to apply Postel's law that'd I'd like to explore further.
Ou... |
I'm studying Domain driven design (DDD), reading many articles, but never found a simple explanation. Please, help, let's say we have a design:
My bunch of question is:
What is domain? ( where is domain depicted) on this pic?
Where is aggregate on the pic? ( is it many objects or only one?)
Is it right that Order is ... |
context and background:
I prefer OOP for the most part and find it, largely, more intuitive -- this is my bias.
When I read that functional language x is better than OOP language y I think to myself: sure, sounds great, if you're computing integrals or performing other mathematical operations. Outside of that domain,... |
In the case that a type is specified, it could be on the left (before) or the right (after) of the variable name.
For example, C, C# and Java have the type specified before the variable:
int num = 5;
TypeScript, Rust and Haxe (can) have the type specified after the variable:
let num: number = 5;
let num: u32 = 5;
var ... |
I'm using MVVM and I have an app with a UITabBarController, the Main tab of which is a list of publications and the other is a Search screen where they can search for publications. Searching returns a list of publications.
Imagine that Publication A is the first item in the list on the Main tab. Now let's say the user ... |
I am using ADO.NET to read a bunch of data from the database into in-memory objects.
This is my domain model:
// Question.cs
public class Question
{
public int ID { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public IEnumerable<Tag> Tags { get; set; }
}
// Tag... |
Long story short, I wanted to use C as a scripting language and in a portable manner so I created a register-based, JITless VM to accomplish this.
I've formalized the VM's ISA, script file format, calling conventions, and even created an assembler that assembles the human-readable bytecode to numeric bytecode, now I ne... |
I have the following dictionary:
{ "Drama": 8, "Adventure": 8, "Action": 4, "Comedy": 3, "Thriller": 1 }
This dictionary is like a representation of a user's preferences in movies. (in the past he selected like 8 drama movies, 8 adventure ones etc).
Then I have another movie with genres:
["Action","Adventure","Fantasy... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.