instruction stringlengths 34 36.1k |
|---|
I have a problem to solve that's very much like a thread pool, and I was hoping to hear some strategies or find some resources to information on managing the size of the pool.
Let's say I have the following:
public interface IWorkerBee : IDisposable
{
Task Configure(WorkerBeeConfiguration config);
Task<WorkIte... |
I have made a lot of forms for my desktop application, some forms were using the same method which I have to copy and paste the code (not OOP).
Let's say I have a method called FirstDayOfWeek() and this method is needed in 5 forms, that means I need to copy and paste the code 4 times to the other forms.
What I want to... |
Issue: I provide a small web portal for customers with partial personal data like name, address etc. which is stored in the database in plain text. Now I need a safe concept to encrypt the personal data in the database. The encryption is no problem, but how to handle the decryption of the data? 1.) server-side: proble... |
When a caller makes a call to a callee, exception's are used to inform the caller that something different has happened so that he could change the flow of the program if required. In that sense, exception is not an error but a predictable outcome at layer of abstraction it was raised from. Most programming languages s... |
My application stores two different types of json data in s3.
For example: Schema-Foo and Schema-Bar.
Up to now I used the content-type application/json for both.
I would like to make a distinction between both types in the s3 storage.
I am unsure what the best way would be.
Is it possible to do something like applicat... |
I am investigating how to test a project. Some information about the project:
Microservice architecture, with roughly 20 services. About 10 of them
with a separate database.
We use ServiceFabric
There is a fair bit of service to service communication.
Each server is a separate repo. With no references to each other.
T... |
So I'm running into an issue with us trying to test multiple features in our QA environment at the same time. Essentially, changes are taking too long to get promoted in our CI/CD pipeline.
The way we have it set up now, we push feature branches directly into our QA environment if the build passes. We're using docker s... |
I have being learning about deep neural networks and how the increase in hidden layers give better results. but the problem that i found was we usually get rid of loops in calculations by using matrices. Is there any way to remove the for loop which loop though the layers in forward and backward propagation?
|
I have two models in my current design, student and group. Student and group are both aggregate roots.
A student can be added to a group (method on group aggregate root), and it can be active for either the whole duration of the group or part of it. The group has an invariant which says that "all students added to a gi... |
A company I work with uses a "skeleton" project as base scaffolding for each project they have.
I work on several edits to the skeleton. Some of them are few lines on huge source files. What's a good way to document all the edits I'm making?
|
I have a simple c++ code as the following:
#include <iostream>
int main() {
int a = 5;
int *b = (int *) malloc(40);
return 0;
}
Setting a breakpoint using GDB on line 5 and running disas will output the following:
Dump of assembler code for function main():
0x0000000100000f60 <+0>: push %rbp
0x000... |
This is a general question seeking guidance for the best practice(s) on implementing a Single Sign On (SSO) across many various installations of the same application.
The hypothetical example I would like to pose - imagine you have 200 Wordpress installations / websites that you manage. In order to log into each envir... |
I have a switch structure that has several cases to handle. The switch operates over an enum which poses the issue of duplicate code through combined values:
// All possible combinations of One - Eight.
public enum ExampleEnum {
One,
Two, TwoOne,
Three, ThreeOne, ThreeTwo, ThreeOneTwo,
Four, FourOne, Fo... |
For my application logs for a REST server, I'd like to log some details about each http request. I'm using sl4j. Should I use logger.debug or logger.info
More generally what sort of things should be logged in logger.info?
|
While researching RESTful API frameworks I've come across (generally speaking) two types of frameworks:
The first type will (more or less) directly (or nearly directly) map an ORM/ODM scheme of your database to the resources. For example, tbone.
It does give you options for what fields to expose, as well as the abilit... |
The issue I care about here is high throughput, there are a lot of sensors (monitoring devices) which send data to the server at high frequency.
It looks really like that we have to use UDP protocol for such kind of data transfer. However I've never used UDP for high-level logic API programming, a Web API using http wo... |
Working on a huge application with lots of legacy code, I often encounter environment "checks":
db_name = Rails.env.production? ? 'staging_db' : 'production_db'
...
desired_processes_count = Rails.env.production? ? 6 : 1
...
Rails.env.production? ? "index,follow" : "noindex,nofollow"
and so on. It's Ruby on Rails, but... |
I am trying to follow scrum framework as much as i can but i am facing some confusion. I like to know what are the standard guide lines for a sprint. I am designing the sprint but i am not sure to get to a concrete value in terms of hrs/day. And what is the standard practice ? Should i also lock meeting hours, deployme... |
I'm rather new at programming so I'm still getting a grip on things.
I'm creating an offline login system in C# that will have the ability add/remove users. The computer will not be connected to the internet.
This was the approach that I was going to take:
Have the username and a salted + hashed password in an XML file... |
I'm reading the Scrum - A Pocket Guide by Gunther Verheyen and it says:
The Chaos report of 2011 by the Standish Group marks a turning point. Extensive research was done in comparing traditional projects with projects that used Agile methods. The report shows that an Agile approach to software development results in a... |
Quoting the known Mike Cohn:
The primary reason for estimating product backlog items is so that
predictions can be made about how much functionality can be delivered
by what date. If we want to estimate what can be delivered by when,
we’re talking about time. We need to estimate time. More specifically,
we nee... |
I'm looking to do some simple data mining that consists of going once per day to a single page and collect the following information:
List of movie theaters
Movies today on each theater
Session times for each movie
Availability of tickets for each session (boolean yes/no)
I want to catalog this information and after ... |
I want to integrate code python (hierarchical clustering algorithm) with code C#.
(The idea of the project is to divide similar people and put them into classes using the algorithm. We use language c# (asp.net) and want a method to link the algorithm to the code.)
|
I have an unresolvable dependency issue in a Maven project; different pieces of code depend on different versions of dependency A (i.e. most code needs A:0.15; some needs A:0.18). Fortunately, the code is completely separable; that is, the parts that depend on the two different versions can be split into two different ... |
Our team has decided to develop using BDD/TDD in an effort to become the Agile team we're supposed to be. Vertical slicing appears to be an important part of agile working and gaining the quick feedback we require, although I think we're going to hit a problem when we start dividing our PBI tasks between us.
We are cre... |
I've been looking into dependency injection, what it is, how it works, how it's being used. It's a neat system and to understand it a bit better, I'm going to implement a small demo app using this system.
I primarily write in JavaScript so it comes natural to look for inspiration in the same ecosystem. Unfortunately, t... |
I am having the requirement in my project, that nodejs server has to send the notification (kind of push notification) to our mobile, and user( or mobile holder ) have to act on that notification like processing some action, and post back to the nodejs server. As I am very new to the android development, I want to know... |
I'm in a discussion with a co-worker concerning the use of structs. I have a couple of structs that contain several static properties that are used throughout our website. The value of those properties are all strings. They're not very long, the longest value has 29 characters.
His argument: "I am saying there is no pe... |
I'm not a software engineer, but I like coding for myself. Thus, I don't know what goes in IT companies.
Keeping the amount I spend on GitHub, I never heard of the term QA/QC in regards to open source. The most related term I've heard is unit testing.
Is my assumption correct?
|
I currently have an object that is composed from several simple objects. Each simple object is used to render a particular portion of the larger object as a whole. Think of it as building a 3D structure such as a house for rendering to the screen:
House
Walls
Roof
Windows
Doors
Now, in most cases, we can just rend... |
I keep my Ansible based deployment module in the same repository/directory as my application code.
I use Mercurial for my VCS.
The inventories file is ephemeral as the IP's of the cloud hosts keep on getting modified.
The inventory file also defines groupings of hosts which is key information in ansible roles. So I jus... |
To provide a very blunt example (as I am at work and can't currently think of a sensible example).
If I write a groovy class like this
class Wendy{
byte[] frank
String doSomethingWithFrank(){
frank = someServiceThatReturnsByteArray()
}
}
And then groovy makes me getters and setters under the hood
... |
Consider a simple web application, I'll use a Python(ish) example, but i think the question is relevant for other languages as well.
The user is trying to fetch a page, and in order to render that page, the application has to make an external call to a remote service. In the example, I'll try to separate concerns: coll... |
One of my projects on GitHub has received a vulnerability alert, in this case of moderate severity.
The vulnerability has been detected in a dependency of an old version of the code. Current versions do not use this dependency anymore. Nevertheless, old commits may potentially be checked out and run, and open up the ap... |
Given is a short Java function and I like to create a control flow graph for it but I'm not sure if it's fine like that? Because I left some things away such as variables that have already been created with the function together (int[] A, boolean[] boo).
boolean func(int[] A, boolean[] boo){
boolean res;
int n,... |
Is it normal to have a bounded context spread accross multiple APIs or should there really be one API per bounded context?
I am trying to understand if I can use the Scatter Gatherer pattern (https://www.enterpriseintegrationpatterns.com/patterns/messaging/BroadcastAggregate.html) in a hobby application I am developi... |
In my work we use the scrum board for the registration of activities, however there is always a dilemma of what to register there, some colleagues want to register on the scrum board the email answer (even to create a new user story), arguing that both the reading and the answer cost them approximately one hour of work... |
Say I want to (try to) read through and understand a fairly complex piece of code (for example the free software Coreboot firmware code, which can be found here). How can I figure out where the code starts? As in, what is the first line of code that will be executed when the program runs?
I have some basic familiarity ... |
A coworker of mine recently setup testing in a new project (a JS library) where a transform step hooks in to the babel config for Webpack in the production config.
For reference, this is the setting used with Jest: https://jestjs.io/docs/en/configuration.html#transform-object-string-string
The production build targets ... |
I have a static class called RenderingUtilities that houses several useful methods and constants. Some of these constants are related to the Earth as an object such as the Earth's radius. I believe the constants related to the Earth should be contained in the Earth class, but have conflicting thoughts on it since the R... |
At the moment, I'm working on a product that's being broken down from a monolith to a bunch of microservices, and it seems to be going well enough.
However, if a user is abusing the service somehow, we're not sure how to leverage that information to block the user. For security reasons, we don't pass (for example) IP a... |
I am currently working on a project that has very little documentation overall. The team is working to change that. I am doing my part, by adding xml comments to the methods I make and the ones I edit, so that the automatic documentation generation tools can use them.
For some methods, complexity is either obvious or i... |
I have a set of tasks I perform to complete some larger operation. These tasks must be executed in linear order, and you cannot proceed onto the next task until the previous completes. For the most part, these tasks chain to each other and have no dependencies on state outside of the "chain", other than perhaps transfe... |
I have a car object. The car cannot be driven unless it is turned on. When should I check to see if the car is on before I try to drive it?
In the main program?
class Program
{
static void Main(string[] args)
{
Car myCar = new Car();
if (myCar.isOn == false) //check here if car is on
... |
Simplified question with a working example: I want to reuse a std::unordered_map (let's call it umap) multiple times, similar to the following dummy code (which does not do anything meaningful). How can I make this code run faster?
#include <iostream>
#include <unordered_map>
#include <time.h>
unsigned size = 1000000;... |
According to When is primitive obsession not a code smell?, I should create a ZipCode object to represent a zip code instead of a String object.
However, in my experience, I prefer to see
public class Address{
public String zipCode;
}
instead of
public class Address{
public ZipCode zipCode;
}
because I think ... |
I’m new to React/Redux tools and still figuring out some idiomatic design patterns.
Here's a scenario:
A user adding a place marker (that has some associated metadata) to an interactive map (Leaflet), which should be held in state.
I’ve just come from MeteorJS, in that situation it would go something like:
User defin... |
I'd like to hear some pros and cons about where it's best to put Haskell typeclass instances. I identify 2 possible cases and can not decide for myself which one is best:
Put the instances together with the typeclass definition;
Put them together with the types that implement it.
For the sake of this example, lets sa... |
I'm having a discussion at work that event-based architecture should not be used in a scenario that we have multiple producers and a single consumer.
In our company, we have many external integrations that in my view, would be allowed to send an event to our queue. My proposal is the following:
Integration receives in... |
I´m using a framework for javascript to display beautiful alert boxes. This framework uses another framework to actually display the boxes. So it´s something like that:
let showAlert = function (type, message, title) {
opts = {};
opts.title = title;
opts.type = type;
opts.confirmButtonText = 'Confirm';... |
My team and I are working on a large web application, and I've noticed that we're working in a way which I believe is an incorrect usage of flux (probably from lack of understanding).
We're using Angular 6 and angular-redux, but we use angular-redux more as an event manager than application state management i.e. dispat... |
I am assigned to a project where we have about 20 micro-services. Each of them is in a separate repository without any references to any other, apart from one Nuget package where we maintain some generic code like math functions. Each service reference the others by endpoints.
The advantage of this is:
Each service is... |
I have this method
arr // input
new_ seq = []
for i in arr:
new_seq.append(i)
__new_seq = [x for i, x in enumerate(arr) if x not in new_seq]
for j in __new_seq:
new_seq.append(j)
__new_seq = [x for i, x in enumerate(arr) if x not in new_seq]
for k in __new_seq:
new_seq.append(k)
Ho... |
We are developing a system whereby documents/files will be stored on a specialized Content Server and uploaded via a client.
However we want to be able to develop this so if we need to, we can swap the Content server out with a generic network folder. This is so we can test the other parts of the system in isolation an... |
I have the following branches in TFS
Dev
2.3.0-Printing
Main
Rel
2.3.0
Dev\2.3.0-Printing was branched off of Main and after completing and testing was merged back up into Main, which was then branched into Rel\2.3.0.
A bug has been found in 2.3.0 so I'm trying to figure out a branching strategy for 2.3.1 which wil... |
Months ago I began a new web project which, in the beggining, seemed like a small application with virtually few users. I began the project by using the awesome Hackathon Starter WebApp Boilerplate by Sahat because the initial requirements seemed to fit into that boilerplate. As you may expect, the project requirements... |
While studying the visitor design pattern i found this phrase:
You can use Visitor along with Iterator to traverse a complex data structure and execute some operation over its elements, even if they all have different classes.
Visitor design pattern
While searching on the internet if it was a good idea I found differ... |
Please see the below diagram.
There are two apps that each have a different set of functions, User A is a user of App1 and User B is a user of App2. They should not be able to log in directly to the other app.
App1 and App2 both call each other to share some of their functions so although a user can not log in to the ... |
I'm relatively new to AWS. I'm working with what I think is a common pattern:
Put file in S3 bucket
Do something with said file in Lambda function
I see two options for making this link (ignoring SNS):
invoke the lambda when an S3 event occurs
send the S3 event to an SQS queue, which in turn triggers the lambda
It ... |
Suppose there 5 pages to a website. User flow will be 1->2->3->4->5->FINISH. I want to implement is that whenever a user enters page 3 a timer starts and if he doesn't finish a task within that time it is redirected to page 2.
I am thinking of implementing it using a Higher Order Component(HOC) which on mount starts t... |
I'm developing a small web-app to help users manage shopping lists.
One of the required features is the ability of the application to notify the user if a shop of the same category is near him/her.
To do so I'm using Foursquare API.
Said API needs a KEY and CLIENT_ID to make the request.
Requests are made by t... |
I'm building a system where I need to measure certain algorithms, which are written by the end users. Obviously running external code is a huge security risk, therefore it needs to be isolated. The current solution is to start up docker containers for each submission, run the code inside the container, then terminate i... |
I used to call functions which returns int error code or 0 on success like this:
int tmp = function_a() ?:
function_b() ?:
function_c();
if (tmp)
handle_error();
Now I'm working on a project which -std=c90 -Wpedantic and I get:
warning: ISO C forbids omitting the middle term of a ?: expres... |
I am building a mobile app which lets users search for POIs around them on a map. I am curious to know what would be the best way to "group/paginate" these results in order to avoid downloading hundreds of search results at once from the server?
I looked at Google Maps as an example and the way they seem to do it is th... |
DDD/"hexagonal architecture" insist on separating the domain, aka model, from infrastructure requirements. This looks clean and logical until you realize that storing your domain object in memory might hurt performance if the domain object happens to be too large, and even more so fetching such domain object from persi... |
I'm trying to apply DDD principles to an application that has a REST API in front and is backed by an SQL storage.
Here's the entity structure I have come up with so far:
Client: 1 ---- * Contract: 1 ----- * Contract-AddOn: 1 ----- * Feature
The REST endpoints will basically represent the same structure. From
/api/cli... |
I'm writing an importer, it should fetch some data from the database and put that data into appropriate places.
Now the question is, should the importer itself fetch that data, or should that data(to import) be passed to the importer and database fetching would be done outside?
What's a better way to design this?
|
We're evaluating CQRS/ES for a high-volume subsystem in our app in order to take advantage of distributed systems and ensure uptime. This is my team's first time implementing this architecture, and I'm struggling to finalize the aggregate design because the core entity changes during the transaction.
This subsystem con... |
There's DSL format for creating and distributing dictionaries. Every dictionary article in such formats looks like this:
algorithm
[m0][b]al·go·rithm[/b] {{id=000001018}} [c rosybrown]\[[/c][c darkslategray][b]algorithm[/b][/c] [c darkslategray][b]algorithms[/b][/c][c rosybrown]\][/c] [p]BrE[/p] [c darkgray] [/c][c... |
Let's say I have a class with a property that returns an array of strings.
public static string[] MyStrings
{
get { return new string[] { "Foo", "Bar" }; }
}
Will this create multiple instances of MyStrings every time it is referenced? Are there compiler optimizations that effectively make it a singleton, or do I ... |
I have an ASP.NET Core 2.2 MVC site, that uses Facebook as an identity provider. Users can click the login button, they are redirected to Facebook to enter their credentials, and are then redirected back to the site. At that time they are authenticated, and I have a number of claims like name idenfifier, email etc. Thi... |
So, I wasn't sure if this was the place, but I have faith the mods will move it if necessary.
I'm about to leave on a trip to another country with the management team for a new project. It's my first introduction to a new industry and we will be attending a conference on the industry of the new product we're building a... |
I usually use IoC frameworks to inject dependencies that are services. Is it ok to mark classes that are data objects as IoC components?
To be more clear I will give an example.
I have an abstract data class A in one assembly.
[IoCBase]
[Serializable]
public abstract class A
{
//possibly some method signa... |
Java and C# provide memory safety by checking array bounds and pointer dereferences.
What mechanisms could be implemented into a programming language to prevent the possibility of race conditions and deadlocks?
|
Background
I am currently building this project with VBA, just to keep in the back of your mind when thinking about my question.
Imagine 2 adjacent blocks, in Excel. The first block is made up of columns A, B, and C. The second block is made of columns D, E, and F.
The first block is filled with data from a file publi... |
My apps commonly have one or more prop holders. These holders contain config data used in the app such as:
@Component
@ConfigurationProperties(prefix="app.orders")
@Data //lombok
public class OrderProps {
private int maxItems;
// other order props
}
Various components that use one or more of these props get... |
I'm at the point where results need to be cached to make the application more responsive.
From experience in a previous project, countless (to say the least) bugs occurred because there was lots of cached data which was never updated correctly because no one had the mental capacity to remember where everything was unti... |
I'm building a microservice-based application (services according to DDD) and am about to implement authorization service. There are API gateways and UI applications that access backend servers, and they all need to query the authorization service.
Consider an ebay-like app with staff, sellers, and buyers. In my system... |
I am developing a new feature for a well-established memory package. The feature Im implementing is about loading/copying/moving resources in and out to different type of structures like jars, libraries and so.
I started with writing tests first. I felt i need an test artifact, like a sample file/DLL/txt whatever, howe... |
I have a problem with deciding algorithm for color quantization. The image that I want to do color quantization is an RGB image with resolution 512 x 512. I want to reduce the color value in the pixel to reduce the image size.
I don't want to use the popular algorithm k-means. And I found this mean shift algorithm.
Me... |
Recently I have been working on a rather large system with Vue.js for a single page app (SPA) and an API for the backend. The customer is concerned with the security, performance and maintainability.
So, I'm thinking along having API broken into 3 separate pieces:
the security api which authenticates/authorizes, issu... |
I'm working in this scenario
Post entity has many Image entities.
I also have repository to both entities:
PostRepository
ImageRepository
Since this entities are tightly related, when I get a Post I want to return the list of images also.
I have to possible ways of do this:
The orchestator (in this case a PostServi... |
I want to know why maintainability is important?
All I know is that software require updates and patches to either add new features or fix occuring bugs and errors.
But is there more to it than what I just said?
I also know that to make a maintainable software, there are certain things to follow and do. Such as good te... |
I'm currently writing a library in C++ and was wondering if I should log from within it. Googling the issue I came across this question but it makes reference to a logging facade. Is there anything equivalent for C++?
|
What is the difference between operating system API and system-call interface ? I have read at many places that both act as interface between program and the kernel. Then what is the actual difference between them ?
|
When we talk about sourcing events , we have have a simple dual write architecture where we can write to database and we can write the events to a queue like Kafka . Other downstream system can read those events and act/use on it accordingly.
But the problem occurs when trying to make both DB and Events in sync as ord... |
Suppose I have 3 UML Class diagrams. One is University, other is College, the other is Department. Each University can have multiple colleges, each college multiple departments. I have the UML class diagrams for these, where I assume there is a association relationship between University and college, and between colleg... |
I recently worked on a file explorer within a console window (like Midnight Commander). I want to use ncurses as library. I have encountered some fundamental problems with my design and searched on the Internet for solutions and better practices.
However I ended up scrutinising my whole programming work and my approach... |
I am designing a few different systems that revolve around a core system used to manage users, groups, associations between users, group memberships, user profiles and some other things.
System A is a task management system with tasks, assignments, attachments, etc...
System B us the user system.
System C is associa... |
In my web app I have a long running operation that is processing some entity in the background. The state of this process should be visible to the clients. During the processing the UI should show something like "entity is being processed" and when it's finished "entity has been processed". My first idea was to model t... |
As you may know, we can use GDB and set breakpoints on our code to pause execution for debugging.
My questions is, how does GDB pause a process and let you view the content of registers using i r for example. Aren't those register being used by other OS processes constantly? how do they not get overwritten?
Is it only ... |
I have compiled the following simple c++ code:
#include <iostream>
int main(){
int a = 5;
int b = 6;
long c = 7;
int d = 8;
return 0;
}
and here is the assembly:
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset %rbp, -16
movq %rsp, %rbp
.cfi_def_cfa_register %rbp
xorl %eax, %eax
... |
Next semester we'll learn the mvc pattern in web development but since it looks pretty interesting to me i decided to learn it now but...there is a problem. Surfing trough the pages i found two approaches to the mvc pattern(in php):
ONE
TWO
Now my question is which one is the right approach? (and is there any guide... |
There's a complex model which represented by complex JSON with multiple fields and nested objects. Recently we have discussed in which way indicate to the backend that the object needs to be saved as new. There're two many proposals:
remove id field from the model to indicate backend that new object needs to be create... |
An application provides a REST interface to offer status and statistics information.
localhost:1111/stats -> return JSON encoded statistics
localhost:1111/status -> return JSON encoded system status
Now, the user also wants to see the results nicely presented in an HTML page, for example under
localhost:1111
localhost... |
When compiling C code and looking at assembly, it all has the stack grow backwards like this:
_main:
pushq %rbp
movl $5, -4(%rbp)
popq %rbp
ret
-4(%rbp) - does this mean the base pointer or the stack pointer are actually moving down the memory addresses instead of going up? Why is that?
I chan... |
I am developing a distributed application built as a collection of separate services which are served from multiple load balanced instances and trying to wrap my head around the distributed configuration problem.
As my background is embedded systems, and not so much about large scale SaaS systems, I'd appreciate some ... |
So I've done some searching but can't seem to find a whole lot of suggestions on this topic. My question is what are some opinions on the best way to receive messages from an Amazon SQS queue on a .NET Core based WebAPI microservice ? The whole project consists of around 5 microservices and is utilizing AWS for infrast... |
I am suspecting cache latency issues due to constant data (or same data across multiprocessor caches) being churned up in the cache coherence protocols. Is there a way to specify specific data as constant so as to avoid snooping or such messages being passed around caches for that data?
|
We are developing complex application on the top of the ROS framework in C++ and recently ran into discussion how to provide parameters to the parts of code far away from the starting main().
The application is a kind of a server. It has a listener for incoming requests that then finds a suitable factor for the worker ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.