instruction stringlengths 34 36.1k |
|---|
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 ... |
I'm tasked with the redevelopment of an existing application and ran into the following problem.
The application includes batch processing, e.g. scheduled processes that run on data without user input. Now I have to write the requirements for said processes in an Excel table. As these processes are quite long the requ... |
I am writing a method in C# (SharePoint Services) which is supposed to return a SharePoint list name based on three conditions (Client, Country, and Location). There are multiple clients, countries and location, and the number is going to increase in the future.
Th method I wrote uses a series of "if" statements, nest... |
I come from a desktop (Winforms/WPF) background were I was the sole developer in the company, and have recently changed jobs to become a part of a team doing web development. I am very much in learning mode as I've only been here a month. We use C#, Entity Framework, ASP MVC, Razor Views.
I've noticed that the code i... |
I currently have a file processing task that runs on an on-prem VM, it's a .NET executable that also calls other services such as ffmpeg (for videos). As is, the task runs fine, but it's really only possible to process one file at a time due to computational resources.
I'm looking to change the architecture in such a w... |
I'm designing a C API which will have about a dozen getter functions for various values. Something like:
bool getSomeBool();
bool getSomeOtherBool();
...
int getSomeNumber();
int getSomeOtherNumber();
...
This seems to me like a straightforward way to do it, easy to implement, easy to document, hard to use incorrectly... |
As an exercise, I am trying to design a simple calendar booking system for multiple meeting rooms. I kind of got my head around some requirements such as find available rooms for a given time range, room booking look up. However, I seem to stuck a bit on a booking scenario, say in a particular racing situation, 2 users... |
I have two synchronous web APIs that perform the same work but one needs to be prioritized over the other (the former is called from a client, whereas the latter is a caching optimization for before a client calls)
Constraints:
Both APIs have access to the same resources (such as VMs and storage) and I can't add more ... |
If a change compiled/built but the semantics were different would it be considered a major change?
For example, suppose a time string returned was the same format but now was CET rather than, say, IST and that interpreting it as IST now produced erroneous results would it be classified as MAJOR?
Note that I assume th... |
Imagine you have a system where a program is running and somehow an abnormality occurs. (it can be a crash, or an abnormal screen or any other thing)
Imagine reproducing the problem is next to impossible but you have some logs files that record what has happened till that point.
Usually you debug by reproducing the pr... |
My app uses Cosmos DB to store data. I have a requirement to support full-text search, which Cosmos does not provide out of the box. One of the recommendations was to use Elasticsearch, and I have been trying that out. The more I try it out, the more I feel like I am duplicating data. I literally push the same document... |
I am working in an iOS project which have two schemes enabled from configurations,
Release
Debug
As you know Debug scheme is used for developers while developing features and testing etc. However, Release scheme is used for generating official final artefact to upload in App Store. Currently my application quality is... |
I have recently started diving deeper into Angular 7 (with Ionic 3) and I have written a lot of code so far, and I have child & parent component relationships - but never like this before. I am trying to write "good" Angular code.
The problem I am now facing is, the Providers...
My Child Component needs access to the S... |
I have an array of ranges with start and end timestamps. I want to display those ranges on a graph.
Right now, my naive algorithm gets an array of ranges sorted by their start timestamp and
iterate over each range in the sorted array
find the first bucket where the last range of the bucket has an end timestamp lower... |
There's a debate going on in our team at the moment as to whether modifying code design to allow unit testing is a code smell, or to what extent it can be done without being a code smell. This has come about because we're only just starting to put practices in place that are present in just about every other software d... |
I stumbled upon a question in Codereview, and in one answer the feedback was to avoid std::endl because it flushes the stream. The full quote is:
I'd advise avoiding std::endl in general. Along with writing a new-line to the stream, it flushes the stream. You want the new-line, but almost never want to flush the strea... |
I am getting into SonarQube and everything looks quite and simple so far, but I am not sure what is the final purpose of CCQ overall.
Yes it gives you a lot of tips about whats going on inside your code, and no - it seems to not be perfect everytime.
Are CCQ tools expected to deny a branch merge if there is on example ... |
I'm designing a solution in which users perform tasks based on task queue. The point is to create system, where user goes on specific URL and server serves him listing with for example: items to asses and put into specific predefined category - like StackExchange's queues (First Posts, Late Answers and Triage).
What I'... |
I'm aware of the general distinction between data and content, namely context, but here I have a case that is clearly causing a lot of confusion and debate within the company I work for.
There is a front-end team which manage an application which calls our data API. The confusion is that they want the content structure... |
I've recently started my first job as a software developer at a small startup company.
I do not have a degree in a software engineering related field, although, I have very recently completed an A-Level in Computer Science.
There are 2 developers (myself and one other) and the other developer has worked here for some t... |
I was thinking why are there (in all programming languages I have learned, such as C++, Java, Python) standard libraries like stdlib, instead of having similar "functions" being a primitive of the language itself.
|
Assume we have two files
a.cc
#include <iostream>
int timesTwo(int in);
int main(){
std::cout << timesTwo(5) << std::endl;
return 0;
}
b.cc
int timesTwo(int in){
return in*2;
}
is it better to use the linker and include b.cc in a.cc by #include "b.cc" or is it better to leave it as is and compile them like g++ a... |
Quoting the definition of interface injection from Wikipedia :
The advantage of interface injection is that dependencies can be completely ignorant of their clients yet can still receive a reference to a new client and, using it, send a reference-to-self back to the client. In this way, the dependencies become inject... |
My team and I had a discussion about our future architecture, since we've always just written the code that was needed in each separate project, which have now led to extremely redundant code across multiple systems. Therefore, we wish to create a local NuGet feed to share functionality across our new systems.
Some of ... |
In my code I have 2 separate login types. I have a factory that decides which one to create based on an enum.
Each login type has a different type of credential.
Currently my factory method takes just 1 type of credential.
How can I generalise my method to accept both an enum for login type with different credential ty... |
Let's say we have a code base covered with big enough amount of unit tests. We make small change to the code and want to check if tests are still passing. Wouldn't it be great to be able to rerun just tests affected by the change? It seems like every bit of data required to build the list of affected tests is in place:... |
We have a REST API that returns user generated content from a database. Before inserting the data into the database the data is sanitized.
But when returning the data we do not escape / decode the data, so in theory it would be possible to insert some user content that will execute an attack, once it is consumed from t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.