instruction stringlengths 34 36.1k |
|---|
I was recently studying Internet Message Format originally RFC2822 and RFC5322. I was looking at definition of folding whitespace.
Each header field is logically a single line of characters comprising
the field name, the colon, and the field body. For convenience
however, and to deal with the 998/78 character limita... |
I am new to Distributed DB design. In my current application ,I am having multiple functionalities which shares the some common tables from DB. All these functionalities will be build in spring, spring boot using Micro-Services architecture. Most of the functionality shares the same tables which can not be put in separ... |
What is the conceptual term for a service that will respond to a request for a resource by:
checking for its copy in a cache
if it exists and isn't stale, returns it
if it doesn't exist or is stale, calculating/retrieving it and saving to its cache, then returning it
|
Basically, I am wondering what sort of speed I will get by parallelizing a algorithm to work with GPUs. I am wondering if someone has implemented queueing theory/Amdahl's law with a UI or if everyone implements their own solution?
PS: Yes I am aware that it all depends on the nature of the algorithm (Why do you think ... |
I wanted to know whether the header files in c and c++ have same function as that of interfaces used in Java? If not what is the difference between header file and interface?
|
Web pages are usually tested by refreshing the page, clicking some UI component, then either writing to a debug log or adding some breakpoints in the IDE... in larger applications, unit tests are written to guarantee the output of the program, etc.
It seems like Java is an awful server-side language for a web page. Y... |
I have:
matrix 20*40000 of floats M - std::vector<std::vector<float>>;
1000 values X;
~2000000 POD structures S.
A typical situation is: for each value from X I take several structs from S and change some ranges in rows of M (these ranges can overlap); then I go through the M and count these changes to receive desire... |
There isn't a single blog/site out there that shows how graphics technologies evolved over time, how and why they became what they're now. If anyone can shed some light on it, it would be great.
See, back in late 80s, Logo/Turtle was awesome enough to blow my mind off. I was 6 yrs old and it seriously seemed like out-o... |
Suppose, I am developing an application to keep track of daily sales of of a small retail shop of only three employees.
Suppose, the owner agrees to buy only one PC, and, refuses to purchase a copy of DBMSs like MS SQL, Oracle, etc. As a result, in order to have a no-frill system, I have decided to develop an MS Acces... |
I'm aware that there was a lot of discussion about that topic, but I'm still confused what's better for the enterpise SOA envoronment. Basically, it's a SOA system with a few of WCF web services and a few desktop WPF applications, that are changing pretty dynamically.
Option 1:
Deploy each service with mex endpoint. I... |
I just asked about the Polyhedral Model, and have looked into other compiler optimizations (Loop unrolling, Constant folding and propagation, Dead code elimination etc.).
But I haven't seen anything on entire program transformation/optimization. Wondering if there is anything on that topic, any materials or techniques.... |
How would you go about if you would like to create something like:
You have let say 3 devices (can all be iOS or Android, a mix is not necessary)
One of the devices would act as a master and the other two would connect to it and receive messages.
They are on the same network but do not have internet (so no outside s... |
I've read that an object's hashcode should not change while it is part of a Dictionary.
Because if it changed, there would be no way to find it in the Dictionary.
Why doesn't the Dictionary class have logic to move an object to the correct bucket when it detects that the object's hashcode has changed?
|
Quick Summary
I'm building a search micro-service that will allow searching across different types of resources in a particular system (e.g. blog posts, users etc.). The API that will be exposed will be consumed by both web applications and native mobile applications.
My Solution
What I'm considering is returning an ar... |
I have a set of jobs that I need executed. The entity that manages these jobs is responsible for composing the jobs and starting them. When a job is finished, the job uses a callback function to inform the entity of the result of the job (Whether it threw an exception and such)
public class TaskSet {
Queue<Job> Job... |
I try to integrate permissions for user and I want to find the best way for that. I think to save all permissions of the user in the session on login, but when permission will be changed by the admin, I don't know how to monitor that.
So that's why I'm not sure if this is the right way.
|
So this is a little complicated. We are trying to follow semantic versioning (x.y.z) but we are having trouble agreeing with each other on what numbers we should start at.
We inherited a product, let's call it App, which we are building from scratch. App v1 is written in pure HTML/CSS/JS. App v2 is written in Angular 5... |
I was watching this talk about ETL's shortcomings and the solutions provided by the Kafka platform but I don't quite understand what the speaker is referring to when she says
ETL tools have been around for a decade, yet data coverage in warehouses is still low.
What does 'data coverage' mean in this scenario? Is she... |
I've created a class called Test that has a constructor and one instance variable String name:
class Test {
String name;
Test(String name){
this.name = name;
}
}
I instantiate it like this:
Test first = new Test("First");
Test second = first;
first.name = "Change First";
System.... |
I am wondering how DDD and C4Model can play together.
Level 1 of Simon Brown's c4 Model is System Context diagram. So I think after you find and define your Bounded Contexts, you may start creating adding diagrams using C4Model.
What is the context means on C4Model?
Or c4Model is not for DDD it has its own way of thi... |
The company I work for notifies its (90%+ non-profit) customers ahead of time that there may be a brief outage at 10pm and that their customer websites' ability to edit will be suspended for maybe an hour or longer at that time on a week night when it should not impact customers or their site visitors.
There are usuall... |
I'm working on a small application that is supposed to scrape/parse a few website and I'm wondering which would be the best way to achieve this (keeping DRY/SOLID in mind).
Here's some pseudocode:
class ScraperScheduler
def perform
SraperWorker.perform_async(ParserTypeOne.new)
SraperWorker.perform_async(Parse... |
I am trying to write down a specification for a project ( still a starter ) and I got into the nuance between the two sections : product scenarios and the following requirement's Use cases.
I didn't understand exactly what should the difference between these two sections be. I thought of general Vs specific but that d... |
I am working on practicing TDD/BDD/ATDD and I am working on a rails application.
I created a helper method that depends conditionally on the type of controller being tested.
module ApplicationHelper
def devise_add_flash
if controller.devise_controller?
flash.now[:error] = flash[:error] + resource.errors.ful... |
I am curious to know the reason that makes PHP not capable to act as a application server. Node has its own http server and for Python I know that they have couple of http servers based on their WSGI.
PHP also has a development server, but why no one use in production.
|
I have just started oop and decided to program a checker's engine. I have few concerns about the way that I have structured my code and I am not sure if I am failing to understand the principals behind oop. My concern is about the handling of move generation, and board evaluation. At the moment, I have these two respon... |
So I've seen many different methods used for this in different librarys, and I want to get a sense of which one may be preferred (or perhaps it's strictly personal preference/case by case). Just as an example, let's have a class that tries to open some file:
Method 1: Bools
class filepath {
public:
filepath(const... |
Trying to see if immutability is a good fit for highly dynamic objects like game entities (that constantly are moving around and changing) or particle systems, each which might have thousands or millions of objects moving around. Wondering if it's even theoretically possible.
I would like to know how to create a high p... |
We have a server-side application (in JAVA, communicates via web services) that accesses a database. If we wish to sell just the application to a customer, so that he can use his own choice of database (RDBMS for now), how can I design the application to work with any database developed as per some spec ? I have consid... |
Let's say I need two logs coming out of my application. One is for debugging issues and making sure the application runs correctly and the other is used for user statistics and general analysis of the entire interaction. The latter should include enough information to spot bottlenecks and the entire behavior per user.
... |
I own system A, and other entity owns system B. I need to sync system B, based on changes that took place in system A. Data being synced would be spitted into different sets, so I dont have to sync entire system at once. I have to use rest API.
What are the options to sync data? I am aware of these two ways.
1. Full s... |
I am searching for the best approach for process a large amount data using PHP.
I want to create a xml file from a database, when I execute my code the system will stop with a "PHP timeout" error, I just adjusted php timeout value (not a valid solution).
Now I try to implement it with AJAX, is there any better way to d... |
What are the cons and the pro for handling CORS in infrastructure or application ?
I mean is it better to setup CORS on my nginx/apache/tomcat ?
or to handle it by coding in my application ?
I have three API REST running with their own language (java spring, express and php) behind a nginx reverse proxy. I have access ... |
I'm working on building an API interface on-top of a domain-driven architecture.
The domain layer has a bunch of specific exception classes (i.e. NameIsRequiredException, CannotPublishDraftException, etc) that get thrown.
We want an approach to cleanly handle these different types of errors without a whole bunch of try... |
Context
While trying to get my parser classes under test, I noticed a common challenge for (unit-)testing them: They have only one public method, with a string as input and the parsed class as output. They are further divided into methods for readability, but those are all private. These classes are not huge - I would ... |
I have a critical business object GroupMembership that represents the relationship between an user and a group. I have set an architectural policy that critical business objects should avoid referencing each other directly, and instead only represent their dependencies with minimalistic interfaces. The goal of this is ... |
I'm putting together a mobile app that would allow users to search, rate, and upload photos of dishes at restaurants. I have no machine learning experience (just FE/BE/Mobile) so for the time being I was planning on autocompleting search queries based on the 2,700 keyword tags I've individually and appropriately assign... |
Background:
There are three different applications A, B and C and they all share same user details but I had to implement authentication in each of them which was duplication of effort.
After some research I decided to go micro service way and implemented an authentication service. The service stores the secret for eac... |
I need something like a priority queue but with the following modification:
Sometimes I need to mark some elements in the queue as "disabled".
Disabled elements:
temporarily (until marked non-disabled again) become of less priority than any non-disabled element;
are never popped from the queue. That is if the priority... |
Strategy pattern solves the necessity of applying a certain algorithm/behaviour depending on the object's type itself. So you can iterate over a bunch of similar objects and call the same function expecting different algorithms to be executed for each one.
But what about two (or more) objects may have a special algori... |
I've noticed that data-flow analysis uses approximations of a programs steps by simulating the value flow in some way (which I don't fully understand yet). They describe it well here. On page 4 they say:
Because the analysis is not tracking the exact values of variables, but rather approximations, it will inevitably b... |
I understand concept data abstraction as it is relevant to OO programming. However on contrary it seems Function Programming promotes or makes use of concept control abstraction.
I tried searching around blogs but could not find any relevant or easy to digest (at least to me) answer. Appreciate if someone can explain w... |
I am currently using a CRC32 hash to generate a locality sensitive hash for some of my data. For much the same reasons as PKBDF2 makes a better choice than, say, SHA26, for hashing passwords I deliberately want to use a slow hashing function to generate the hash table from which I then construct my LSH by taking the L... |
In my quest to write better, cleaner code, I am learning about SOLID principles. In this, LSP is proving to be little difficult to grasp properly.
My doubt is what if I have some extra methods in my subtype, S, which were not there in type, T, will this always be violation of LSP? If yes, then how do I extend my classe... |
Regarding the diagram in Android's website: https://developer.android.com/guide/platform
Why did they put the Android Runtime category in the same layer as the native C/C++ libraries category. Shouldn't they be one on top of the other?
|
I am developing an android app. Backend code php and mysql.
I can register login using php myql. But I want to add profile information using android app. But the information goes as another user id.
So how to set the php session id for the whole app until logout?
|
It would be my first system modelling so I am not really familiar with
component diagrams. I know that I can use class instead of interface I just did not not attached to the component instead of the interface.
I have a task to model my web application's component.
It is(Orders) based on a web form, and to add(my add... |
We have an existing web service which is currently modeled as a single project, where the web/service/manager/model classes have gotten a bit confused and intermingled. As a refactoring, we're pulling the pieces apart for long-term maintainability.
As we prepare, I've been assembling a list of "guidelines" to apply to ... |
I am refactoring some code where a globally defined list is updated based on messages from an external system. Currently there is a global instance of the list. Various messages update the list based on domain specific rules.
I would like to write a unit test which can test the mechanism of sending a message and chec... |
The Short (Original) Version
How are function objects, sometimes called "functors" in C++ and other OO languages, where they make sense different from classes symptomatic of the poltergeist anti-pattern?
Definitions
A function object is a construct allowing an object to be invoked or called as if it were an ordinary ... |
I'm trying to parse readable data from PDFs and I keep ending up writing code like the following:
if (IsDob(line))
{
dob = ParseDob(line);
}
else if (IsGender(line))
{
gender = ParseGender(line);
}
...
...
...
else if (IsRefNumber(line))
{
refNumber = ParseRefNumber(line);
}
else
{
unknownLines.Add(line... |
I have the pleasure of taking over 14 year old subversion repository that consists of two key elements:
111,000 revisions, about 10% of which are substantial;
The repository dump is about 73 GB, due to a large number of binary data files that have been updated, added and modified over the years.
Here's what I'd l... |
When we start a new project with scrum with estimate user stories with points.
These points mean we are busy in the sprint.
Now there is work to do initially at project start like:
Create git repo with user/permissions
Deployment to different environments like integration, test,staging,production
Creating project tem... |
Wondering how a proof assistant such as Coq proves forall or exists. For example:
Three aspects:
If you were to give it a huge set of items like a million, wondering if it would actually iterate through it 3x and compare all the values to prove the transitive relation holds.
If not, then wondering if it doesn't even ... |
In the past, I've typically done most of my manipulation of an object within the primary method it's being created/updated, but I've found myself taking a different approach lately, and I'm curious if it's a bad practice.
Here's an example. Let's say I have a repository that accepts a User entity, but prior to inserti... |
So, we've got SOA on the backend (BE) and on the frontend (FE) we've got micro-frontends (the separate micro-frontends are loaded as components into the frontend app when needed, so internal process calls between them are possible, unlike the backend services, where between-process calls must be done).
On the BE we've ... |
I am currently developing a JavaFx program for a friend's company. I need to store information, so I am using an embedded database (mostly likely derby). Since the database needs to be outside of the application, I need to store it somewhere on the computer. I am wondering where should I store the database on the perso... |
Lets say I am trying to describe my code in a technical meeting.
First, I set the boolean foobar to true
and
Second, I set the boolean foobar to false
seems a bit wordy. If foobar was toggled, I could probably say,
Third, I toggle foobar
Through implication here, you know its a boolean. So shouldnt I be able ... |
The application I'm creating allows the sales team, and development team to manipulate 'environments'. I am visualising this through a use-case diagram.
Essentially, both roles are able to search/display environments, view their details, before performing certain actions. In the following diagram, this is clearly show... |
Here is a simplified sample. Basically, it does checks on a string from a string list. If the check passes, it will remove that string (filterStringOut(i);), and it is no longer necessary to continue any other checks. Thus continue to the next string.
void ParsingTools::filterStrings(QStringList &sl)
{
... |
I need to create a class/classes in C# that will contain constants for paper sizes properties like dimensions, aspect ratio, horizontal and vertical resolution etc. for various paper sizes like A4, Letter and so on. The first idea was to create an interface(or abstract class) IPaperSize from which we would have inherit... |
I'm designing the AST for a compiler and found that I don't actually know how to represent the Call node.
Currently, the relevant part of the AST looks like this (where the arrows denote inheritance):
ASTNode -> Expression -> Call
-> Declaration -> Statement -> Call
-> TypeDeclaration, e... |
I am creating an API strcutured web application and in this application we have different layers which are doing their own job.
First layer is Validation layer which validate user input and if it passes the validation we move that to second layer (which is Access Control layer ) otherwise return the error message
Secon... |
Even though it depends on the context, I was wondering: during a project that requires a frontend and a backend developer, who most often starts with the tasks first? This assumes the web design is already finished and accepted - now it only needs to be implemented.
Should the frontend developer start coding the design... |
I am writing application that will visualize some data. I will create custom user controls ( graphs,charts,tables ) for visualization. Now,to simplify it let's say, I want to have architecture like this:
MainWindow is a tabbed window + is has "Options" button
When user click "Options" the new window pops up, when he ... |
I'm evaluating the migration of the following application's architecture: - Nginx + PHP + MySQL - Currently the infrastructure is scalable and redundant in the AWS cloud and It was designed to support one client.
Our next plan is to expand it to support multiple clients, these are my concerns: 1- The nature of the appl... |
I'll preface this question by saying I am relatively new to DDD so I may be making some fundamental mistakes here!
I am working on a project which involves the concepts of Transactions (in the financial sense like Credit Card Transaction, or Single/Multiple CardTransaction.). A Transaction can be on Single card or Mult... |
Imagine, we have test modules with large number of questions and we can create tests which will contain exactly 30 questions.
public class Module
{
public long Id { get; set; }
public List<Question> Questions { get; set; } // all questions
}
public class Test
{
public long Id { get; set; }
public Li... |
Business case
I am currently looking for a better architecture to replace the current implementation for my application.
Currently, My application runs on a mainframe system with CICS used for connecting the services and publishing it on the internet. The application deals with very sensitive data and can not compromis... |
Consider a social network in which a user photo is needed in different resolutions large/small/medium etc.
When the photo is uploaded, I do not want to make the user to wait too long for the image to be processed and the different urls for each size to be returned.
I want just to return the base url ex domain.com/image... |
I've recently undertaken the task of writing a stack-based programming language. Before I started designing my language however, I thought it'd be a good idea to read and experiment with existing stack-based languages.
This brings me to the topic of this post. I was reading through the Wikipedia article on Forth, a sta... |
Recently I ran against this question and this Nvidia-docker project, which is an Nvidia Docker implementation and it made me wondering where, why and how this scheme makes sense?
I found out some materials in the web (e.g. this) which states that this environment is used by video renderers and game developers, as well ... |
Background:
I'm building a prototype scientific app with the "Exploration" and "Optimisation" parts. (Other parts might be needed later.) Each part uses functional reactive programming (FRP) and has its own GUI window. "Optimisation" depends on the user's choices within "Exploration"; there's no dependency the other ... |
I am developing a software system and in it there are time-measured products. The customer buys the product for a period of time, such as one month.
If the user does not list their products everyday, how will I know the product will expire?
If the product has three status: normal, will_expire, expired how can I cha... |
I am working on an app which has multiple versions deployed in the market. Different versions have modified databases and databases are to be synced between local storage and server storage by signed users. The problem is a user can have different versions of the app installed in different device and might want to keep... |
I'm developing a marketplace application that will eventually list a large number of different types of items.
Currently our search system (powered by Algolia) is built on pre defined attribute fields that must be filled out by the user when adding new items. We would allow 'N/A' to be entered for fields that don't app... |
Suppose I have UI like it:
<script>
var someFunction(){
//some code to validate and then send message
}
</script>
Message:<br>
<textarea></textarea><br>
<input type="button" id="submit" value="Submit" onclick="someFunction()"/>
Which a submit button calls someFunction() to validate and then send messages to se... |
We have designed a 3-tier web app for a finance application.
The business tier is divided further into layers like manager, helper, util layers to modularize code and isolate the different functions i.e. core business vs non-business code from each other
Util layer has non-business functions which are required during a... |
I have the following statement for which I have to make Use Case Model. I have completed all the actors and use cases.
Problem Statement
News Mobile Application offers its normal users to read/listen news about sports, entertainment, business, politics, and education etc. News mobile application is accessible in urban ... |
I'm currently working on a project which requires to support multiple languages as first class citizens and I'm facing a dilemma. I can choose between implementing the API as closely as possible for each language. But this invariable leads me to abandon some best practice for the language. E.g. C# events instead of a l... |
The client call api to query the list of products that were sorted by the number of pageview in descending order. Sometimes it happens trouble case: The client A send a request => server response the list of top 5 articles has the most pageview on page one
Article A
Article B
Article C
Article D
Article E
Right after... |
Let's consider a scenario in which a user registers to a certain service which needs his gender, birthday and location to function properly.
Sometimes we want to try registration with just email then ask later for the other details in order to increase conversion rate and not to annoy the users.
In this case there are... |
Assume I have these classes:
@Entity
@Data
class Student{
@Size(min = 8)
public String name;
public int age;
...
}
@Data
class StudentDTO{
@Size(min = 8)
public String name;
....
}
To reduce duplicate annotations, I've figured out a simple trick like this:
interface HasName {
@Size(min... |
Suppose you have two classes: Alpha, and Bravo.
Alpha constructs a new Bravo class during its own constructor and exposes no public visibility to it.
Bravo has a String named charlie (and a method to Get that String).
Let's say you have set up a test that constructs a new Alpha class. At the end of this test, you want ... |
Let's say I have the following function in Python:
def foo(one, two):
return one + two
And I want to document it with "adds one to two".
However, this is confusing, because I could just mean the function literally adds the number 1 to the number 2 and thus always returns the number 3. (Obviously this is not the ca... |
I wonder why in assembly there are often included symbols as a language feature and what's the purpose of it?
|
In my application, I have many things that use images in different ways. For example, a product may have a logo and many screenshots, a user can have a profile image, and a company can have a logo.
I could use two different strategies a flexible tables or many tables.
Flexible tables would look like:
Images
id
relatio... |
In Java, as soon as an object no longer has any references, it becomes eligible for deletion, but the JVM decides when the object is actually deleted. To use Objective-C terminology, all Java references are inherently "strong". However, in Objective-C, if an object no longer has any strong references, the object is del... |
I've have an animal class
class Animal
{
public function eat(Food $food);
}
the subclass who inherit it actually cannot support all kinds of Food (Cat can only eat meat):
class Cat extends Animal
{
public function eat(Food $food)
{
if (!$food instanceof Meat) throw new InvalidArgumentException();
... |
Searching for c++ ranking on the TIOBE index, I was stumped to see that C is in front of C++, and from 2017, C took a leap. Could someone explain why?
|
Let's say I have an Entity that represents an employee:
Employee
First name
Last name
Birthdate
Hair color
Eye color
Gender
.... (and so on)
Now, imagine I have a website with 2 pages: A home page and a profile page.
On the home page, there will be the name and the gender of the last 10 emp... |
I'm currently migrating an app from Heroku to Google Cloud Platform (GKE and Cloud SQL). With Heroku, I've become used to the incredibly simple practice of defining a DATABASE_URL and letting their Heroku Postgres DBaaS do all of the work of connecting my backend to the database:
DATABASE_URL=postgres://username:passwo... |
I'm working on a project with client that needs to rely on a proprietary data set. They also have custom data that logically fits alongside the proprietary data. What they do is use the same tables but with negative ids. So an Example would be
Table: Animals
Fields: animal_id, name, can_purr
So the organization that p... |
Assume I have a lot of DTO for a same domain model like this:
class User{}
//DTO
@Value.Immutable
interface SimpleUserDTO {
getName
getAge
}
@Value.Immutable
interface RegisterUserDTO {
getName
getPassword
getAge
getAvatar
}
@Value.Immutable
interface ChangeUserPasswordDT... |
General Context
I started reading about layer based architectures like DDD, Onion, Clean Architecture etc. I am considering switching, but am currently unclear about how strict the "first level division" into layers is.
Current State of the App
For the app we are working on, imagine a mix between a webshop and the vide... |
Is there a best practice approach in Angular2+ for making the URL the single source of truth for application state.
EmberJs has Route Models, each segment of the URL can have a model and each URL segment model is resolved from left to right, so when resolving the model for a nested page, you can use the model from pare... |
I am wondering about the following question. To simulate an array via a hash table, one can simply set the keys of the hash table to be the indices of the array, and set the value of each key to be the value of the array at that index. In this way, it would seem that anything an array can do, a hash table can do, as we... |
Let’s say for example I am developing a fictional class called WidgetMaker. If the class depends at some point on lookup data stored in a database is it better to design the class with a dependency on the data or a service to fetch the data?
Does it make more sense to do this?
public class WidgetMaker {
public Wi... |
We are currently supporting a very outdated, unstructred, untested and unstable ERP desktop application coded in Windev (on windows). As the days go on, we need to add more features for the users but we keep running into terrible bugs, data loss and integrity issues. Whatever we try to implement in order to save us fro... |
I'm using the webgl framework three.js.
Most of the classes can be "cloned" via a .clone() method.
Wikipedia seems to be very strict when it defines "cloning".
In computer science, cloning refers to the making of an exact copy of an object...
However, i've encountered something like this:
const myClass = new Class(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.