instruction stringlengths 34 36.1k |
|---|
Overview
I'm developing a number of .NET Core applications and I've met my current sprint commitments early. Until my next sprint begins, I'm using the slack to look into setting up a CI pipeline for my projects (this hasn't been hugely necessary as I'm the only person working on these projects, but it would be helpful... |
We have a fairly complex Gruntfile.js that performs numerous things to process a bunch of EPUBs. It's part of our CI process being run regularly on Jenkins. Sometimes we want to notify the person who initiated the build of things that occurred - not errors but rather warnings (the task can continue but something abnorm... |
This is a question I see a lot. Most people say UDP is always better for real-time games than TCP. My understanding is that TCP tries to re-send packets over and over til the other side gets them whereas UDP doesn't care.
Most of the things I've read is that UDP is a must for any realtime game and TCP is terrible. But ... |
In Steven Skiena's The algorithm design manual Edition 2, he talks about dynamic arrays on page 67, which results in them having same Big-Oh as normal arrays. I don't understand how. This is what book states
Half the elements [in final array] were moved once, a quarter twice, and so on, so total movements M is given b... |
I'm setting up a microservices architecture, and am confused about how gRPC can loosely-couple services (compared to a pub-sub message service like Kafka). Doesn't the request go directly to the server, and not through a pub/sub system? While gRPC supports asynchronous requests, should I still use pub/sub as a buffer... |
I am learning to create simple Unit tests to eventually (and hopefully) start to do only TDD; for now I am trying to write tests for code already written to see what might cause problems. This is one of them.
Let's say I have this simple class (with Typescript-> Javascript):
class PrivateStuff {
greeting: string;
... |
We are in the process of slowly splitting out a monolithic application to smaller services and one of the debates we are having is how to manage dependencies. The challenge we have is that service A has a dependency on B. A pulls its dependencies from the release Nexus repo.
The problem is B is built and the dependenc... |
I have an application that has an SQL command timeout 3 minute. What would be the impact if query finishes processing in 1 minute?
|
I am new to NoSQL and have always heard of "key-value" DBs like Cassandra or Riak and expected their tables to literally have two columns: a key-col and a value-col. I just started working at a new shop where the senior engineers chose Cassandra as the main datastore and setup their own Cassandra cluster themselves. Ba... |
Application background
A short description of what the application should do
I'm developing an application which analyses DNA sequences. The user will load a certain file containing a DNA sequence. Then the user can click on a button to search for ORFs (parts of the DNA sequence with specific features). These ORFs can... |
I am redesigning an existing SQL Server-backed web application. This application is used for tracking subjects (names, addresses, phone numbers, etc...) and related data (assessment information, court information, school information, etc...). One of the requirements is that certain users should not be allowed to see ... |
I am trying to explain the benefits of version control to a colleague (recent graduate with little software experience), but he doesn't think it is useful in his case.
I explained you commit every time you write a new function, fix a bug, or generally add anything useful to your code. The stuff he is working on started... |
I am building a WMS with the following basic requirements:
Each Item can be in multiple Locations.
A Location can contain multiple Items.
For each Location / item combination, I must be able to track:
QtyOnHand, QtyReserved, and QtyAvailable.
One Location can contain another Location.
The basic required behaviour of ... |
With Doctrine annotation processing engine for PHP, and Annotatons being used for Doctrine Entities and for Zend Form, and possibly other things, and use in other languages as well, it looks like Annotations are here to stay.
Example Annotations for Zend Form:
/**
* @Annotation\Filter({"name":"StringTrim"})
* @Anno... |
I was going through old code and noticed one pattern that repeats itself all over the place - dynamic dispatch.
While I don't see any problem with the implementation itself, I was wondering if there are other ways of handling dynamic dispatch.
To bring an example - consider a scenario where at run time I'm going to get... |
Up to now, I was considering MySQLi functions in PHP one example of DAL. And I initiated a simple project to publish in an article with the title "starting with PHP and DAL and MySQL"
But when I made a search for some topics to add in my article I "discovered" two things:
The website PHP.net don't list MySQLi in there... |
I have an active record based ORM with soft deletes (Laravel Eloquent to be specific) in an SQL database.
The 'soft delete' behavior that is built in to the ORM is:
If the record is not deleted, then deleted_at is null. When a record is soft deleted, the deleted_at field is populated with a timestamp.
The ORM uses the ... |
Consider a greenfield development situation where cloud tools are being considered vs. in-house solutions, in the vein of AWS SQS vs. self-hosted Kafka, ECS vs. Mesos-Marathon, Lambda/Azure Functions vs. Whisk vs an array of custom APIs/services.
All else being equal (financial cost, technical expertise, etc.), how can... |
I have several backend services (REST+SOAP) that have to be consumed by a SPA (Single Page Angular2 App).
As JWT (JSON Web Token) is not feasible for me for the moment, security is done using CAS Central Authentication Service ( single sign-on protocol ).
In order to avoid CORS (Cross-Origin Resource Sharing) and to ha... |
I have a class Item that has a non-default constructor and doesn't have a default constructor. There is no default constructor because I don't want to have Item objects with some strange default values around.
class Item {
int a;
public:
Item(int a) : a(a) {}
}
Another class User uses Item class and has a... |
I recently read the Building Maintainable Software book by Joost Visser and feel there is something they haven't discussed.
The title hints as much, I do not know if following the guidelines have anything to do with field/attributes.
The relevant guidelines:
-Write short units of code
-Keep your codebases small
Can I... |
Many java DI frameworks (Spring, CDI amongst others) implements some kind of qualified injection through user-designed qualifiers annotations.
interface Engine { .. }
@Powerful
public PowerfulEngine implements Engine { .. }
public class Car {
@Inject @Powerful
private Engine engine; // will inject a Powerful... |
I have ecommerce webapplication, that can connect to multiple storage systems. Currently I am using nuget to deploy it.
I would like to split my application into parts (per storage system), because it takes long time to build and debug it (all referenced assemblies are scanned for DI). There will be only one storage sy... |
For example if I have a constant, like generated password size, then where should I put that constant if the random password generator is implemented in the infrastructure? I guess this should be a domain service, but I guess I cannot put the constant in the service interface. Or can I?
I ended up with this:
namespace ... |
I have one method which stores some value in to the row set and then these values update in the database in caller method.
Is it good practice to put it under system test?
updateStatus(documents) {
Iterate over the documents {
Row row=rowset.egtRow(index);
update the status in row.
}
}
|
I'm a computer science student at some college out there but i'm a little confused with using the SRS and various diagram such as activity diagram or use-case diagram. I know the objective of the SRS is to minimizes the time and effort required by developers to achieve specific goals and to reduce the development cost ... |
I made a tiny wrapper for fluent precondition assertions in c#.
Now basically in all public / contract methods i assert the values this way:
Precondition
.For(()=>Model)
.NotNull();
Precondition creates a ValidationRule Instance on which I have the given validation methods.
Now this happens ver... |
Let's say I need to implement an application which requires email confirmation for new users. When a new user registers, an email which includes a confirmation key is sent to his email address. When he consumes the key, his registration is complete.
The confirmation keys are generated at registration (and associated wi... |
Abstract
I'm working on a REST interface to a graph database (Titan/Gremlin-Server, but this shouldn't matter) that has a strong sense of type for vertices and edges. I'd like to design a REST API to perform CRUD operations while enforcing some type information.
Overview
The purpose of this database is to model the fl... |
I am a Python programmer primarily who uses pylint for linting source code. I am able to eliminate all of the warnings except one: Invalid name for a constant. Changing the name to all caps fixes it, but am I really supposed to do that? If I do it, I find that my code looks ugly as most of the variables are constant (a... |
We will be building a system with the UI in javaFx that will be deployed to 2000+ machines (minimum is 2000, but it will be more - can reach 5000 machines).
For other reasons/limitations it must be installed on the machine, so we cannot do it with a web browser interface.
The 2000+ machines will be in different geograp... |
I have an application in which users can rate items from a list by whether they like or dislike them (users may also choose not to rate an item).
There are millions of items which can be rated by users in this positive/negative/unrated way. I am looking for a solution to what sort of database and database design would ... |
Our company will purchase a large and very complex piece of source code for satellite communications.
It is coded in C++ and we will code additions to it, also in C++, linking our code with the purchased code into a single executable unit.
Is it necessary that we use the same compiler and same compiler version as w... |
I am building a series of web apps connected to a single point of authentication. Basically, a user tries to access a site, if not authenticated they are redirected to the central auth system's login page. Once they successfully login, they are redirected to their app. From then on, if they access any other app they wo... |
I apologize if this is a little vague, but I'm curious about what most people use for naming conventions for classes that access a webservice. Typically on my team we create separate projects for BLL (business rules), Model (DTOs and ASP.NET model classes), and Data ( typically Db and WS I/O ).
My question is in regar... |
and sorry if the question seems a bit naive.
I'm currently reading tutorials about Kafka & Spark and there's something I can't figure out : how to exploit / expose the data Spark received.
Here's what I'm trying to understand :
A lot of events <=> Kafka broker <=> Spark receiver <=> Map/Reduce/Transform/Aggregate/MLear... |
I want to find out what part of "loosely coupled" code it is im failing to understand.
Say I have an object Person im using in both my client and server code. If I change a certain field in Person from type int to int[]. What I've found is that there will be a huge ripple effect in my code almost everywhere I've used t... |
I have in my relational database three tables like this: Route -> RouteStore -> Store. So I can modify which stores can be part of a route every certain time (adding or removing) and I need to keep a history of these changes. Someone I know suggested formatting the data into a text format (JSON this case) and save it i... |
Given an array A of N positive integers (N <= 20), we have the following operation. For any two consecutive non-equal elements, we can replace the larger number by the absolute value of the difference between these two numbers. We keep using this operation until all elements are equal. Find a way to make all elements a... |
Let's say I have an interface such as
Public Interface CarManager {
Car getCar(String model);
}
And I have a lot of legacy classes that implement this interface.
But now I have a new requirement where I still need to implement this interface, yet the getCar method would now require a new signature such as
Publi... |
Here is a scenario:
User submits a story. As as a user I want X so that Y and Z.
Story does not make in the sprint, and then the next sprint, and then the next, etc.
I am noticing stories lingering on the backlog for months while others are submitted and added to a sprint in short order. I see a risk that users watch... |
I noticed that the Airbnb Android app sends such an intent to open a map app at a particular latitude/longitude:
geo:0:0?q=77.77%2C88.88
From my simplistic point of view, they should use the standard Geo URI scheme instead:
geo:77.77:88.88
Is that ?q= syntax a kind of de-facto standard?
Is it a trick that solves issu... |
I am overviewing a structure where a mapping table of student enrollments is done. I am wondering whether an additional column (class_category_id) to the mapping table would become a problem or a noticeable advantage. That additional key would be used to filter very often.
Here's a simplified structure of the database:... |
I need to rewrite old ASP.NET web forms VB application to new ASP.net mvc in c#.
Problem is that most of the old application logic for data inserting retrieval is written in stored procedures, which got messy over time, as old team was adding tons of stored procedures, which are doing the same thing, but contained sma... |
We are starting a new project, from scratch. About eight developers, a dozen or so subsystems, each with four or five source files.
What can we do to prevent “header hell”, AKA “spaghetti headers”?
One header per source file?
Plus one per subsystem?
Separate typdefs, stucts & enums from function prototypes?
Separate s... |
Problem
We have a number of different customers getting a number of different price files, each customer can then also have different styles of pricing files for example customers can have just two columns, product and price. Some customers can have up to 20-30 fields each of these fields can exist in different tables ... |
This page on JS Promises says it is a software abstraction. What is a software abstraction and why is the JS Promises called software abstration?
|
I am designing a REST API for my mobile clients to interact with our app server (built with Django/django-rest-framework if it makes any difference).
There are a number of different objects accessible through the API, some changing frequently (say daily), some almost never changing (on average less than once per month)... |
This question takes a Spring Boot service as an example, but it could be any technology.
Assuming the following:
Environments (dev/QA/prod) are owned by different teams. This means dev must not have access to prod configuration.
Configuration (let's say application.properties) is externalized, ie not part of the binar... |
I am currently writing a Python program with a main process distributing work to a number of worker threads via separate worker queues per thread.
I am now having the problem that the main process needs to know what kind of work a worker thread is doing at a particular moment, since the job allocation depends on this (... |
# Introduction
I am working on a CMS application in PHP with about 200 classes.
The CMS, in general, does the same thing every CMS does: generate sites.
I am learning a lot about OOP and design patterns and only recently started learning about how to create maintainable code using Dependency Injection.
The issue is tha... |
I have an existing project running in the ASP.NET technology. Currently, the entire business logic calculation is happening in the database sProcs (MS SQL Server). And at times, the application becomes slow when it being used by plenty of users during the busy time of the day.
Now we want to move out some of the busin... |
I am building a PHP CMS system that parses template files and replaces tags with content. Sometimes this content is a HTML, CSS or JS snippet, but it can also be a code include.
Most code includes use dependencies, already set in the main scope: the app class, where the start() function resides and all needed domain ob... |
I have a method of coding/refactoring that I now automatically do, but I realise I don't know what it's called.
If I am making a change, and realise there needs to be a change to some existing code, I always consider if I can do that change first, without any change of behaviour. If I can, I do so, making sure tests pa... |
[Summarized answers inserted]
When working in a feature branch and I find code that should be refactored that is not related to the branch aside from the fact that it is in the same file I am working in.
Should I create a new user story?
The consensus is that there should indeed be some sort of new PBI covering the re... |
I have a structure that might have 2 more members depending on a preprocessor variable.
struct foo {
int m1;
// ... (other members)
#ifdef MORE_MEMBERS
int m2;
int m3;
#endif
}
In some parts of the code, I need to change some function calls from func(foo.m1) to func(foo.m1, foo.m2, foo.m3). The... |
I would like to ask how to convert a method so that it can return any type depending on what happens within it.
What I have is the start of an application which will visit a number of webpages (and ultimately perform some tasks on each) before moving on to the next.
At the minute I have this:
using System;
using System... |
I am writing an action plan for a personal software project, which I will do research on before and during development. I think the name "action plan" does a decent job describing what it is used for. The research report that will be written after the action plan, will be finished at the same time the application is do... |
I would like to create a IQueryable Where method as shown below:
public static IQueryable Where(this IQueryable source, string predicate, params object[] values)
{}
So instead of Where(u => u.Points >= 20) I could pass a string predicate like Where("Points >= param0", 20)
What would be involved in accomplishing this t... |
Is the disassembly listing generated by a disassembler exactly the same as the assembly code listing that is optionally generated by a compiler during the compilation of C code?
|
My app has 2 projects: logic.dll and GUI.dll. Currently, its size is 1MB, but the whole app's size is 60MB+ due to the dependency dlls.
I've read about QT-LGPL license and know that to keep my app closed-source and commercial posibility without paying license fee, I have to compile it dynamically.
My question is:
1> Ca... |
Let's say I have a forum application running, and I start building a separate web application with a Python web framework. Both applications use their own MySQL databases, which contain their own respective user account tables. What would be the best approach to keeping the users between the databases in sync? I want t... |
For example, a simple program in a simulated environment that waits for user input seems to be doing no work, so I guess it uses CPU only for the time.
I'd like to know if computer systems (that don't have any services installed or are disabled ie. logging, updates, etc) could theoretically have constant/zero/minimum ... |
Is the strategy in the strategy pattern always an interface? What pattern would it be when the strategy is abstract?
|
After dealing with C#'s async/await pattern for a while now, I suddenly came to realization that I don't really know how to explain what happens in the following code:
async void MyThread()
{
while (!_quit)
{
await GetWorkAsync();
}
}
GetWorkAsync() is assumed to return an awaitable Task which may ... |
Is it legal to collect some usage data of a open source library?
Let's say, I would like to know Things like These:
Name of the assembly, using the library
Number of Startups of the assembly, using the library
Am I allowed to collect information like these as soon as the .net assembly loads (we're talking about Deskt... |
is it bad practice that controller call the methods of domain objects directly instead of service?
to explain more:
I figure out that in good design controllers call service and service use Domain objects(entities).
but sometimes in controller I don't have/need any logic and just need to fetch from db and pass it to vi... |
How would you implement a very large file upload functionality with a Django application and S3?
In my side job as a photographer, I have several clients for which I have a need to share multi-gigabyte archive (zip, tar) files with that contain the originals as well as the processed images of the event in question. Up... |
I am writing a collection that accepts a time parameter, the purpose is that after that specified amount of time have passed the element won't be present in the collection.
I want the user of this collection to be able to act when an item is removed from the collection under this circumstance. I have two different ways... |
I have the following grammar for logical, relational, and arithmetic expressions which I need to make LL(1) compatible.
E -> A | B
A -> A op1 T | T
T -> T op2 F | F
F -> ( A ) | v
B -> B lop B2 | B2
B2 -> A rop A | ( B )
op1 -> + | -
op2 -> * | /
rop -> > | < | == | <= | >=
lop -> AND | OR
So far I have been able to ... |
I'm trying to calculate the sum of 2 bits using basic binary arithmetic and currently, I'm doing this:
function Add(bool a, bool b, bool carry)
{
return
{
Result: a ^ b ^ carry,
Carry: a & b | a & carry | b & carry
};
}
Is there a way to shorten the expression that calculates the Carry or... |
Problem Statement:
Alexa has two stacks of non—negative integers, stack A = [a0,a1, . . . ,an_1]
and stack
B = [b0, b1, . . . ,bm_1] where index 0 denotes the top of the stack. Alexa challenges Nick to play the
following game:
In each move, Nick can remove one integer from the top of either stack A or stack B. Nick ke... |
Is there any generalized rule to decide if applying greedy algorithm on a problem will yield optimal solution or not? For example - some of the popular algorithm problems like the ‘Coin Change’ problem and the 'Traveling Salesman' problem can not be solved optimally from greedy approach.
|
In a good layered design of an application, where would logic that generates an order number for an order entity sit?
The logic will need to lookup and increment either a sequence or a table with these ranges.
For example, if i have a service called CreateOrder in OrderService, would this logic sit in another method ... |
I have inherited ASP.Net Web form code. Here the business layer is just calling the function of data access layer. For example
public string GetCountry(int countryCode)
{
MyDLSrv obj = new MyDLSrv();
return obj.GetCountry(countryCode);
}
In short, if you see method signature of function in DAL and BL, it is more o... |
I am reading "Revised^5 Report on the Algorithmic Language Scheme," "1.3.1. Primitive, library, and optional features."
In particular, implementations must support portable code by providing
a syntactic mode that preempts no lexical conventions of this report.
I don't understand this passage. Maybe it's because Eng... |
I am developing a SOAP server which receives data from many different asynchronous sources (CORBA), updates its internal state and pushes data to its clients.
I have a StateManager class which is a Singleton and that encapsulates the server state. I am wondering if it is a good idea to use Command pattern to isolate ac... |
I read this in a book:
Most of the time, calls to third-party products are entangled
throughout the code. But if you really abstracted the idea of a
database out—to the point where it simply provides persistence as a
service—then you have the flexibility to change horses in midstream.
Could you please explain to ... |
I am working on a Domain Driven Design project and I have the following problem.
I am trying to create a repository that returns a list of objects. The objects have 15 - 20 properties and according to usage I need each time a few of them. Returning full populated objects will cost during population, serialization - des... |
I understand what to include in ordinary release notes - there are many questions and answers relating to that.
What should I include in the first set of release notes, i.e. for the very first released version? Are release notes needed for the first version?
|
Here's the problem and how we currently manage this at work.
We have a buildout recipe that fetch multiple git repositories. Sometimes, it is necessary to patch a module from a repository that we don't own (public repository). At my previous position in a different company, we used to fork all the public repository and... |
I have a tree-like structure of objects. Objects have different types but all of them are inherited from the same base class. Now I want to send some kind of command objects to the nodes. Command object has address of the target node and should be passed through root node and intermediate nodes untill it reaches the ta... |
Basically I am calling a Server and expect a JSON response. The complication is when I need to pass the parameter which is in the form of JSON. The initial outcome of my thought process was to have a file that has the JSON input and can be modified according to the individual commands.
This approach is cumbersome for ... |
I have solved an issue on an open project, on a dedictated fork I've made.
After that, I've committed, pushed and merged (pull request) into the main master repo.
Now I wish to work on another issue.
What's the best way to do this? Should I use the same fork I worked on for previous issue(s)?
|
I am implementing a validation system which has some constraints, there are category of users let's say 30 and for each category there are number of rules. Actually there are 100 different rules.
I have a multimap which maps given user_category_id to list of rule_id's.
Constraint 1.
The rule should only execute if its ... |
I'm developing an application that connects to a database, and I'm using DI/IOC. When running the entire application while developing, I naturally want to avoid hitting the DB. Currently, I have something like this in my composition root (using SimpleInjector):
#if DEBUG
container.Register<IDbActions, MockDbActions... |
I'm trying to improve indoor gps accuracy in ios application. Do people apply such filters to gps data in different apps which track your position? I have 10-20 meters error indoors when using raw data from corelocation so will Kalman Filter have any impact on accuracy?
|
When designing a REST API, is it common practice to include endpoints that allow you to see if potential resources exists in the database or not (before you eventually fetch them)?
For instance, if I want to request product data using a fetch, should I check to see if the potential resource even exists in the database ... |
I have been making the mistake creating branches at the User Story Level. See: User Stories != Features.
I believe I have been doing it this way because of my poor practice in organizing Features and Epics that are both permanent and really just organizational post to parent the underlying stories (EG. Improve Homepag... |
I have a project where I have two classes that both require a database access object that updates the same table. The constraints of the framework and project make it so that I cannot combine these two classes. I have created a case below that shows how the setup is. Class A needs to be able to update and read the reco... |
I am developing a multi-tier software solution where I have 1 server, n thin client engines(TCE) and m thin clients at the most basic level. I plan on having many other components for scalability where extra components can be added for congestion etc. but these are the basic components.
When I originally designed the ... |
We have e-commerce websites for mobile phones. We are building restful api to POST,PUT,DELETE,UPDATE mobile phones.
Every mobile phone will have basic features like:- price, manufacturer, year of manufacturing, color, discount.
Along with this, most of the mobiles will have images too.
Additionally few of these have ma... |
I am new to git and trying to understand the best practices about commits and merging.
Of course you shouldn't commit buggy changes to the master branch, and from what I understand you should create new branches for features / bug fixes in your project.
After testing how merging works, I see that when merging some br... |
How should we create new aggregate roots in cqrs architecture? In this example I want to create new aggregate root AR2 that holds reference to first one AR1.
I'm creating AR2 using AR1 method as starting point. So far I see few options:
Inside method in AR1 createAr2RootOpt1 I could call new AR2() and save this object... |
Millions of position data is coming in a system which needs to be stored in a database. The data comes in pipe delimited formats in flat files,on a regular basis say twice a day. And most importantly out of a million records only 5% would have any change. Other records remains same as in earlier feed. Suggest an optima... |
If I have a method that receives a value as parameter and stores it in a field for later usage, but then goes on to use that value - why would I use the parameter instead of the field?
private RailState _railState;
public void UseParameter(RailState railState)
{
_railState = railState;
railState.SetActive();
}... |
What is the best practice for specifying which classes are allowed to be stored in a class property? For example if I had a DTO with a
property that should allow ClassA, ClassB, ClassC,
another property that allows ClassC, ClassD, ClassE,
another property that allows ClassA, ClassC, ClassE,
how should I define th... |
On the net and in books you commonly see examples of the visitor pattern just using "commands" i.e. methods perform an action and have no return type.
Is it OK to use this pattern for a query function as well? Take for example this Visitor interface which gets the status description from the specified Status object...
... |
Say we have an interrupt that is generated once each time that 1024 bytes of network traffic arrives. Each interrupt takes 3.5 microseconds to process and the network speed is 100Mb.We want the amount of cpu used per second
Is it correct that:
1 interrupt 3.5e-6 seconds 3.4e-9 seconds 1.25e7 bytes
-----... |
Is it considered bad practice to call Close for a database connection within a using block?
for example:
using (SqlConnection conn = new SqlConnection(sConn))
{
cmd.Connection = conn;
// do database stuff
conn.Close();
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.