instruction stringlengths 34 36.1k |
|---|
I am implementing a certain algorithm that works like this:
Create a closed contour (list) of elements in a matrix, where closed means that the last element is adjacent (by row, column) to the first.
Weight (multiply) each of the elements addressed by the contour by a scalar associated with the element's position in t... |
I really like to make tools prior to starting some assignment, so for the C programming assignments I have prepared dynamic array library. We are restrained to only using C99 standard.
Note that all programming I'm describing below is, as per question title, done for education purposes. This is not production code but ... |
What are the Benefits of running a UniKernel. Isn't it more work to coordinate multiple UniKernels spinning up and down versus the traditional application?
What pieces of Software will be rewritten using a UniKernel, where does it make sense?
|
In my code, I'm using repository pattern. For example, I got deal repository. I just curious how you decide the name of the function when the function itself doing so many things. I think when the function name too long it can decrease code readability. Is this considered bad because of function name too long in terms ... |
A recent question mentioned the term canonical schema in a context of microservices architecture. After reading the Wikipedia article, as well as one of the answers to the question, I still don't understand what canonical schema is about. I get that it's a way to decouple the microservices by doing some magic with the ... |
I am currently coding a productive study app. In my app, the user can input a list of productive, non-productive and necessary tasks which he will be doing throughout a period of time. The user is able to click which task he is going to work on and the app will track the time he has spent on that specific task. At the ... |
I've been reading a lot about different servlets/application servers like Tomcat, WildFly, Jetty and GlassFish. However, I don't understand if they're only used for testing server-side code during development, or can you also use them for deploying the final production code to end users (commercially)?
My understanding... |
Let's consider the following objects :
Article which can be of different types
Equipment which point to an Article, some fields on equipment are only used for some types.
I want to add constraint to the Equipment, this constraint depend on the type or Article. I have three choices :
Use triggers so I can query the... |
I have a big challenge to solve where I have some ideas but I don't know what would be the best solution.
Basically I have to develop an application where I have to develop a back-end(web service) and Multiples front-end. The core for all the applications is going to be the same, same requests and functionality.
What ... |
For the example's sake let's say there is a given file math.js. Think of it as a module containing many reusable functions.
The content of file is:
export function area(shape) {
normalize(shape)
... // real stuff here
}
function normalize(shape) {
... // real stuff here
}
export function circumference(shape... |
The scenario:
Our customer creates physical devices used in infrastructure across the globe
Their new devices have IoT capabilities and can communicate their status and other sensor data to the cloud
We are building a web portal that displays information about these devices
This web portal provides access to customers... |
My team and I are trying to follow semantic versioning 2.0.0 to keep tabs on our library versions. We primarily use C# for our development and are currently in a situation where we are going to add a property to one of our interfaces.
We are a little unsure how this influences the rest of our applications that use this... |
So I will be creating a feature to a php application that does the following:
Create a session that expires after 30 minutes.
After 30 minutes, if there is no user activity in the application (including typing to a textbox, moving a mouse throughout the page), the session will be destroyed and the system will redirect... |
My domain consists of lots of simple immutable classes like this:
public class Person
{
public string FullName { get; }
public string NameAtBirth { get; }
public string TaxId { get; }
public PhoneNumber PhoneNumber { get; }
public Address Address { get; }
public Person(
string fullName,... |
An interesting design choice/discussion has cropped up in code review, and I would like to understand more about proposed solutions. The original review includes re-factoring of a messy piece of code which I cannot share, but I think focussing on the problems with the original code is skewing opinions about what a good... |
During its evolution C# gradually gets more and more features which belong to functional paradigm.
Subjectively these features allow (at least me) to be more productive, fluent and write maintainable and readable code (well.. I thins so).
But I'm curious whether some rigorous proofs (not just testimonials) exist that ... |
For example, web application monitoring services like New Relic RUM or Bucky use JavaScript to collect data on a user's session and eventually send that data back to an endpoint. For New Relic, the data is sent to an endpoint like "http://bam.nr-data.net" with a great deal of parameters. With Bucky a similar payload is... |
We have an application that consists binary files (containing a mix of text and numeric information) and programs written in various languages that create, modify and read these binary files. Because the text fields are stored in a binary file, an individual text field is stored in a binary file as a fixed number of by... |
I'm trying to get my head around the big picture when producing a new website using ASP.NET Core.
I want users to my website to be able to register and log in with social media such as Facebook and Google. Once registered when they make requests to my WebAPI for resources I need to know which user is logged in so that ... |
I am developing restful services using resteasy for an application. This application has UI which will consume these rest services.
Now I am having a case where I have to do a server push to UI(Client).
Across browsing over internet I see Websockets, atmosphere2.0, etc.., however I am wondering how I can capture all t... |
I have Microsoft Azure Cloud Application built with App Service. It is supposed to be always "up" for its consumers. When we need to do upgrade and we still need to keep the older one active for sometime till its consumers need (max 1 month). Any other consumer will always use the latest version of the application whil... |
Let's say I have two classes Base and Derived : Base.
Derived shall be able to use a DerivedComponent : BaseComponent,
just like all other derivates of Base use their own derivate specific component.
All these BaseComponent components, like DerivedComponent, have some common functionality accessible
in Base.
Since I do... |
I've designed a single-instance database for a multi-tenant application which uses composite-keys to enforce tenant-segregation at the database-layer (thus preventing incorrect 3rd-degree relations).
So the schema looks like this:
TABLE Tenants (
TenantId int NOT NULL IDENTITY(1,1)
Name nvarchar(1... |
I've noticed alot of hatred about OpenSSL because of it's lack of documentation. And all advice and guide about the library must be passed around our people in song and story.
I always doubt myself, because how could hundreds of people put so much time into this wonderful work of engineering if they don't even write do... |
I have an idea of making application in php that will not have any public files other than index.php i.e. different pages of project load as parameters sent to index.php
Also if someone wants to book mark page its okay because i can probably use .htaccess to send arguments to index.php based on what page requested.
Do... |
Suppose I have the following interface used for publishing messages onto a message queue:
interface IMessageProducer
{
void Publish<TMessage>(TMessage message);
}
Normally, an implementer of this interface will attempt to publish a message onto the message queue immediately. However, I've found that sometimes I ne... |
I have two components, both are a parser/builder pair. So component A can parse A and build A, component B can parse B and build B.
A and B both contain different entities, which are extracted by the parsers.
Example, BParser works the same:
$AParserResult = AParser::parse(A);
dump(
$AParserResult->getEntityZ(),
... |
Just reading through the AWS CLI docs, and I've noticed that all JSON output is indented (i.e. "pretty" formatted)...
Doesn't this add a disproportionate amount of bloat to the responses?
If so, why would they choose to keep "pretty" formatting?
Is there a way to disable this?
|
We are using some sort of microservices approach in our app (although it is not really consequently adhered to).
When a service is down or throwing an exception, the approach is to put it into a queue (ActiveMQ), and retry when the service is up again.
Is this a "standard" solution? Or should it be avoided for some rea... |
I'm designing API for a python library that accepts asynchronous input and produces the asynchronous output: various signals come in, and various signals are generated in response (there's no one-to-one relationship between input and output signals).
The input could come from a network socket/file/interactive (terminal... |
In OpenGL you have to bind an object to the context to be used in subsequent calls, instead of just using it as an argument in those calls.
For example, in OpenGL you write this
glGenBuffers( 1, &vbo );
glBindBuffer( GL_ARRAY_BUFFER, vbo );
glBufferData( GL_ARRAY_BUFFER, verts.size(), verts.data(), GL_STATIC_DRAW );
I... |
I have a dilemma. Let's say I have an AST that describes some grammar, for instance. I can write a function to stringify this AST back into human-readable BNF form or generate a parser from it. I can and want to generate both from given ast. I can do it either by defining two corresponding functions, ast => string and ... |
I am thinking about adopting something like the GitFlow branching strategy. Instead of using a permanent develop branch, I would like to create a release branch for each sprint (from master) at the beginning of each sprint. Feature branches would be merged into the release branch. Our CI process (TeamCity) would be con... |
We are discussing in team regarding best practices.
For eg. there are three tables
Users
Groups
Teams
A user will create a request to join a Team or Group or to follow a Private User.
A request actions will be:
Create
Approve
Reject
Cancel
This process will be almost same for all kind of requests.
The question is: ... |
It's confusing because type declaration and usage both use the <T> syntax. I think there are only 2 places where you can declare new generic types in Java:
1. In the definition of a class or interface
class MyClass<T> ...
// ^^^- Type declaration
interface MyInterface<T,U> ...
// ^^^^^- De... |
I've published a small FOSS library (link below, but what it does is not very material to this question), on GitHub. It doesn't have releases yet, but it's quite usable and (sort of) tested.
Now, I have a beefy front-page document for the repository - describing design principles, giving some example mini-snippets of c... |
Using JS as an example here, if I am creating a library/plugin, and intend to make it available to others, should I keep it in Javascript? Or would jQuery be an acceptable dependency? At what point does the ease and added control of coding in jQuery outweigh the potential inconvenience of someone else having to include... |
I have a couple of Philip Hue lights in the hallway. These show the build status on their lights with a small Node.JS application. Its working like a charm.
Currently I am in the process of testing and refactoring this application, but in my app.js I have some lines of code where I am having a hard time to figure out h... |
I recently reviewed some C++ code written by a fellow student, and he did something I wouldn't think is necessary. In main(), he creates a class object on the heap with the new operator. Then he calls a method of the object, which itself calls the new operator to create a large vector.
My gut tells me this is unneces... |
I'm building a C# library and have some dependencies through NuGet packages. I'm trying to minimise entry barrier and using the very early versions of dependency packages. For example I use Newtonsoft.Json of v6.0.1, but current version is v9x.
This is for cases when people install my package, but don't have the lates... |
I'm working on an update of an existing medical software and I defined user stories together with some end users. If you're not familiar with medical environments: A doctor usually has multiple patients. Each patient has multiple cases (broken leg, skin disease, etc). In medical terms, a case will be closed once the pa... |
Here are the main classes I can think off the top of my head. All business objects will follow the abstraction (implement interfaces). I have not mentioned interface names
to avoid verbosity. I have mainly focused on high level scheduling algo and high level classes without going into too much details
Principles I mai... |
I am currently studying some basics on git Version Control System on tortoiseGit for my project management so far i know that Git keeps track of the history of changes, and allows you to easily go back to an earlier version if necessary.
However when it comes to binary vs text files I am unsure which files are more use... |
I'm just starting to explore SOLID and I'm unsure if reading from files and writing to files are the same responsibility.
The target is the same file type; I want to read and write .pdf's in my application.
The application is in Python if that makes any difference.
|
We are a small-ish firm with multiple teams who manage their own git repositories. This is a web platform and each team's artifacts are deployed at the end of the day for nightly tests. We are trying to formalise the process around versioning and packaging.
Every team has a master branch where they do day-to-day devel... |
In a web application, we create an email provider, which in turn creates an SMTP client: my question is whether we should create an SMTP client per request or create only one client and have it service all requests?
Which is the best way to use an SMTP client? We are only sending (not receiving) email.
|
I have a feature I'm building that aggregates data across about a dozen or so tables. This data is aggregated from a heavily joined query. This page then has a lot of filtering, sorting, counting, and display options that need to work on top of this aggregated data set. There is one "global" condition/filter on the pag... |
I'm having a bit of a hard time figuring this out. I have a model (which you can see in the image below) this model can be changed (it won't happen often, but it can). When it changes I do not get the changes I get the ENTIRE data set, I get this set in the following order (don't know if it's relevant): First i get all... |
During working on a pet project in microservice event driven architecture, I've faced a problem of delivering responses to a client.
Each microservice (API Gateway etc) has many replicas and has it's own loadbalancer (Kubernetes Service).
Use case:
20 clients (JS App) sends "Register account request"
10 clients get c... |
I am not to sure if this is a question which fits the topics of software engineering.
I have two levels of objects "Categories" and "Category Values". I need to build a user interface for users to choose from that items and select as many as they want.
There can be like 10 or 20 Categories but each category can have fr... |
We have decided to code the new project in TypeScript at the company. Does this mean that everything should be coded in this language?
Discussion
My first thought was Yes. On the other hand TypeScript is compiled to NodeJS before it will be executed. So why create a new library for for example Postgres?
connect-to-pg.j... |
I see that free licenses come with a "same license" and "disclose source" mentions, like stated here.
For instance, I have some software code under the GNU GPL v2 license on github. If some evil developer want to steal my code and use it in a closed-source software, how could I be aware of it, and how could I prove it ... |
Sorry for the confusing title - this is best illustrated by an example (hypothetical but hopefully illustrative).
For 99% of my application a Zip Code is considered as a string, so I consistently use the name zipCode for parameters, variables, property accessors etc. (obviously with initial capitalization as appropriat... |
I am currently using Python to write a compiler manager. I have to detect whether given source code is C, even if the code has a few syntax errors. I am currently using the file's extension to tell, but I want a smarter option.
Would using regex be the best (and simplest) solution to this problem?
I am also looking to ... |
I'm writing driver-level code that runs on a microcontroller. I've described some of the design with use cases. The users in my use cases are the the other software components that use my driver. However, I also receive input from the hardware itself in the form of interrupts. How do I describe those interrupts in my u... |
I am using a MVC framework and I have developed a module where .csv file is being imported into the database, I am little unsure about certain things which I'll try to explain below:
Step 1:
.csv file is uploaded and I do all the initial checks like valid .csv file, size etc
Step 2:
Next I go through the main headers ... |
I have been working on a cloud-based background worker service, and regrettably it is almost "blind". What I mean by this is it is incredibly difficult to get any insight into what is going on, aside from the tedious process of reading through noisy logs.
Some of the common things I would like to know are:
is it runni... |
I have been tasked at work with implementing what I can only refer to as a rule interpreter. Part of my job is to identify production errors as they occur with shipment codes, and we are looking to make this process more streamlined with a user-friendly GUI so we can eventually offload the responsibility to another de... |
I'm a student of best practices, architectural patterns, and design principals. I have been studying dependency injection and inversion of control a lot lately, and have been "drinking the koolade" pretty extensively with a lot of my projects over the last half a year or so.
Recently, I got into a discussion about thi... |
How can Gary Bernhardt's "Functional Core / Imperative Shell" architecture be used to design software for an elevator system?
Specifically, let's say there are a few elevators, each with call buttons (one per floor). Each elevator has sensors that report speed, position, and button status, and a controller that accepts... |
In the context of a modern filesystem such as btrfs or ZFS, both of which checksum every piece of data written, is there any additional value in a file format storing internal checksums?
I also note the case of where a file is transferred across a network. TCP does its own checksums, so again, is it necessary for the f... |
I have a very specific scenario that I'm not sure is possible to fully support:
I have an ASP.NET application that uses Entity Framework 6.3 for it's data management.
I also have a generic audit library that I use to log when specific types of data are viewed. This library is designed to be ignorant of the data/object... |
I'm fully aware that Promises and eventing are both ways to do asynchronous programming, and you can choose either one for a given project. However, in practice, the code base I'm working with is large and we use many 3rd party libraries that handles asynchronicity differently so mixing the two approaches together are ... |
I recently stumbled upon this opinion from 2016 saying that there is still case for domain logic in database.
I thought that this is totally obsolete. I am just wondering if the guy is still living in 90ties or this is can be really true. Set aside legacy systems.
What about having domain logic in database because of... |
My team is currently using Visual Studio Team Services for source control (TFS), building (triggered on check-in), and deploying (using VSTS Release Management).
We have four environments (Dev, QA, Int, & Prod), and any code change has to be signed off (by different parties for each environment) before being deployed t... |
I'm trying to implement the unit-of-work pattern for mutliple storage types like the windows registry, a database or the app.config but I cannot figure out how to do it. All examples I find use Entity Framework which already is a UoW so it doesn't help much. What I'd like to store is a simple Setting object.
From http:... |
Let's say I have a random number generator from which I am requesting values for event A and event B. Both events occur at random intervals but event A happens much more often than event B and I would still want both the values sampled for event A as well as values sampled for event B to be uniformly random in their ow... |
I have an application that lets users create their own character from clothing like hat, pants and facial features, like beard and eyes. I'm using a canvas to display the built up character. The order in which these items get drawn are important, ie. the body of the character should appear behind the pants.
My teacher ... |
I am just testing out a simple neural network with a single neuron. To classify if a number X between 1..10 is greater than a number N. N is a constant for example N=3.
Given my input X and a constant neuron 1. My output is (w1*X+w2) where w are weights.
But what I'm finding is that some values of N lead to faster trai... |
Everytime I need to provide additional information about an exception I wonder which way is actually the right way of doing this.
For the sake of this question I wrote an example. Let's assume there is a class where we want to update the Abbreviation property. From the SOLID point of view it might not be perfect but e... |
If I have an epic with 4 features and one feature isn't really part of another epic but needs to be put into that MVF, do I move the feature to another epic or can epics cross MVF's?
|
Given a class like:
class State {
bool IsLessThan(State);
int data;
};
The State::IsLessThan(State) method can simply compare data in each class according to some logic. However let's say the data within State is expected to change throughout development and hold different predefined types of data groups which... |
I have a Client in AngularJS where I consume multiple SSE (Server-Sent-Events) in Java from the Server Side (there are multiple endpoints in different web servers in the backend). Diagram link
I currently register a listener to each type of event coming from each SSE connection, such as:
source.addEventListener('alpha... |
I'm close to opening up access to a web application that I've built, and I wanted to make sure that I can link updates to the app to errors, or other changes in analytics data. My first thought was to put the current git ref in a custom variable that is tracked with every event. But within analytics systems, you don't ... |
I've worked in shops that produce life critical software and I've dealt with commenting rules that were meant to keep the code readable and potentially save lives. In my experience though the requirement becomes a brain dead chore to be ticked off of a checklist and doesn't help me stay focused on writing understandab... |
What changes need to be made to a language/runtime if one wants to implement fully asynchronous exceptions (thrown from one thread to another, capable of interrupting pure computation without the need for polling)? What issues and challenges need to be addressed and how? What would be the difference in implementation b... |
I'm developing a webapp where I have sets of data stored locally on my computer and I run a tool which transforms the data and uploads it to my webapp. However, I need to be able to rerun the tool on all the sets of data at once. The only option I have thought of is to associate the transformed object's reference in th... |
What is the accepted way of keeping track of a user's permissions in a database? Say I have a web app where users can pay for privileges. To use a straightforward analogy, imagine Github's users (paying members can have private repos, etc.) One way I see of doing it is keeping track of user type in the database:
accoun... |
In the context of houses, should area be stored as square feet or square meters?
The area of the largest houses in existence are greater than 32000 sqft, so a 4-byte integer may be required to store square feet. For this reason, I'm favouring square meters at the moment.
Are there any other considerations that are not ... |
string convertDigitsToBinary(int n) {
string ans;
if (n == 0) return "0";
while (n > 0) {
int rem = n % 2;
ans.push_back((char)('0' + rem));
n /= 2;
}
reverse(ans.begin(), ans.end());
return ans;
}
I understand how the algorithm works to % the ... |
So, I'm developing my own CMS which dynamically adjusts to the settings I have set on a specific domain.
I just developed this whole CMS on my local machine and now facing the problem that I have multiple projects, each on a different domain (same host provider though, don't know if that's relevant?). On my localhost i... |
I'm pinging the dev community collective to determine whether there is an official name for the behaviour I'm looking to build.
Let's say there's client C, spatially positioned at 0,0. C initially has access to data points immediately around him in 8 'chunks', as well as the 'chunk' which matches his position, for a 'c... |
It seems to be fairly common opinion that you should only test public methods for a class or module and not private methods. If private methods are doing their job correctly, then that should be reflected in public methods.
That being said, when testing a public method that makes internal calls to private methods, shou... |
Make comes from a time when version control was fairly immature. I understand the need for a streamlined way to clean the workspace back then.
Nowadays any decent version control tool can clean the unversioned files in the workspace. Files which don't need cleaning (cache, downloads, etc.) can be excluded. It is also f... |
We have several teams in our section of the organization and each will be give features of the system to develop and deploy.
A feature includes back-end work as well as front-end work. All the teams will be using two code bases. Those are back-end code base and front-end code base.
Requirement is to create set of guide... |
I am sorry for not posting any code. I am stuck at the design phase -that's why-
What I want to accomplish is: allowing system administrators of a 'Staff Task System' to dynamically set rights to a specific user/department to a specific action in run-time.
The rights are complicated. For example: They can restrict task... |
I have bit similar question to Optionally Using GPL Library via System API in Closed-Source Application but not 100% the same.
Let's say I have closed application A (i.e. frontend application). It is exposing API keeping rights to it, but grants open rights to execute it (code is closed, API is publicly available).
The... |
We have this DDD project where we have more then one BC, and we have this scenario where we would like to define a proper way to store account settings.
In scenario A, we would have one BC store settings for all BCs, and have it published to each BC accordingly, and in Scenario B, each BC holds its own settings, and i... |
What is the most efficient way to store each users' matches in a matchmaking app/website? Given the complexity of these kind of algorithms, is it reasonable to calculate the matches all the time, on-the-fly, when a user logs-in or presses the search button and later ignore the results after they have left?
If that's n... |
I am working in a wizard in WPF application. As the wizard gathers a lot of information I have designed separate view models for each step (view) in a wizard.
But I have to hold all this information in an object to display in a summary screen and push to database when the user reviews the summary and submits.
Example:
... |
I work with massive strings which need a lot of manipulation.
For example, I might generate a string like this:
Part 1 Boat
Section A Programming
Part 2 Partitioning boats for programming.
Section AA Section SQL Entries.
The string would be too large to manually check every part of it. Now I need to split this strin... |
I'm developing an application that produces "files" that are ultimately just a list of groups of transactions: an event store. I was wondering if there was a name for the way I'm handling undo/redo. Or if there's another common way to implement such functionality.
For example, a file with three "nodes" might look somet... |
Consider a scenario, where A occurs frequently like 4 out 5 times, and B only in rare cases, we can write our conditional statement in two ways:
if(A)
//do something
else
// do something if B, only rarely
Or we can reverse it
if(B)
//do something rarely
else
// do something with A frequently
I know that in low-level... |
Is there a use case/necessity (from design or implementation perspective) not to make a super class abstract?
Are there any differences in the programming language in use?
To make an example:
abstract class A { /*...*/ }
class B extends A { /*...*/ }
My question is about A: When am I not allowed to use abstract or can... |
Let's say I have a HTML/JS project which involves interaction with a canvas. Resizing, drawing, retrieving the current state, etc.
Obviously I should separate these into several functions. However, I'm unsure of the best way to go with this. There is only one canvas, so every function call will be acting on the same ca... |
My question is more about trying to figure out if my belief is correct or valid in that a static method should be the only one that prints to the screen (let's say in a terminal). I am using Java and have a static method main and use objects either from my utility library or from my class itself.
The idea is that, just... |
What is the best way to implement the following code without having the same code duplicated in two different blocks, but while maintaining efficiency and readability?
if (expression1):
if (expression2 that can only be checked if expression1):
doSomething()
else:
doSomethingElse()
else:
doSo... |
I have the following code which I wrote, but there is so much of code duplication. I would like to minimize it but I am unable to come up with the ideas. Could anyone help me out with this?
myFunc(r: Object): Object {
if (condition) {
return {
x: this._width - r.w * this._cellSize - ... |
We're beginning to run into a problem as we get bigger, where features make it to staging for testing, but by the time everything is tested and approved new features are on staging for test.
This is creating an environment where we can almost never push to production because we have a combination of tested and untested... |
Consider these two styles of code that accomplish the same thing:
Nested imports
common.models
from django.db.models import *
class SmallAutoField(fields.AutoField):
def db_type(self, connection):
return "smallserial"
myapp.models:
from common import models
class Test(models.Model):
id = models.Small... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.