instruction stringlengths 34 36.1k |
|---|
We have SQL Server databases in every retail store, and one database in main office. We want to collect data from all stores and load the main DB (for BI), but we also want to sync data from main DB to retail DBs, when new product is awailable for selling.
The solution has to provide reliable and scalable mechanism for... |
How can I define some rules or additional effects of an action and select it dynamically?
For example, let's imagine a FinancialProduct, which can be a Share or a Bond, each of them having a Hedge. Now while there are several different kind of Hedge, their number is still finite and known beforehand, it is just the Hed... |
I'm struggling to wrap my head around sizing business logic placed in stateless session beans. It is important that I have little experience in this topic.
In the case I have now, there is a JEE application where a REST service (JAX-RS) is responsible for providing data to external systems. In the application the busin... |
we're quite new to DI and we're refactoring our application to use Prism/Unity. We're almost there but got stuck on a circular dependency. I've been reading a lot, there are a lot of similar questions but I'm in doubt as to what would be a 'correct' solution in our situation.
The application is similar to some IDEs. We... |
I have a react element that will potentially call an API multiple times in a short amount of time. Every new call would invalidate the old one as it is a pricing request to the server. Is there a way to verify that I have the most recently made request when updating the data on the front-end?
I was thinking that it co... |
I'm currently building an Asp.Net website that will allow to import data in several formats into a database. The import status of the the single import jobs are visible to all users and given that a user has sufficient privileges he can also stop an import started by another user. If an import goes through the data is ... |
Occasionally I look at the code metrics in visual studio for my solution. I don't ever see anything I would find alarming. My maintainability is usually pretty high with exception to some obvious classes (entity config classes, DAL classes that call SQL, etc). The only time I really ever find the cyclomatic complexity ... |
I am developing on a a large webapp system that has multiple docker containers. Imagine a webapp but with many external restful services running on different containers. A microservices setup.
I am looking to put in place a centralized logging system. So we can trace and find errors.
My initial thoughts was to spin... |
I work for a small startup, < 10 employees. Each of them comes from a very different industry and most are not engineers. This, as you can imagine ignites argument after argument that our product should not do feature X because industry Y doesn't to it however we must do feature Z.
After working for a few other startup... |
I've been implementing Andrei Alexandrescu's allocators as an exercise, but I've gotten stuck on his Freelist. Andrei's Freelist looks something like this:
template<class BaseAllocator,
std::size_t kMinSize,
std::size_t kMaxSize /* Actual size of each block on the freelist */,
std::size_t kBatchSize,
st... |
I was reviewing some old code and stumbled upon a loop nested inside a conditional like this:
std::cin >> number; //number is used elsewhere, so should be preserved
if (number <= 10)
for (int i = number; i > 0; --i)
std::cout >> '*';
std::cout >> std::endl;
However, I've since been taught to avoid nesting ... |
Suppose we've a permissionManager which tell us if user has some privileges to some action or not. We've quite a lot of them(dozen, maybe more).
I see two ways to implement checks for a user, like a:
Dedicated method:
permissionManager.canAdminister(user);
Method with a parameter:
permissionManager.hasPermission(Pe... |
Evening all.
We currently have two feature teams, one Web one mobile. They have their own backlogs. Each have their own product manager and scrum master. Team size is 11 including scrum and product role per team.
We have an increasing demand for delivery outside of the product backlog from other projects. Some will tou... |
Implementing a Finance app, and one of the questions that came up is where to keep an underlying container? Right now I currently have these classes:
class DataGrid : public View { /* widget stuff */
class Presenter { /* handle DataGrid interaction and update model */ }
class Accountant : public Model
{
/* Model for... |
I'm looking to host an entirely static site in Azure and I have the following requirements in decreasing order of priority: reliable, low-maintenance (easily configurable/deployable), performant. I need to run a grunt command (requires some Node.js packages) to generate my html files after cloning/pulling from my git r... |
I'm looking for a way to send a signal between a raspberry pi and a smart phone. What I want to do is hash a few basic bits of information about the phone to use as a UUID. I then want to transmit that UUID wirelessly to the receiver (pi) and then have the pi send that data to my database to be verified.
For transmitti... |
I am aware of Regular Expression Denial of Service (ReDoS). Is there any reasonable way to allow users to create custom regexes while guaranteeing that they don't submit an exponentially slow pattern?
|
The codebase I'm working on makes a lot of use of interfaces that don't actually enforce anything. They're in place more to make sure that a type 'is a' something. For example:
public class MyBatchTask : Task, ITask<MyTaskType>
{
...
public interface ITask<TId> : ITask where TId : ITaskId
{}
pub... |
For example, if I use an enum, which all values are manually defined individually, for example:
public enum MyNum{
Zero(0),
One(1),
Two(2);
private final int value;
MyNum(int value){
this.value=value;
}
public int getValue(){
return value;
}
}
public class Test{
p... |
I'm making an simple application that involves books, using a NoSQL database (MongoDB) -- I think I need to make a DB/schema that stores generic books and their information (title, author, etc.) and then another DB/schema that stores individual instances of books that users own (and user-specific information, such as w... |
This is more of a Computer Engineering question, but what is the feature of a CPU to run Javascript fast? I use to access the internet with an AMD Phenom II with 6 cores and I could almost have as much tabs open and almost everything is instantaneous. Then for the past 3 or so years, I've been accessing the internet wi... |
I'm trying to build a simple file transfer program that transfers a file from a server to a client. I gave it a try myself by simply writing the file to an ObjectOutputStream. This didn't work. I did some research and I found a whole swath of solutions that utilize a byte[] in which the contents of the file is written ... |
After browsing several answers an Stack Overflow, it is clear that some natively compiled languages have garbage collection. But it is unclear to me how exactly this would work.
I understand how garbage collection could work with an interpreted language. The garbage collector would simply run alongside the interpreter ... |
I have two unrelated classes that both share a certain behaviour. Is it appropriate to use a common abstract base class for the two classes, even if a simple base class would achieve the same thing. I will never use register nor does my abstract base class use @abstractmethod.
The only reason I would derive the base cl... |
We're using Service Now and have 2 week sprints. Our management team want to release to production once every 6 sprints and use the term Version for this.
When a story is complete in terms of development and testing, prior to production release, it will sit in the Done column (far right of our board.)
If a story is not... |
I'm familiar with OOP and PHP, but I'm new to MVC frameworks. I'm currently using Laravel and have found it wonderful so far, but things have gotten trickier as I've progressed, and now I realise I need to rethink my architecture.
The project is a digital assets manager for a small client, but I still want to make sure... |
In his book, Eric Evans distinguishes between value classes and entity classes. Value objects do not have an identity and continuity.
Do Value classes contain behaviour? Is it acceptable for Value Types not to have behaviour? The reason I ask is because a rich domain model differs from an anemic one in the sense that ... |
We are having a debate in our teams at the moment around the best process for building our software. My team is following gitflow and building once at the start of the deployment pipeline and promoting that build through each environment.
The other team is building once per environment except for prod where they promo... |
Please see the code below:
public List<DenominationDTO> CalculateChange(
decimal cost,
decimal paymentReceived,
string currencySymbol)
{
var currency = CurrencyFactory.Create(currencySymbol);
var denomination = DenominationFactory.Create(0,0);
DenominationsCalculator = Denomination... |
I know there is a distinct difference between a requirement specification and a user story. However in our company, many of the requirements can actually be defined in a standard template. This goes for small and medium sized business applications based on a single SharePoint site.
I have found that it is much easier t... |
I've been working on a project for about a month now. I am extremely familiar with the code and understand it to the extent where I feel that it is so easy to understand, that most methods don't need comments in my opinion. I can't tell if it's because it is actually simple code or that I am just very well practice on ... |
I need to make a category/type class to identify an object. The usual way to do it is just pass a string to initialize a new category:
category = Category('A')
obj = Object(category)
However, the set of categories to use should be fixed. Nobody should be able to create a new category and use it in an object.
What desi... |
I understand the difference between methods and functions. I also understand all methods are functions but not all functions are methods. I always refer to methods as functions. It feels like a more natural term, probably because in PHP the word function is right next to the name of the method. However method seems to ... |
I wanted to know if the way I deal with source files that need to be deleted from version control could be regarded as bad practice.
I want to explain it to you based on that example:
I recently got very angry because I had to tediously sort out Java classes in a programme that were basically dead code however it was ... |
I'm a little hesitant on what to name a view class.
I have a view class which I call ChooseImageView because that's what the user does in that view. After the user has chosen an image I display a view called ChosenImageView. Is it wrong to name classes after the user action instead of what the view class actually "is"... |
Say I have this function
def function_A():
blah
blah
blah
return A
When is it justified to make that long function_A into smaller pieces, say function_B and function_C and then call function_B and function_C inside the function_A?
|
There is a need to separate services working with data into two groups: ones that perform read-only operations and others doing Create(or Add) + Update(can also be called Modify) + Delete(Remove).
First one will be (obviously) named ReadDataService or ReadOnlyDataService.
What about second one? I'm looking for a commo... |
Say I have the following classes:
ServiceLayer.Service > BusinessLayer.BusinessClass1 > BusinessLayer.BusinessClass2> BusinessLayer.BusinessClass3.
In the scenario above; Service calls BusinessClass1, which calls BusinessClass2, which calls BusinessClass3.
Say each of the classes have a dependency that needs to be inj... |
Back in the old days, we did Hungarian notation. That's now considered passé, and for the most part I don't use it anymore, but I still find use for the m_ prefix to indicate member fields.
For me, if I'm reading through someone else's code, and I see this:
count = 3;
I assume that count is a variable local to that f... |
I'm a graduated software developer.
In the last year I worked like a sysadmin, nowadays, I entered on a different software company as a VB.Net Developer, it means I need to learn and master a very, very huge solution (project) and... well, I don't know exactly where to start studying.
This solution involves a lot of c... |
Somewhere in our GUI we have a string where a spinner (sometimes called a stepper, depending on what toolkit you use) is sandwiched between two labels which make a complete sentence, "Use 1 in every n items as test data".
This has sticky i18n issues that I don't know the answer to.
Can I think of this kind of "1 in n... |
In order words, what's the advantage of writing this:
Listing 1
var sortBy = function sortBy(p) {
return function (a, b) {
return a[p] > b[p];
};
};
Compared to this?
Listing 2
var sortBy = function sortBy(p, a, b) {
return a[p] > b[p];
};
Reference.
|
UncommentatedPannen's (pannenkoek2012) newest video describes a glitch in the Nintendo 64 game Super Mario 64, which allows an object to push Mario out of bounds, which isn't normally possible, by utilizing a stale/dangling pointer in Mario's structure that normally points the the floor Mario is currently above.
Pannen... |
I am designing a REST API but came across some difficulties while naming it. I have an API like this:
GET .../users/{userId}/categories/count
GET .../users/{userId}/categories/{categoryId}/count
GET .../users/{userId}/categories/{categoryId}/tickets
It seems like the API is about users' categories, but actually ... |
I'm working on a Web App where the data is quite sensitive and is required to be encrypted before it is stored in the database.
Now there are two ways through which I can achieve this:
Encrypt data in the code
Encrypt data in stored procedures (using symmetric keys)
Now I don't know which approach will be better reg... |
I am building a JavaScript application where its behavior (some rules and logic) is configurable via JSON.
The configurations are deploy only with a new version of the app.
Currently my app, when initiated make few ajax requests to its JSON files.
I would like to know:
Should I include the configuration as a JavaScript... |
Please see the code below:
public class Calculator
{
private readonly int Number1;
private readonly int Number2;
private readonly int Answer;
public Calculator(int _Number1, int _Number2)
{
Number1 = _Number1;
Number2 = _Number2;
Add();
... |
This question is inspired by Mike Nakis' answer to a question I asked earlier: Should a Calculator be a value type or an entity type?. Please see the code below:
public class Calculator
{
private readonly int Number1;
private readonly int Number2;
private readonly int Answer;
public Calculator(int _Nu... |
Background: I am a Php developer with a keen interest in Enterprise Design Patterns and Architecture. I have a relative (living in a different continent and has no business dealings in the country that I am in) that has just launched a major Online Enterprise Platform that will provide an ERP solution for a certain mar... |
I have a three layer application with your basic client layer, middle layer, and database layer. The middle layer is intended to take requests for work and data from the client, process it, and then store it in the database.
There are a few key points here:
First, requests for work from the client layer should be asyn... |
In TFS, when we put comments for things to be fixed in a Pull Request before we will accept it, should we mark it as Reject or Wait For Author? Which is better?
|
I have a function get() which gets a human object from somewhere. That is literally the only use of human, to provide a collection of properties of a human.
struct human {
std::string first_name;
std::string last_name;
unsigned int age;
std::string location;
};
Doing things like
human user;
user.first_... |
If I may jump straight into it.
I have a web api endpoint where I pass in a collection and it works amazingly but with one caveat.
If one object in that collection contains malformed data (missing required data) it returns a bad request, thus voiding the whole collection - the normal shenanigans but tech lead suggest... |
I'm familiar with the concept of technical debt as the cost of effort (through maintenance, support, rework etc.) incurred when choosing an expedient solution over a complete one.
What I am wondering about is, is technical debt incurred for any choice you make?
Take for example securing an existing application that nev... |
I'm writing some code to do some SSH jobs on a remote machine and one of the methods I'm (forced of) using returns a Vector type. I've learned about them several years ago but never had the chance of actually using them until now.
What I do know about them is
They are not thread safe
They are very old and are depreca... |
On another SE site I saw code similar to this:
int x[] = {1,2,3,4};
....
x[0] = {99};
For the assignment, is there an advantage to this over simply:
x[0] = 99;
http://ideone.com/xwA0Yh
|
What are the gains in actual computing speed (verbosity of code being put aside) and for which case would each be recommended for, as a good design pattern?
I would like to know the above in general but also if it helps in the context of the following which can re-written in all 3 ways
static void parallelTestsExecutio... |
In the context of sports scheduling, I have a ViolationChecker class intialized with a Match, whose task is to check whether placing the match in a given time-slot produces a rule violation or not. An example of its usage would be:
checker = ViolationChecker(match)
match_fits_in_timeslot = checker.check(timeslot)
The ... |
Please see the code below (contained in an IEnumerable method):
int Quantity = (int)Math.Floor(ChangeRequired / CurrencyAmount);
ChangeDenomination = ChangeDenominationsFactory.Create(CurrencyAmount, Quantity);
yield return ChangeDenomination;
ChangeRequired = ChangeRequired - (ChangeDenomination.Amount * ChangeDenomi... |
I have a class that is used to create a "settings" GUI for any other class.
Quick example for clarity:
I use attributes to decorate the individual items. For example, you can specify ToolTipText:
[Attributes.Display(ToolTipText = "IP Address of target computer")]
public string IPAddress;
Now, the actual question:
... |
I have an app which accepts two parameters: payment received and cost. It then calculates change denominations.
It is an MVP app, which calls a WCF web service, which accesses a Domain Layer DLL.
Say a user enters £1 for the payment received and £2 for the cost. Clearly this is wrong (there is not enough money). I ... |
In the SETUP section of my README, should I just link to instructions for each dependency like this:
STEPS
install Appium (guide)
install XYZ (guide)
Or should I reproduce all their instructions here, instead of the links?
Their instructions are out of date. For example, Appium tells you to install Ruby 2.1.1, and t... |
I'm working in C# and doing some communication between 2 apps I'm writing. I have come to like the Web API and JSON. Now I am at the point where I am writing a routine to send a record between the two servers that includes some text data and a file.
According to the internet I am supposed to use a multipart/form-data ... |
I am currently working a School Management project using Spring stack, Kotlin as programming language and Neo4j for storage solution.
Here is the scenario, I am creating a Class entry in the DB. Lets assume the properties of the Class entity object are Name: Nine, Section: A, Shift: Morning. When I am going to save in... |
Writing some services on a system I'm working on has raised some questions as to how to provide the data formatted for the client (views or mobile app). Basically, my doubt is born whenever I need to provide grouped data or data that needs to be changed after the query.
I will use as an example a Has Many Through relat... |
I understand if 2 classes have circular dependency, eg:
public class MyWindow{
public MyWindow(){
new MyDialog(this);
}
public onDialogResponse(int option){
}
}
public class MyDialog{
MyWindow myWindow;
public MyDialog(MyWindow myWindow){
this.myWindow=myWindow;
}
publ... |
For 3 months, I've been working on a Web Project using PHP to create a platform to handle remote lights and sensors. I'm currently working almost alone on it, but we will be 2 on it in the next months.
As we are developping our business, we decided to try to work using an agile-like way of working. Nearly each month, ... |
I am not able to understand this basic recursion example.
When I executed this code. The output was 43210.
Should not the output be 44444, as the value of num is updated to 4 to the latest recursive call or how is the value of num getting changed?
Please explain, any help is appreciated.
|
In my small team we write applications that run as a Jenkins job and using the SOAP API of our Bug Tracker, our ALM software. They are accessed with Java however I think developers using other languages are facing the same problem like me as I regard it as pretty common.
My problem
Let's say I have a java class BugTr... |
I've made the code below work and it is mostly non-blocking except where the process.start code is.
However, my question is, in my winforms application is this the best way to implement the use of async/await to prevent blocking?
Having googled a fair bit to get this far, I'm not terribly clear on what better way I cou... |
I am using entity framework to get a IEnumerable<CustomersEntity>, and I need to cast this to a IEnumerable<CustomerBO> to display it in some view. I know how to do cast a IEnumerable<T1> to a IEnumerable<T2>; but in this case, who will be in charge of it ? I thought CustomerBO could do it, but is it correct for an obj... |
I have the following tree currently to be implemented in Java.
My problems are the following:
How can I go about addressing the fact Admin needs to have all tier 4
logic from both branches of the tree since I cannot inherit all 5 of
said classes?
How can I refactor the tree to reflect the fact that outside tier 4
an... |
I am getting files on HDFS and I have a legacy java app which checks for new files every 15 mins, does some transformations and write them to some remote server.
Now, I am facing scaling issue with this APP. I don't want to rewrite this complex app, I am thinking about adding some files distribution mechanism and runni... |
I created a table of values that return time t in seconds, given an ambient temperature. If one were to plot these values, it might look similar to a quadratic or log. I could just use the look up table, and if the value I need is between 2 points, I could interpolate.
Using this table of data points, what is the proce... |
We have an in house developed and maintained Windows service written in C#. Other people and teams write plugins for this service.
Right now, the git repo for this service includes 3 'demo' apps that are meant to show plugin authors how to write plugins that interact with this service.
My job right now is to work on t... |
I'm trying to improve this document parser and there is one main loop that goes over all of the main elements (let's call them Nodes). Each step (Step) can either Consume or Ignore the Node that it is passed. A Step can also be greedy and consume more than the single Node than was passed to it. A Step could restrict it... |
During the daily standup meeting in the middle of a sprint, the de facto project manager/scrum master usually asks developers some version of:
"So when will this be done by?"
"So can you commit do having this task done by 4pm today?"
"How many hours do you have left on this subtask?"
This is frankly very annoying and... |
As per the microservice architecure, there should be one codebase per microservice with no shared API whatsoever. This enforces a high level of decoupling and every microservice is bounded within its own context.
But these microservices, over time, will communicate with each other. Service A talks to Service B and Serv... |
Our process is that developers create subtasks for user stories to track their work on that particular user story on the scrum board.
Good so far.
However, we have a de facto project manager attempting to "do agile" and take on the scrum master role. During the daily standup, he gets visibly upset when a subtask sits ... |
It always seemed normal to me that the larger a company gets the less amount of work is put by its employees into making the company profitable.
There are obviously no clear marks for this, but I don't think anyone will argue that joe working for IBM has the interested of IBM in mind the same way bil, co-founder of St... |
In software deployment, what is the difference between QUALIF, UAT, PREPROD and PROD?
|
If you look at the source code of a website such as Facebook, you'll see many classes as such:
<div class="_cy6 _2s24"><div class="_4kny"><div class="uiToggle _8-a _1kj2 _4d1i _-57 _5-sk" id="u_0_8"><a data-hover="tooltip" data-tooltip-content="Quick Help" data-onclick="[["HelpLiteFlyoutBootloader","load... |
Context
When implementing a class, there's a distinction between fields that are there because they are part of what the object is and fields that are there because they are needed to implement the object.
For example, if you are implementing an ArrayList, you will have an array that isn't part of what an ArrayList is ... |
I saw a project manager recently stand up at an Bank's internal staff meeting and say:
We're running this system migration not using an agile methodology. We know the requirements up front so agile isn't required.
I've worked on a few migration projects. The challenge is that you discover requirements along the way ... |
I have 5 forms which in hindsight should have an ancestor descended from Form. Unfortunately, the common elements of the forms is a splitContainer and a listbox in one of the containers. Each form has it's own collection of panels in the other half of the splitter.
Is there any way to fix this problem without having ... |
When designing an activity-based authorization system, how should additional conditional checks be handled?
For example, I have the following authority:
VIEW_COMPANY_TRANSACTIONS
which allows the user to hit the endpoint
GET /company/{companyName}/transactions
However, what if my authority VIEW_COMPANY_TRANSACTIONS ... |
I have posts table:
id (int) index
uid (int)
text (text)
created (int)
is_deleted (tinyint)
and a table to store post stats:
post_id (int) index
comments (int)
shares (int)
views (int)
Now when I fetch post, most of the time I also fetch the stats. The reason I created another table was because these stats update fre... |
Say I have a C# app, which is layered. I want to test the domain layer independently of other layers. Therefore I have created a Domain Layer project with three classes e.g. Person, Order and OrderItem (hypothetical).
I have used Inversion of Control (Castle Windosr) so I also have a whole load of other classes:
Pers... |
In a chat application there may be multiple types of incoming messages to be handled. For example, I have messages of these types: text, link, image, and video. Text and link are handled the same way, but image and video require the file to be downloaded from different server.
Also each message may need to be deleted.... |
I have been reading a blog where the author has mentioned the below two styles of coding.
Min and Max 1
int min = Integer.MAX_VALUE;
int max = Integer.MIN_VALUE;
for (int x : array) {
if (x < min) min = X;
if (x > max) max = X;
}
Min and Max 2
int min = Integer.MAX_VALUE;
int max = Integer.MIN_VALUE;
for (int x : arr... |
I'm using C++ concepts to ask the question because that's where it came up, but I'm asking about any language feature or tool that would somehow support this.
Suppose I have a class that's a light wrapper around a list of values. These values are expensive to compute, so they're computed as they're asked for. The objec... |
I'm reading "Learning Python" and have come across the following:
User-defined exceptions can also signal nonerror conditions. For
instance, a search routine can be coded to raise an exception when a
match is found instead of returning a status flag for the caller to
interpret. In the following, the try/except/e... |
My background is in mechanical engineering, so please forgive my ignorance to this area.
I really enjoy programming and software development. Also, I recently took a free online Machine Learning (ML) class, which I highly recommend, taught by Stanford professor Andrew Ng. Link here.
I've heard this professor say that i... |
Two of the OOP metrics, Coupling Between Object classes (CBO) and Polymorphism Factor (PF) both measure coupling.
Is there an instance where of them has a higher coupling while another has a lower coupling? Is interface inheritance one such situation?
Also, how does each of them measure coupling?
|
I'm developing a open source application that have a client and server side. The first version only have as client tvOS, and is being written with Swift.
Now, I'm writing the network system for my client. My client need to make requests for the API and manager websocket with the server.
What would the goods practices a... |
I've always used JSON files for configuration of my applications. I started using them from when I coded a lot of Java, and now I'm working mainly on server-side and data science Python development and am not sure if JSON is the right way to go any more.
I've seen Celery use actual Python files for configuration. Initi... |
As the title says: How do you properly test and benchmark different implementations of mutexes in c++?
Essentially I wrote my own std::mutex like class for a project running on a 2 core, armv7 with the aim to minimize the overhead in the uncontested case. Now I'm considering using said mutex in more places and also dif... |
I have a program that can get code from a user as input (This question is language-agnostic, though I am primarily interested in answers for Java and Python). Usually, this code is going to be useful, but I don't have a guarantee that the user isn't making a mistake, or even deliberately giving malicious code.
I want t... |
It seems the general consensus for unit testing classes is to test your object through its public interface only. So if you wanted to test the removeElement method on a LinkedList class you'd need to call addElement, then removeElement, and lastly containsElement to assert the element was removed.
This is brittle beca... |
I'm developing a C-based software in which I want to use a Model-View-Controller approach, and while I think I quite got into the style's rules, I don't really understand where should I place the methods about connecting to the server (I'm developing a client). One of the cool things of MVC is unlinking the actual logi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.