instruction stringlengths 34 36.1k |
|---|
I have a Flask application with tens of complex models, almost all of them related to each other.
A simple pseudo-schema of some of them:
+----------------+
| FoodGroup |
+-------+--------+
^
|
+-------+--------+
| Food +<------+
+---+------------+ | +----------... |
When I write python code for simulations, I often end up with the following situation: I have a class describing the general environment which contains a list of instances of a class that describes the individuals being simulated. In turn, they contain a class describing their behavior which depends on the environment.... |
I'm working in a scenario where I have a backend (let's call it the server) and a frontend client app (let's call it the client).
The client is entirely headless, and can connect to any instance of the backend installed on a server (supply the URL).
Over time, we can expect the backend to grow and branch into new API v... |
I'm trying to understand event driven design better and have not picked up a book on it yet. But just from others explaining it to me it seems to be really similar to state machines/charts. What are the similarities and differences between the two?
|
I'm reading Software Engineering book written by Ian Sommerville. On chapter 23 (Project Scheduling), a hypothetical activity chart is given with tasks, their dependencies and duration.
Following the table of the tasks with their dependencies and duration:
Now from this table an activity bar chart is created:
Now I'... |
Is there a way to ensure that serviceA is called only by serviceB(or a set of whitelisted services)? All the services are independent and do not go through a service gateway as they are completely independent.
Are there any good microservice patterns to follow up on this?
|
I am a newbie to algorithms. One thing that i always get confused is about calculation of algorithm runtimes.
For example: The following piece of code in Python
for i in range(n):
#O(?)
i*=k
What is the runtime of the above for loop?
The answer that has been provided to me is: O(log n to the base k).
I am fin... |
I have a tendency to invoke methods directly on a new class instance like this:
new Person().GetAge()
when I don't need the instance of the class (here Person) after the invocation.
However, I have seen many developers recommend using this pattern:
Person p = new Person();
p.GetAge()
What are the benefits of declarin... |
I am learning Event Sourcing in my spare time. I see lots of references to 'CRUD type systems' online. I understand a CRUD type system to be:
1) A database driven system (website or application) i.e. a system that supports creates, reads, updates and deletes. A domain model is not needed in this case.
or
2) A system... |
For my Android application, I wanted to store values such as username, userid and stuff in a sharedpreferences object. However, when I read more about it, rooted users can still have access to those values. So I am wondering, if I store those values in static variables in a class, for example:
class foo{
public stati... |
Following reading Thomas Owens response (many thanks to him) on Is it reasonable to build applications (not games) using a component-entity-system architecture? and his explanation on what is ECS compared to others architecture design patterns.
I am using Angular5 and Unity a lot. I am asking myself what is the differe... |
I'm wary about on-premise solutions. It appears to me that the client has access to the source code and can easily steal it. Is this software business model safe for the vendor?
Are there any successful companies that are based on on-premise solutions?
|
I started working at a very small company that regularly (not too often) has to outsource some software developments. The external suppliers than have to deliver something.
As I now have seen is that the suppliers deliver a very varying quality of the deliverables - this covers sometimes only being the binary executab... |
I have created some stateless functional components that represent round social media icons used for links/sharing, the code looks like this:
AbstractRound
import React from 'react';
import { withStyles } from '@material-ui/core/styles';
const AbstractRound = ({
imgSrc,
classes,
alt,
}) => {
return (
<im... |
Facebook systems claim that this picture may contain violent or graphic content.
(When opening the link, Facebook asks you to login. I suppose it's because Facebook considers the image offensive and hides it from people haven't logged in).
Here's how it looks before you click on "Uncover photo":
Compressing the pictu... |
I like SOLID, and I try my best to use and apply it when I'm developing. But I can't help but feel as though the SOLID approach turns your code into 'framework' code - ie code you would design if you were creating a framework or library for other developers to use.
I've generally practiced 2 modes of programming - crea... |
I need to consume data from a WCF service, which pipes it through a stream. The data itself is contents of an archive file, so it needs additional logic, which I am splitting off into a separate class.
Now, normally, I would use a couple of nested using statements, like so:
// Inside class that does the retrieval
usin... |
I've recently been introduced into Domain Driven Design and we've done a lot of event storming in a simulated environment with a lot of people.
Now I'm back in the real world and I've been given a task but I need deeper insight in the process.
Does it make sense to go out event storming on your own to do this? Or is ev... |
For example, I have a toggle button, which would show the current selected element, and would show next element when it is clicked, and it can loop back to first element. I have 2 ways to store the current selected element:
1.Use a variable i to store the selected index:
<button id="b" onclick="onButtonPressed()"/>
<bu... |
I'm thinking about adopting the clean architecture.
The main thing in this architecture, as I understand it, is the dependency flow from top to bottom. So the first thing that I asked myself is: what would be the cost to change the bottom layers (i.e Entities)? This layer will have lots of dependencies, and by changing... |
A typical highload reactive architecture is:
(Q means queue)
And usually arrows are from client to DB at such sketches. My question is how the response is going back? The same queues and other stuff?
(Pictures links to presentations / video are appreciated)
|
This is a very common feature in software, and I am sure there is a whole deal written about it, but I really don't know what the technical term is, so here I am:
I am talking about giving your service or product the ability to save the state of some data to be able to access it in the future and rollback changes. This... |
I need help settling a disagreement, a co-worker and I have. We're working on a pretty huge Angular project and are in the process of looking at incorporating some Domain Driven Design principles into our project.
While we were looking at this picture, we discussed how our Dependency Injection Framework would factor in... |
We have a C++ project managed by UML software, which generates code for instantiating and passing data between objects. Unfortunately, this software adds a lot of overhead to our builds and development so we're looking to migrate our code away from it and cut out the generation step.
The generated code has container cl... |
I am writing software that deals with ephemerides—tables describing the positions and orientations of celestial bodies or spacecraft—and I am struggling with how to represent them in the my code.
Some background: the inputs to this software are a set of ephemeris files chosen by the user, in various file formats. I ne... |
I have developed an application which I intend to sell. I set up a website with information and download links, advertising, payments, everything is ready to go - except the digital signature. I want to sign my application so that Windows and various antiviruses won't nag my customers about an unsigned, unverified appl... |
I trying to learn the Command design pattern, I already know how it works and where it is used, but I'm a little bit confused about the implementation.
So I know we need to set the context by passing the object to the constructor or as an argument to the execute() function. What I don't understand is why do we need to... |
I'm working on a website that has a section that shows the company's stock details and investor-related data. This data is retrieved through scheduled SOAP API calls.
I created two scheduled tasks for achieving that:
feth-data (every 10 minutes): retrieves data and stores it in cron_last_trade_price_graph which a grap... |
There is an LGPL open source code in SourceForge that is quite useful, but entirely abandoned. I can see that the community struggles with code issues, but the original developer does not respond to any communication and the code has not been changed since 2008.
The code is under the license LGPL. The Licence.txt in t... |
I have received multiple reports from users of a Web-based GIS application we have rolled out one to two year ago, complaining the application becomes unstable/unresponsive. After a brief investigation, I found that requests from the third party Map API take up most available connections of browsers (pulling dynamic la... |
I am struggling to understand when to use each of these:
1) Message Bus: Used to send integration events between Microservices. For example, Microservice A could publish an integration event, which is handled by Microservice B and Microservice C. The benefit of a Message Bus e.g. RabbitMQ is that it could be durable ... |
For example we have entity object:
{
"id": 10,
"name": "First object",
"status": "new",
"manager_id": 200,
"links": [
{
"href": "self",
"type" : "PUT",
}
]
}
How can the API express through HATEOAS that the field status can only have the values new and co... |
For my domain entities currently, all validation errors cause exceptions to be thrown. I don't like this as it doesn't allow me to compile all validation errors before exiting a method. I'd like to pursue something similar to what's described here:
https://enterprisecraftsmanship.com/2016/09/13/validation-and-ddd/
.... |
I have a class, that takes a lot of esoteric parameters to construct an object. I didn't write the code and frankly speaking, I don't understand completely, all of it's nuances. There is a valueOf(String) method of this class, that is primarily used to construct objects of this class and it also does fairly complex com... |
I'm trying to learn the Command design pattern and apply it to the game I'm working on. First I read about the general implementation, and I feel like I understand it pretty well. Now I want to know how to use it in games. I started reading this book about design patterns in games and in the section about the command p... |
In a feedback for a (deleted) question I asked here last year, I was told that there is not easy way to do software testing. We may find prepared test cases for protocols but in most case the test are based on the requirement and most of them are for that reason unique.
Today I was preparing a thesis subject for a stu... |
I need advice on how to version builds based on shared and separate codes at the same time. I have a gradle project with multiple flavors. Large part of the code is shared. Some parts are flavor specific. Depending on which flavor I target, the corresponding code gets included.
I currently use semantic versioning. v1.2... |
I'm getting ready to do some work on an embedded firmware prototype that has a GPS chip attached to it (straight C on an arm0, no OS).
I'm torn on how to model UTC instants and time deltas. Traditionally in C, I'd just pick a resolution and an epoch offset and model things with "big enough" integers, but I wasn't worry... |
I am wondering what is the recommended folder structure for a C project. I read several posts about using src, include, test, build folders. But what if I want to structure the project in modules?
Should I use a structure like:
src/
core/
main.c
sysinit.c
interrupts.c
...
module... |
I have a website that follows the following structure:
www.example.com/city1
www.example.com/city2
...
Programmatically we change the logo which is hard-coded in a specific config file for city 1, city 2,... They are files in a folder structure like /cities/city1 or /cities/city2.
The colors can be changed by the ad... |
I've always used CSS and media queries when it comes to responsive design. I've been developing in ReactJS for a while, but I feel my approach to responsive design is sloppy. I find myself using a mix of CSS and Javascript, depending on the situation, to determine the screen size of the user.
I'd prefer to solely use C... |
I'm a programmer with ten years of experience. I've worked as full time programmer in 2 companies in these ten years as a software developer.
I have always loved to have my own business.
My question is, is it ok to start a business project from scratch and
write every piece of code from zero?
Remember for example if t... |
I'm designing the base classes and I don't know if I should add the field 'domainEvents' to the Entity class or only to the AggregateRoot class.
I must add the code for add and remove events in Entity.cs or AggregateRoot.cs
private List<INotification> _domainEvents;
public IReadOnlyCollection<INotification> DomainEvent... |
Coming from Desktop development, I'm in the middle of my very first web project (as a small side/learning-project). I'm using ASP.NET Core 2. I'm already thinking about going mobile too.
What are my best options here?
First thing that comes to my mind is separating logic and data interactions into web API, which will r... |
Originally posted at CodeReview, but it was brought up that this would be better posted here. The other question has been deleted.
Creating some personal finance software, but running into an architectural issue. I have a class called Account that holds Transactions as well as SubAccounts. I'm very early into the codin... |
What are the best steps to convert multi-repos to a mono-repo?
This is what I have so far:
for each repo, check out the most recent branch (integration branch, usually)
for each repo, copy the repo folder to the new git repo (the mono repo)
for each folder, delete the old .git folder
Stage all the files, commit, and p... |
I just graduated from college and got my very first job. I start my first day tomorrow and my boss just told me that I am going to work on a project to build a Spring Boot application.
I am absolutely scared because I won't be able to code anything at all when I come in to work tomorrow since I have no idea what Spring... |
I recently wrote a program in which I wrapped a map data structure to increase the readability of code like so :
package wrappers;
import model.primary.customer.Customer;
import java.util.HashMap;
public class CustomerMap extends HashMap<Integer, Customer> {
}
I needed all the functions of the hashmap , and want... |
Section 15.3.3.3 of UML specification says:
Fork Nodes
A ForkNode is a ControlNode that splits a flow into multiple concurrent flows.
Also 15.3.3.4 says:
Join Nodes
A JoinNode is a ControlNode that synchronizes multiple flows.
Also 15.3.4.2 says:
Fork and Join Nodes
[...] ForkNode must have a single incoming Activ... |
I know that there is a hardware in CPU, the MMU which takes care of mapping a given address to physical address. For example:
int *ptr = 0x12345
Will make a pointer to my process address of 0x12345 which gets translated by CPU to a real address. Now my question is if I write a small kernel myself and run the above cod... |
Learning docker concepts and tried few hello world. Came up with below questiob which I could not find on google.
Say I am on Linux box. I want to to install and run windows (along with java, tomcat) in docker container on top of Linux. Is it possible
to run another OS like windows on top of Linux in docker ? I belie... |
I have a method that does something like this
public void addFunds(Account account, int price) {
int credits = account.getCredits()
account.setCredits(credits + price)
saveOrUpdate(account)
}
the method saveOrUpdate is already tested, so my question is: should I test the method add funds? I'm trying to follow... |
In an UML activity diagram, join nodes synchronise concurrent flows by regulating the flow of tokens. The UML specifications foresees that tokens can be rejected. Section 15.3.3.4 Join Nodes says:
If any tokens are offered to the outgoing ActivityEdge of a JoinNode, they shall be accepted by the target or rejected fo... |
I'm struggling with X-Script attacks. I think I understand what they are but it's unclear if they only affect public facing web pages (which I will define better).
The example I often see is where the attack is 'attached' to something public (such as a forum) where the user does not need to be logged in (and hence, a p... |
As a personal project, I'm setting up a MMO, and writing the server in C#/.NET Core.
As of now my architecture is as follows: The world exists of different areas ( you can go from area to area trough portals ). An area is called a 'room' on my server. Each room has it's own list of clients ( players, each with their TC... |
Suppose I have a live website running on a live database and I have a dev website that is a duplicate of the live website.
The live database is where customer transactions are stored.
Suppose I do some changes on the dev website and dev database like add another column in a table. How can I retain all of the customer t... |
I was reading on this SESE page about using a variable to indicate the object type, more specifically, an enum.
The accepted answer states:
When your weapon types enum just mirrors the class hierarchy, then
this is a blatant violation of the DRY principle - you encode the same
information, the type of a weapon red... |
I'm working on a dozen enterprise SPA's and PWA's and most of them require impeccable IE11 support. This has been a complete pain with countless problems every step of the way.
It occured to me recently that I could just focus on implementing SSR (server-side-rendering) instead and completely bypassing the need to supp... |
I'm preparing some web services with Spring WS. Due to it being contract-first, I followed its guide and prepared an XSD.
So far, my Web Service request XML looks like this (this is SoapUI rendered request):
<soapenv:Envelope ...>
<soapenv:Header/>
<soapenv:Body>
<sch:WorkOrderRequest>
<sch:workOrd... |
As a fun hobby project, I'm writing a simple bytecode VM and a compiler from a basic high-level language to the said bytecode.
(Offtopic: the compiler is inspired by Jack Crenshaw's awesome tutorial - Let's Build A Compiler. Really worth a read if you aren't familiar with it).
Writing the VM got me thinking - what is t... |
I asked similar question earlier this morning, and for whatever reason, I'm not getting a complete answer to my question. I'll ask it a different way.
I was attempting to understand Eric Lippert's blog series Wizard and Warriors and see the difficulties that can happen when you try to use the type system to encode the ... |
Summary
When writing methods to query for related entities, is it better to have a single method for all related entities or separate methods for each combination?
Full Problem
I'm writing repository classes for a .NET MVC project where each repository is responsible for querying for a specific entity type. I'm using D... |
Why can't we directly convert octal number to base 8 to hexadecimal base 16 directly ?
We can convert to octal by first converting it into binary equivalent, or by converting it to decimal equivalent .
But why can't we directly convert base 8 octal to base 16 hexadecimal?
|
I have an aggregate root called SizeRangeAggregate which holds the range of size of clothing piece dimension and price for that range.
I created an post rest API which create new SizeRangeAggregate. It follows the CQRS/ES which means
it creates CreateSizeCommand
publish it to CreateSizeCommand command handler
gener... |
I am practicing building applications using MVVM and WPF+C# by making a "finance application".
The application contains several views with their own ViewModels. The views are in a hierarchy and are defined as UserControl with their ViewModel specified in XAML.
One main model contains different financial information th... |
I am working at a company that deals with software specifically designed for 3rd-party customers in a Business-To-Business scheme. We have variations of a large software, that for every customer get specialized and ultimately we end up with different editions of the same parent program.
Because we are actively dealing ... |
I have a set of tables that defines the workflow.
Say possible states are New, InProgress, Cancelled, Complete. I have a worfklow steps table that defines which new state the current state goes to using a user response such as approve, decline, cancel, complete.
My question is how would you turn this data into a flow... |
I work with SQL Alchemy a lot and, as a "lazy programmer", I enjoy the convenience it offers. But the "diligent programmer" in me often worries about optimisation and the performance of the queries and more the performance of my application in respect to those queries.
A major pitfall that programmers face when using a... |
I am a software developer and I have developed a "software" with the following architecture: the front-end is developed in javascript using VueJs and NodeJS connecting to the back-end in python (framework Flask) via REST Api and as DB MongoDB.
If it matters NodeJS and Flask are running on the same machine instaed of Mo... |
When I created a c# desktop application and move the exe file to another computer that has anti virus security, the security program shows an alert as unknown exe. I want to create a desktop application and a windows installer. How can I solve this problem? The virus programs should not alert an unknown exe.
|
I am the DevOps/CI for my team of somewhere around 10 developers. We develop and implement a sophisticated scientific data collection and visualization web application. I am the person who introduced CI to my team and standardized and streamlined the build process using Jenkins, Maven, Python etc. We use Subversion for... |
I was wondering what the state machine for a video player would be like.
I can think of two states : playing and paused.
When the video is playing and the user clicks on a point in the progress bar the video is paused (the video player transitions from the playing state to paused state) until the user stops pressing... |
I want to know if including a file summary comment at the beginning of each file is a good way of knowing what each file does or is there a better way.
|
We are working on API's that call other API's that will inevitably retrieves/update a system of record like an SQL, MySQL or other database. Sometimes we'll have 3/4 layers of API's before the SOR is hit.
Normally I would use a repository class when executing functions against a system of record directly via Entity Fra... |
Consider two classes Dog and Cat both conforming to Animal protocol (in terms of Swift programming language. That'd be interface in Java/C#).
We have a screen displaying a mixed list of dogs and cats. There's Interactor class that handles logic behind scenes.
Now we want to present a confirmation alert to the user whe... |
If I use .Net Core 2.0 my software must by 'open software' or what?
Sorry for my English.
|
I am planning to set up an event driven architecture using Spring Boot apps that publish and read messages from a Kafka broker.
Let's suppose it were an e-commerce application with the usual events (order placed, payment processed/failed, item-reserved, no-inventory-availability, order-shipped, and so on).
In my busine... |
My question is regarding the polymorphic Open-Closed Principle.
Say I have the following client:
public class Client {
private Server server;
public Client(Server server) {
this.server = server;
}
public void purchase() {
server.processPurchase(new Purchase());
}
}
This is the ab... |
I am trying to convert an ER diagram into a class diagram. Below image is showing that part of my ER diagram and which contains a weak entity call 'Parent'. Therefore when we consider the ER diagram, what happened to the weak entities while designing the Class diagrams? Does this weak entity it create another class or ... |
I'm programming a mobile app which makes use of REST services.
Some of the services are for logged users, so I have a login endpoint which lets me enter my credentials and get a JWT token for accessing protected APIs.
I want to be able to login one time and have the app remember me without asking me to login again each... |
I have a class, call it App, that will instantiate and own a set of classes of type Agents, each of which will instantiate and own a set of Listeners. Ownership is unique and non-transferable, hence obviously, std::unique_ptr. And ownees can vary in number, although they won't usually be to many, hence, a std::vector<s... |
When I first a codebase, I frequently take notes about it, as this SO answer suggests.
If some code chunk is small enough, I copy-paste to Word, print it out, and make hand-written annotation. If the code is long, I write down the line number and my comments about that line of code.
This process works, but is woefully ... |
Let's say I create an application that is free, let's call this Software A
and then I create the same piece of software but with some premium features, this will be Software B.
Let's say I advertise Software A and people like it and start buying Software B.
What stops them from (after purchasing Software B) to not just... |
When taking an agile development approach, it is obvious to only implement features when necessary. My question is: can the same be applied when it comes to testing, i.e. creating test cases and only test when necessary, or is that a bad idea?
|
Let's assume that I have to deal with an unreliable system accessed by many users that goes down/fails, let's say, X times for X minutes weekly. If only one of the following can be improved due to whatever reason, what's more important: ensuring double the availability of the service or double the mean time between fai... |
for example, Suppose I have a 2d array:
let filterArr=[
[1,1,0,1,1],
[0,1,1,1,0],
[1,1,0,1,0]
];
I want to find and store the index of column that all are 1, i.e.:position 1 and 3, and the codes are the following:
Use Array:
let filterArr=[
[1,1,0,1,1],
[0,1,1,1,0],
[1,1,0,1,0]
];
let results=[];
for(let ... |
I'm planning a cookbook-like Android app that would let users store/add/edit their e-juice recipes, keep track of the ingredients, etc. Internally, I'll be storing the data in a database on the user's device (Room, which is an SQLite wrapper) and keep a copy on the user's Google Drive so that they can access it from ot... |
File Top.h
#include <string>
...some code...
File Bottom.h:
#include "Top.h"
void someFunction() {
string s = new String();
...
}
The Bottom.h does not contain an include for the string header, but the code will work because it's implicitly been included by Top.h
Now, if Top.h changes for any reason not to inclu... |
I am not sure where this is going to go, and I am not sure if this is even the right Stack group to be posting in for this matter. But simply I want to create from scratch using my knowledge of C# a means of updating a program using Delta Updating.
So firstly some background, I want to create an app store (totally hyp... |
My team and I want to translate an entire React-redux app into another language (english to arabic) and have a switch that does the app-wide translation via a redux action. The content for the first language is already written and hard coded.
I was wondering if I could get advice, tips, pointers on how devs on here wou... |
If you create a function, which should make the use of typeconversions more easy, but it maybe leads to more errors, would implement it globally, and what may speaks against it - when the readability seems to have improved?
For (a simple) example:
public static T EnforceConversion<T>(this object Result)
{
return (T... |
A long time ago I asked about using an enum to essentially use as a poor version of instanceof to make decisions about an object.
As stated in this answer:
When your weapon types enum just mirrors the class hierarchy, then
this is a blatant violation of the DRY principle - you encode the same
information, the type... |
I've come across a problem that doesn't occur in our development environment or test environment, but does occur in our production environment.
Obviously, this environment is pretty locked down, and all the code is compiled.
Are there any tips on how to debug problems with back end code in a production environment?
If ... |
My team has been trying to switch to Agile recently. The line manager has been taking 1-2 days per user story as a hard limit rather than a guideline, and framing it as a failure of the developer if the time limit is not met. I am not sure if that should be the case since there are a lot of unknowns and possible blocke... |
I have a question about how I should implement a new action for a resource on my API layer.
I have a Timesheet which is used by people to let us know how many hours they worked on a job. This timesheet has a status:
Open (Still in progress)
Submitted (Will be reviewed by a department)
Rejected (Rejected by the depart... |
Disclaimer: I'm sure this has been asked here before, but I haven't been able to find it.
I'm trying to create a system where one central computer (master) can initiate commands on other computers (slaves) without them requesting anything first, and have those slaves respond to the master when the task is completed.
My... |
What I'm going for is something like GNUCash or any type of personal finance tracking software that looks similar to this:
That is the main page listing all your accounts; then when you click an account it opens up a data grid that allows you to add new transactions. So obviously you want your balance to be updated im... |
I'm developing a computer game. It is a single person hobby project. I will implement it in common-lisp. As proof of concept I'm trying to procedurally generate a scene by randomly selecting entries from several tables. The scene should dynamically react to the player.
I intend to use a custom kind of entity compon... |
I like to separate business logic out of POCOs into controllers.
If an object must be thread safe, where do I put the lock code? In the POCO itself? Or in a controller?
Might make sense because value types cannot be locked?
I.e., the controller:
namespace Project1.Controllers
{
public class LogManagerController
... |
Is it possible to write a program in a language unsupported by an editor or IDE, save it, then run it in different IDE or editor that does support the language?
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.