instruction stringlengths 34 36.1k |
|---|
I've noticed that text editors and such have a more-than-prefix/suffix-based pattern matching algorithm going on behind the scenes. And StackOverflow's tag matching algorithm does more than just prefix/suffix matching:
I am wondering what (one of the possibly many sorts) of data structures are required to implement th... |
I've developed a java web app using Vaadin, and using Jelastic/MassiveGrid as the PAAS. However, I need advice on proper architecture for my needs.
Desired Outcome:
Users land on my homepage where they can read about the app's features, pricing, view the contact page, etc. If they want to login, they click "Login" i... |
I develop an application using WinForms/C#.
In my software I have a List of objects, let's say List<Item> Items.
There is also another List of objects, let's say List<Factor> Factors.
Every Item contains multiple Output Factors (information you can extract from the Item).
Also, every Item contains multiple Input Fac... |
Back story: I work for a startup which was acquired by a large Fortune 500 company. I'm the lead engineer on a project which aims to consolidate duplicate data stored by both companies. Our new corporate overlords have a mature RESTful API (written in Java) exposing all their data which happens to live in a Oracle DB u... |
I'm currently building a web application for my enterprise level business internship. This web application will track data from three different sources: a DB2 database, a SQL Dynamic database, and an existing API, and then marry them together.
I'm currently working on the SQL Dynamic side, and I was advised to use Enti... |
This should be a simple MVVM - reactive architecture question, something that I miss probably.
I'll start with a context example:
I have a Music Tracks Player application with 2 models Player and Track. The relation between player and track is pretty obvious: the player contains tracks (multiple track can be played si... |
I'm not a native English speaker, and i'm new to .net Core.
I have a task to port the logic of a WPF app to .Net Core while leaving this app working like previously. The app has approximately 70 Visual Studio assemblies:
Say, 40 of them are related to logic and must become cross-platform.
Say, about 20 of the logic-re... |
So with Model Checking you have a specification and the model checker automatically goes through your program's states and checks if it matches the specification. What I don't understand is where testing fits it. So typically it is described that if Model Checking finds an error, it will generate a test case to demonst... |
Let's say that I want to contribute to thislib, which is a Python library that is available as a Git repository. Several applications, such as thislib_app utilize this library, and I want to contribute to the thislib and see how my optimizations work out for thislib_app (we can say that thislib_app is like one big unit... |
I wasn't sure if here or SO was the right place to ask this, but here goes anyway.
So I want to improve a system that is currently running. It has services and many stand alone apps, but none of these things are properly coordinated. Now I want to build a mini app to prove the improvements to the system should we build... |
In C#, what is the difference between Automatic serialization and Customer Serialization? Also what is Reflection? I know this stuff is not simple, if someone can explain in lay man's term, that would be great. I am beginner in all this.
|
I don't have much experience working with OOP, so I'm trying to understand what is the feature (or features) that would give you a great motive not to write some program in a procedural language, but rather write it in an OOP language instead.
I have thought of the following features of OOP and their impact:
Doing obj... |
I want to have an array that can hold elements of many classes data types, and each of these classes have a method called printInfo().
The way I can do that is by having a parent class called SomeParentClass that have a virtual method called printInfo(), and then I would make the classes data types that can be present ... |
I have a situation where I need to model objects that don't share common attributes but represent same logical entity. Now, based on their type they will have different attributes (properties).
To keep an example code simple & easy to understand, let's say we have Valid & Invalidvalidation results. When validation resu... |
On one hand, the invariants should be protected (To make invalid states impossible early and preferably at compile time rather than run time), and on the other hand, passing domain knowledge out of the domain is wrong.
On one hand, the value objects protect our domain invariants at first place, on the other hand using ... |
I have heard some developers say they prefer to build their UIs in code behind... I am of the opinion that this leads them to write really bad code... Super large functions, spaghetti code, and mixed responsibilities of functions instead of pure functions. I think it's better to build your UIs in your platforms specifi... |
I was reading about "Referential Transparency" that says how to program thinking about purity and determinism. It's said that a function that modifies an outside state is unpure.
But what about a function that only read an outside state (such as reading a global variable), is it unpure too?
|
I'd like an immutable class, or rather a class whose properties are initialised (whether they have public/private setters or not), in the constructor:
public class MyClass
{
public string MyString { get; }
public MyClass(string myString)
{
MyString = myString;
}
}
Nice and simple, works fine. ... |
We are currently rewriting our infrastructure from a monolith to a distributed system because the old system didn`t fit the workload anymore.
In one part of our distributed system, we have an Entity (from a database perspective) that has N ... events associated. We have a service S that handles access to all Ns and the... |
In my MVC 5 web application there are many instances in which users will require to view thousands of records within grids, now I managed to get around many performance related issues by utilising the following:
Lazy data loading.
JSON compression.
Progrssive Ajax Loading.
Virtual DOM
Only retreiving the most importan... |
Say we start with a base class that states if an object is valid or not (included one interface and two child classes for discussion purpose), like:
interface IValid
{
bool IsValid();
}
public abstract class BaseClass : IValid
{
public bool Validity { get; protected set; } = true;
public bool IsValid()
... |
I have a complex environment which is mostly oriented around / ends up spitting out blocks of HTML, which make up the entire page.
Now, I need a way to "point and click" identify any block on my page from the front-end. At the user's command, they should be able to, when an element is clicked, pull an unique identifier... |
My scenario is like this. I work for a government agency that specialize in the Environment and Natural Resources. We want to make fool-proof functional system (software, hardware, people-ware, policy) that would:
prevent the reuse of a permit issued for transporting wildlife live species.
We have implemented a QR UR... |
Both basically have 2 parts:
Part 1: Divide up your data into many smaller parts that is small enough for you to work on each individually.
Part 2: Merge the results from all the small parts to one final result.
The only difference is that merge-sort is done on one computer while mapreduce is done on a distributed sy... |
I have just encountered this sentence:
Depending on the context, we may prefer to model integers as bitvectors rather than mathematical integers, since the Int type does not model overflow.
I am wondering what this means. I am new to learning about integer overflow. Wondering what it means to model integers as bitvec... |
Some of my colleagues tells me that using stored procedures in the database adds to much business logic in the database, and that you should keep the data separate from logic. Other colleagues tells me that adding DB Queries in source code as strings is not only hard to change, but also poses a security risk.
I'm leani... |
I am trying to understand how Polymorphism is used in a real life project, but I can only find the classical example (or something similar to it) of having an Animal parent class with a methodspeak(), and many child classes that override this method, and now you can call the method speak() on any of the child objects, ... |
My server and several clients are different JVMs running on the same machine, they need to share persisted time series data: server reads a time series from somewhere, writes to a persisted embedded storage. Several clients then read the timeseries from that storage in the same order.
Chronicle Queue seems to be the be... |
My app is consuming a third party api. One of the requirements of this api is that my app cannot send more than 20 requests per second. Because of the nature of this app, and because my user base is growing, we are now hitting that limit very frequently.
(One thing to note about my app: it consists of 4 separate backg... |
A big data job is split up into X partitions. The partitions are stored in a database. Status on each partition is also stored in the database and is used to ensure that each partition is only processed once by a single server.
I've got X servers, each with a unique id (int), each polling the database for the next Y pa... |
In wondering about math fonts in the terminal, I started to realize that you can't really have pixel-perfect graphics in the terminal:
How to draw a single pixel in a terminal?
Terminal with image support
The terminal also has weird features in that you have to use ansi escape sequences to change colors and move the ... |
Recently I am developing a new feature for my web application that must be Release Independent.
The feature requires to show some predefined data. Those data will rarely be changed or updated. Here is the part I am confused of. What will be the more appropriate approach to read the data from. There are two options in... |
I am writing an object oriented game for fun where players from two teams fight. I need to implement move function for players on a maze. Maze sohuld have location information with some features like height or type(hill, water etc.). So in order to implement location I have two ideas. First is that I need a Board class... |
In my 10+ years of experience in the IT field, I have never used foreign keys in any of my projects and I never felt the need. I did work with professional databases that had foreign keys constraints.
I am now at a position where we are building a new application/database and I am thinking should I use foreign keys or... |
I have a DDD repository for Employee entity. Employee will have some borrowed equipment from his employer. Because there will be more employee related records like work reports, wage reports and Employee entity could become huge I'm thinking to exclude these related records actions out of Employee entity / repository.
... |
Given a resource for which only its subsets of attributes can be edited, {E.g. invoice (resource) with a status (attribute) and paidAmount (attribute)}, in terms of API design, which amongst the following is the better approach:
PUT /invoices/{id}/status - here I'm afraid of an attributes explosion which will make the... |
I am not a developer myself so please bear with me. We are providing solutions for various customers and it is common to have a situation like this:
Our customer has a version 1.1, and wants us to provide maintenance and support for this version
At the same time, they request us to develop another version (let's sa... |
We have six very old systems where the newest one is built 1995. All these systems have batch jobs running from midnight to 6 AM every night, and these systems are offline. On top of these six systems there is an API from which different channels access data from the six systems. Every channel is naturally also offline... |
I am working solo on small development projects on my own time, using Git. For each project, I like to have a development journal which is associated with that project and not associated with other projects. The journal is a simple markdown file, journal.md.
Here are my requirements for managing the journal in my work... |
I have to integrate with another company's API, which they unfortunately decided to write in JSON RPC 2.0.
If you're not familiar with JSON RPC, it's a lightweight RPC protocol that defines a request that must always have the structure: jsonrpc, method, params, id.
Here is an example request I might make:
{
"jsonr... |
I need to know if is it correct to use pre-built codes on Github, or try to build it my self, while even I tried to build it I think it won't be as proffissional as that one on Github... the point is that I don't like to use pre-built codes but this consumes me, which I think I won't be a proffissional programmer by ti... |
We are new to c# and still trying to grok the async idioms.
We have a windows service that requires us to iterate a list of results queried from a PC database to feed the parse cloud server (which only supports async reads and writes). The results often have to be overridden with new results.
In a legacy java sdk, we... |
Let's say I have multiple Angular/React/Vue applications which I want to enable users to log in once and be able to access all my applications.
What I want to solve / ask about is where should I keep my login logic and UI? thanks
Should I create a separate project just to keep all my login logic and UI?
Yes:
Redirect... |
I am wondering why unicode encoding is necessary in JavaScript. I am looking at utf8.js as an example. I am also looking at the utf8 spec, but am not really following the different pieces of data. Also, I don't fully understand when and where you are supposed to encode/decode, and what the "current" format is of some s... |
It's no secret that in the early days of computers, they had only 1-4MB of RAM. I found an article stating you needed only 4MB of RAM to run Word, Excel and PowerPoint simultaneously. How was that possible, considering that nowadays you need at least 2GB, 1000x times more RAM to do the same thing? Sure, the new apps ha... |
I'm using a service to manage state in Angular:
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs';
@Injectable()
export class DrawingAreaService {
itemChange: Subject<string> = new Subject();
private foo = 'foo';
get bar() {
return this.foo;
}
set bar(value) {
this.foo = v... |
I have a service, call it Service A, that is built on a Storage Layer, call it DB, that is 5-6 levels deep. This layer is depended upon by many other services.
Service A is having memory issues and the fix is to throw an exception from DB if the resource we are trying to fetch is too large for Service A. The resource i... |
We can do something like this:
// in base class
protected virtual void Init(){
//do stuff that all objects need to do
}
//in derived class
protected override void Init(){
base.Init(); // if you forget this but it compiles all hell breaks loose
//do derived stuff related to this object
}
I spent a good 15 min... |
I'm currently building an opensource administration interface to help people easily manage their contens/websites.
Application built on Vue.js and heavily rely on json configurations for which fields to show or which data to send server via forms.
Since rest apis doesnt have popular standardization (besides jsonapi) is... |
In my computer science exam there was a question as follows:
i=10, j=51 & k=7.
p = i+(--k +j) + (3*(i++))+i.
I am getting the answer as 111.
Here's my methodology :
k is decreased by one in (--k +j), and i in (i++) is increased, so (3*(i++))+i becomes (3*11)+11. But when i entered the statements into BlueJ, the answe... |
I'm implementing a Redux store for a React app using redux-saga for API calls. I've used Immutable.js before for other Redux-using React apps but the nature of previous projects always evidently required a normalized structure.
In this new app, the flow is less app-like and more a series of steps. There is an API call ... |
Let's say I have a web application where my users can log in, and save resources through my API and an ajax call. Now let's say I put my web application behind a Web Application Firewall (like barracuda).
As conscientious a developer I put a safeguard in my API code to check that the user currently trying to save the r... |
I'm making an graph layout optimizer and need to find paths from node a to node b in graph g. It has gone pretty well so far, but I lack an algorithm to take the next step.
So far I've used BFS to find the best path from a to b. The next step would be to find all paths from a to b, without loops. Q: What algorithms can... |
I am new to Git and am learning as much as I can about it.
The latest thing I would like to know is how to approach this problem: I have a single folder (R) that I initially set up as a Git repository.
Since setting R up, it now contains several projects and it is now the case that I have several branches, each reflect... |
So, I'm doing a project that needs to consume a REST service. I'm using C#, and I'm writing implementation myself with HttpClient class. I also try to create some Unit Testing for my library, but that class doesn't make it easy. Here are parts of the conflict:
HttpClient is designed to be used as singleton, as indicat... |
I'm working on a product that exposes a RESTful API to interact with system entities (the usual CRUD), which works very well.
In addition to CRUD, we've recently encountered a need to expose the ability to query different time series based data, with different filters and at varying aggregation resolutions (but based ... |
In the past we saw a big move from traditional MVC to MVVM for user interfaces:
One of the primary motivations for MVVM is that the view and viemmodel are competely indepedently of each other and can work/stay alive without each other. Since the viewmodel doesn't care about the view at all it was also easy to swap com... |
I have a repeated pattern in my code that is not easy to test: classes that execute periodically. Just to simplify things lets say assume something like:
while( running ){
long millisToWait = scheduler.getMillisecondsUntilNextExecution();
Thread.sleep(millisToWait);
executeMyTask();
}
Where Thread.sleep i... |
What's the proper URL structure in REST API for changing state of one particular record (e.g. change from "new" to "processed").
Now I work with this URL without request body:
PATCH /employees/123/items/456/process/ HTTP/1.1
But maybe better will be:
PUT /employees/123/items/456/ HTTP/1.1
and in request body specify ... |
Today, I and my colleague had a difference of opinion regarding the usage of default values in software configuration. We both agreed that for a consumer software, the default configuration should be determined by the most common usage and user experience.
However, the contention is in the usage of default values for e... |
I have a CRUD like service which have REST HTTP API. This service have two instances - only one recieving request at time. If first instance starts throwing exceptions or slowing down we change load balancer rule to send requests to second instance. Now I wanted to add some AMPQ messaging type handler to this service. ... |
I was recently tasked with creating a factory that processes webhook events. Any authorized application in the solution (1 app per domain) can post any meaningful payload and as long as the event's wired up for processing it should be able to handle it.
I have two domain projects: Core (logging, security, & common fu... |
For example, suppose I have a class to create a button with specific styles common to my app:
class ButtonFactory{
public:
static Button* createAppButton(std::string st,int font size){
Button* b=new Button();
//b->setColor();b->setText()...;b->playAnimation(...);
return b;
}
}
at other class
this->b=Bu... |
I'm having a trouble with understanding how to implement and find the median of a threaded binary search tree in constant time.
The tree consists of a worker's id and name.
The given details are given:
In a binary search tree with n nodes, There are n+1 left and right pointers with the value NIL. For every node z in t... |
We have inherited an application that is made up of small .NET web API's. Each API has its own Visual Studio SLN and git repo. All of the APIs are published to one folder ("All") and that folder is hosted on IIS with each of the APIs as a separate application on the same website and app pool. The folder with the publis... |
I have multiple classes that have the same properties to be exposed. Is it normal to create a base class, which will expose those properties, to be used with descendent classes?
By properties I consider plain
protected/public bool SomeProperty {get;set;}
but also a complex property that is being injected through const... |
After an unresolved argument with a friend I decided to ask the stack overflow community. Is there something like abstracting your code too much? Which of the following is the better option. We come from different coding languages so I am explaining this the same way I would to him. Assume everything below as summaries... |
I have a byte array and a value defining the type of the data stored in it (string, int, ...). What is the best way to get this data? I have two options in my mind:
Call a method which gives the type of the data and based on that call a method which gives me the correct data.
Call a method which returns both - the dat... |
I always hear how it is hard to implement shuffle algorithms for music players, but never really the explanation for it. What makes it hard?
Take for example how I would implement one:
First the user adds 5 songs to a playlist
let songs = [0, 1, 2, 3, 4];
Then the user enables shuffle
The program would then copy the ... |
In an interesting Twitter thread, Ron Jeffries (signer of the original Agile Manifesto) is suggesting that all user stories should be broken down so that they have one, and only one, acceptance test.
The aim is to remove the need for estimation on user stories: the idea is that such user stories will all have the same ... |
I know you're not supposed to test private methods, and if it looks like you need to, there might be a class in there waiting to come out.
But, I don't want to have a gazillion classes just so that I can test their public interfaces and I find that for many classes if I just test the public methods I end up having to m... |
Suppose we need an iterative algorithm for mathematical optimisation. Each iteration takes a long and random time. After each iteration, a stopping condition is checked for the iterate x, based on some pre-defined parameter b. An example is "Stop if ||grad(x)|| < b", based on the objective's gradient at x.
Here's is... |
While going through some lecture video on interface. I noticed
If we don't know about implementation, just requirement specification then go for interface.
What can be the scenario? Though I've used interface in many cases, but didn't gwt the essence of interface, as stated.
|
I've been doing agile planning for a long time, but always I get to the same question: where should I put the basic UI development tasks? I mean, for example, if we are developing a web app, we need some time to design and develop the basic UI.
Usually, we add extra points to related user stories so we can plan the spr... |
I've gotten myself a bit more roped into coming up with the design and architecture for a new system due to some departures and looking for some insights.
The system has a bunch of different high speed services on a network that a variety of data will be gathered from at regular intervals (50 to 1000ms, depends on the ... |
I'm in the process of outlining the intended business logic of a web service. At this point, I'm not too concerned with implementation details. On the contrary, I'm looking for ways to abstract them away in order to describe the business logic and data exposed by the web service in an implementation-agnostic manner.
I'... |
I am not sure if this is the best place to ask this question, but I was looking at a Wikipedia article and noticed there were a lot of edits for that article. Since you can view each edited iteration of the article, I figured the amount of space those web pages take would add up. There are millions of articles and Wiki... |
Given a literal type, for instance 1 | 2, assigning a value to a variable that correctly corresponds to the literal type will fail.
interface SomeInterface {
foo: (1 | 2);
}
class SomeClass implements SomeInterface {
foo = 1; // <- generates the following compiler error:
/*
Property 'foo' in type 'S... |
I am having a hard time understanding where the Application Services fit in with DDD and Onion architecture. Up until a few days ago I thought of them as part of domain model, but I began to question that.
I know what Application Services are for.
Orchestrating use cases.
Fetching Aggregate Roots via repositories (rep... |
I'm looking to persist a stream of events and I want it to be:
fast in both latency and throughput, looking at at least 100k events per second
ordered (not by timestamp, as multiple events within the same millisecond need to be ordered consistently)
for events sent by a single thread, they should be persisted in the o... |
In the same way that you can simulate the if statement and functions, I am wondering if there is a way to simulate the comparison operators ==, !=, >, >=, <, <=.
For example, in JavaScript, instead of doing this:
var x = a > b
Maybe there is a way to do it in a more primitive way, such as sort of a logic circuit or so... |
If I do this
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
Then why don't I do this, it's more convenient
import android.graphics.*;
Do you agree that the latter is a risk that I might import classes which conflict which my own (f... |
Hopefully I am posting a question in right forum. As per https://meta.stackexchange.com/questions/68384/whats-the-difference-between-stack-overflow-and-software-engineering-se-previo `software engineering' seems to be the right choice for my question.
So question is,
We are in IoT era, and most of new bee's like me ha... |
I have read two opinions on the subject. Let's assume the following simple code:
class Enemy
{
public virtual void CheckHealth()
{
if (Life <= 0)
Dispose();
}
}
class Boss : Enemy
{
public override void CheckHealth()
{
if (Life <= 0 && PowerSourceDestroyed)
D... |
Question:
If I have to fetch an entity from another Bounded Context in order to map it to something in this Bounded Context, how would I go about doing that?
Do I call the foreign Bounded Context's Application Layer? Perhaps I need a new "Query" Application Layer for such queries?
Do I call foreign Bounded Context's r... |
What's the __version_info__ function?
I am reading a open source library uritemplate, I found:
__version__ = '3.0.0'
__version_info__ = tuple(int(i) for i in __version__.split('.') if i.isdigit())
there have __version__ already, why there still define the __version_info__ variable there? what's the function of it?
ED... |
You can find whole articles theorizing when you should use what METHOD in what edge case.
It mostly comes down to this; every action needs to be simplified to in just four flavours (GET, POST, PUT, DELETE) - and this is often insufficient to be expressive.
Especially if you look at domain driven design, this is unfit. ... |
I am trying to learn web app MVC in PHP.Most of the articles discussed about 1-to-1 MVC pattern given bellow
Controller: gets user request & update model,
Model: receives orders form Controller & update the data.
View: receives the updated data from Model & display it.
However, in my MVC project I need to create a h... |
I came across below statement at this blog
Computation intensive operations should use a number of threads lower than or equal to the number of cores, while IO intensive operations like copying files have no use for the CPU and can therefore use a higher number of threads
I am not getting the logic/reasoning behind wh... |
I have a java class where I have few booleans and one arraylist. If the boolean field is set to true, I need to add it to the arraylist. One of the ways I can do this is to use the setters of each boolean to add elements to the arraylist.
But is it a good programming practice?
I couldn't find concrete information on ... |
I have a class with some default/shared functionality. I use abstract class for it:
public interface ITypeNameMapper
{
string Map(TypeDefinition typeDefinition);
}
public abstract class TypeNameMapper : ITypeNameMapper
{
public virtual string Map(TypeDefinition typeDefinition)
{
if (typeDefinition ... |
We have a Raspberry PI (with raspbian OS) that runs some application, this application uses a local configuration file that contains some data like username, password, server url etc. We will provide raspberry pis (with the software installed) to users, they will have to connect them to their local network. We want to ... |
I have an old website (https://www.recordsforliving.com/) with a search feature. Up until recently, it was running on Windows 2012 server, and used Microsoft Index Server, and
...
OleDbConnection IndexServerConnection = new OleDbConnection("Provider=msidxs;");
...
//Index Server Catalog name
string CatalogName = "R4L... |
I feel like I've heard the phrase "Automated Test Coverage" but not really sure what it means. I am wondering if there is a way to do some sort of program analysis that will tell you which parts of your code are untested. In this way, figure out what is left to test to build a robust system.
|
I'm implementing a simple 3D rendering engine for my game, I'm using DirectX11. I created a simple architecture for the rendering engine, with a central rendering system (RenderingSystem class, a singleton) that contains and manages specific renderers, and each of them has a render queue and can draw a particular entit... |
I'm creating a variable which should describe that an object is currently in use. Lets say we have a form with a password input, and I want to describe the state when someone is using that input.
Is that variable name correct?:
Boolean editingPassword = false;
I don't have any idea how it should looks like.
|
Currently my company has a single internal application that our support agents use. It only supports one product at this time. Tech stack is angular on the front end and spring micro services for middleware.
We are launching a new product and the internal application will need to support that as well. However, for the... |
I have some set of data with key-value pairs, but there is only a finite and known set of keys, all of the key should always be present on that data, and they all have the same type for the value. Does it make more sense to use an enum for the key in a map (like Map<SomeEnum, String>) or make a new class to represent t... |
I have two classes called Player and Enemy both inheriting from a class called GameObject, how do I store them both in an array of type GameObject while still keeping their own unique information?
I tried making an array like this:
std::vector<GameObject> _gameObjList;
and then tried pushing a test object in it like t... |
I have two classes:
public class Child {
public List<Vector2> localPoints;
public List<Vector2> localEdges;
}
public class Parent {
public List<Child> children;
public Vector2 worldPos;
}
A parent has a position in the world worldPos. localPoints and localEdges in child contains points relative to wor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.