instruction stringlengths 34 36.1k |
|---|
I have several postgres DB, on distant sites, two in China, 1 in India , one in Korea, one in Germany, one in France and one in Mexico.
All dbs, regardless of their site, have one table that is part of a schema. That table is updated through an excel spreadsheet. The spreadsheet is filled by a physical person.
Joe wil... |
Generally speaking, is it acceptable for a web MVC application to use REST endpoints for it's data access layer? I realize this would make practically every request cost 2 requests and that doesn't sound nice. What I don't know is if this is a "valid" or commonly used approach.
|
I got a question about team managing. Right now I'm dealing with a junior developer who's working remotely from a coding factory. The guy is open to criticism and willing to learn, but I got some doubts how much should I push some stuff.
Right now when something is straight and obvious a violation of good practices: li... |
I'm am trying to understand machine code memory addressing for x86, and I've encountered two opposing general forms for addressing (using the ModRM and SIB bytes).
Most unofficial resources I consult suggest memory addressing is done in a subset of the general form [register1 + scale * register2 + displacement]. An exa... |
The other day I was playing around with an experiment and I had a for loop something like so:
for (Node node : children) {
// do stuff with node ...
}
And then I changed it to do this:
for (Node node : children.stream().filter(n -> n.isCreated())) {
// do stuff with node ...
}
And got this error: Can only iterate... |
I am designing a DSL (in clojure, specifically; though this question is more general than that) in which 'entities' are tracked as immutable hashes/maps, and where the 'concept' membership of an entity is dynamically determined by the keys and values of the maps. A toy example of how this would appear:
(defconcept Ann... |
I'm writing an application on x86_64 CentOS 7 that functions as a server, managing potentially thousands of devices. Because my application doesn't do so well when running through the connection process (various application-layer handshaking, DB operations, etc.) and it's conceivable that thousands of devices could com... |
Without getting into specific language or implementation:
The value of the variables are not known until runtime.
All instances of this class will need this variable.
The obvious solutions:
Use a static variable that I set before I start using that class, but this feels messy because any user would have to remember ... |
Suppose I have 2 features to be delivered (A and B). I have two primary branches (develop & master) for staging and production servers and 2 feature branches (features/a and features/b). When a feature is ready, I merge it to develop branch for testing. Let's assume that there wasn't found any bugs in feature A but the... |
When breaking up a large monolithic application with a monolithic RDBMS into a service-oriented architecture with many databases, how do you deal with the breaking of data integrity?
I have a large monolithic application. My team has agreed that it's beneficial to break up this monolith into domain-specific services a... |
According to the Kafka site:
"Kakfa is used for building real-time data pipelines and streaming apps."
Searching the internet far and wide, I've found the following generally-accepted definition of what "stream data" is:
Stream data is data that flows contiguously from a source to a destination over a network; and
S... |
When software is being developed in an engineering concept, some form of assurance validity must be met, this is in order to measure requirements in each stage of the SDLC. In developing a Software Quality Assurance, guide I came across a reference to Software Quality Plan. They are both similar in structure and my und... |
I wish to test the following method:
class MyClass(object):
...
def my_method(self, args):
... # Code which transforms args into arg1, arg2, ..., argN
self.A.other_method1(arg1, arg2)
self.A.other_method2(arg1, arg2, arg3)
self.A.other_method3(arg1)
self.B.other_method4(... |
I have read plenty of questions on here, which appear to confuse the MVP/MVC Model with the Domain Model. In my mind the MVP Model calls the Service, which then calls a rich Domain Model i.e. the MVC/MVP model is a view model..
I have seen a lot of code, which does this (this is the MVC Model):
public class Model : IM... |
I have an app and a list of all the actions a user has done while using it.
To put an example, for each user I have data like this:
"start"
"country":"aa"
"session":"0"
"menu":"main"
"menu":"play"
"play_level":"1"
"play_during":"70 seconds"
"purchase":"metal hammer"
"play_level":"2"
I have to choose a database where ... |
I need support for Angular2 service architectures. I am quite familiar with Angular2 but I don't see the best way to implement services, error handling and their connection with the components. I'm aiming at small-middle-sized Angular2 applications having not more than a few couple (<100) pages.
These are my main dile... |
I'm a full stack web developer, I've been looking for a job lately as a junior since I don't have experience with working for companies, but I've done some projects in the past from design to deployment(for about 6 years).
In a job interview, I had lately I've been asked what I think is a weird question in the context ... |
In our team we have some low / medium level developers: they know how to write C#/JavaScript code, but most of it is an anemic domain model in a purely functionnal way of coding, but there are no unit tests, SOLID principles are not being respected, anti-patterns are a common practice, only the coding style conventions... |
So I've been developing an API for the company I work for for a year. Recently, I plan to move to another workplace and have done an interview with the recruiter.
She asked to see my GitHub page for code review. To tell you the truth, I'm still a rookie (the API I mention earlier is my very first professional work in p... |
I'm working on some code that checks for some invariants in the database. For example to check that an element is not repeated the code checks for a database error since the invariant is coded at database level.
Basically to enforce uniqueness for a certain set of key the code checks for the error:
if (sqlError = "name... |
I've just done a code review where I came across a method like this:
private void FindMinAndMax(double[] values)
{
// Some algorithm that results in two class vars being assigned:
_min = ...
_max = ...
}
(After returning, the calling code utilises these two values in various calculations; the calling code ... |
We want to practice proper software engineering for our project and allocate some task to do it. Problem is, I don't know where to put it.
Previously we have epic & user stories like:
As a developer, we must observe proper software engineering so that we maintain efficiency
As a developer, my code should not be merged... |
We are writing Spring4 based REST services and had a question about returned HTTP status codes. It looks like the generally accepted approach is to let the app server or web server container handle the responses when the HTTP protocol is not met. For example 500 Internal Server could imply that the apache server int... |
Say I have an MVP app. The form has four textboxes:
Quantity
Price
Product
TotalPrice
The app calls a web service and then recommends products that may be cheaper based on the quantities being bought.
Is it acceptable to set the total price on the client using a setter, i.e.
TotalPrice = Quantity*Price
or should ... |
I am making an application that will allow user to store and execute simple scripts using Web GUI. Web GUI is ASP.NET MVC and scripts can be of any kind (Python, Perl, AWK, CMD, PowerShell ect. User just needs to provide path to executable). Also there are scripts that do not require executable like XSLT, IronPython ec... |
My understanding is that [Flag] enums are typically used for things that can be combined, where the individual values aren't mutually exclusive.
For example:
[Flags]
public enum SomeAttributes
{
Foo = 1 << 0,
Bar = 1 << 1,
Baz = 1 << 2,
}
Where any SomeAttributes value can be a combination of Foo, Bar and ... |
The create and update methods in my model base go through a few steps: pre_save, udpate_database, post_save. The pre-save and post-save are specifically designed to help with object-relational impedance mismatch. The idea is that any database operations that aren't a simple "save value X to column Y in the table" are... |
let's say that I am working with an IoT device.
The device can have many sensors, each of them has an address, i/o direction and a reading method.
temperature=d2,input,digital
humidity=d3,input,digital
lcd=a1,output,analog
From my program, I should read this configuration file and start getting data for example from t... |
While coding anything remotely useful, I inevitably find myself wanting to add methods to perform smaller bits and pieces. (It could be a method to return everything in a string to the left of the first occurence of a particular character.) Over time, writing such methods will propably form into some kind of library.
W... |
I'm writing a library that has a lot of information that may be of use in a log in the program which uses it, but I don't know the best way to expose it in such a way that the program using my library can integrate my library's logs with its own logs seemlessly (if desired).
Picking a specific logging library for my li... |
Our application stack looks something like Java 8 out of Tomcat 7, several distinct Postgres databases, Maven for build and Jenkins for CI. I have fully automated my team's build process using except for one missing subprocess: database (schema and/or data) changes. Once a change is committed to version control, a new ... |
Git by default does not set the file-time accordingly when the files are synced with the origin. It just ignores the file-time of the pushed files.
Doesn't it make sense for the file's modification date to be set to the value of the last commit (remote or local), rather than it leaving it the same as the date it was fe... |
I have a Playframework application written in Scala. As you might expect, it's primary function is to respond to user requests. Typical request flow:
Parse input and figure out what the user wants us to do
Gather external resources from db, AWS and so on (relatively slow, async IO calls).
When IO calls return, execu... |
Context
I want to design a procedure or system task to load into a database, data that's needed by the system in order to work. The easiest example I can come up with is a ACL (or RBAC, not sure which one is the right term) where an user need permission to perform certain actions (create a resource, view a resource, vi... |
I've seen some posts which has strong reason to avoid using protected:
Why have private fields, isn't protected enough?
Why is Clean Code suggesting avoiding protected variables?
And there are some other posts suggested we don't need inheritance actually:
Why should I prefer composition over inheritance?
And some other... |
Is there a "rule of thumb" to when it is right to take partial result from a table, rather than the whole table?
Consider my current dilemma:
SQL view that has total of ~1200 items, the view is not so complex only joining from several tables.
Query for some property, total results ~600 records
Using on UI with ng-repe... |
How do I manage and update two different app versions, which are with and without advertisements, but are otherwise identical, using git. Up to this point in development, I've only needed to maintain one branch.
|
Context:
I have recently joined a new company where they have a particular folder structure in the project where they have different modules in different folders in a single project. Each module folder has separate submodule and then separate child folders for back-end(in Python) and front-end(in AngularJS) code. Separ... |
I made an auto complete text box for an application I'm working on. The text box basically has an associated list that it searches each time you enter something in the box.
If you enter something that is not in the box and hit 'OK', the item is added to that associated list in it's sorted position using a binary insert... |
I have an API which returns a list of articles. An article can have three status: Approved, Pending and Rejected. Now the front-end needs to hit the API in following scenarios:
Get all the articles irrespective of the status.
Get all articles added by an user.
Get all articles added by an user which are pending/reject... |
I have couple of models Merchant and Offer. A merchant can have multiple offers. I am developing a web application and writing a custom component which show offer details like title, description etc. I also need to show merchant thumbnail in the same component.
The data I have is offer list in JSON and each offer conta... |
I understand test-driven development so far that you are only allowed to write productive code when you have a failing (red) unit test.
Based on this I have the question if the test-driven approach can also be applied to other forms of tests.
|
The syntax 3 of protobuf made all the fields optional dropping the keywords required and optional from previous proto2 syntax. Reading some comments from developers it seems that it was done for enhancing forward/backward binary compatibility.
But for me, that could be enforced by just versioning the package names, sa... |
I just started working on a new project and no one throws exceptions over here. I get that you shouldn't be doing that for asynchronous code, but it seems to be a valid way to do things for the synchronous side of things.
I would typically do something like this:
function(thing, cb) {
async_funct(thing, function(stu... |
Say I have an MVP app. Should the Presenter handle events raised by the view. For example, please see the code below:
public void TextBox_TypeValidationCompleted(object sender, TypeValidationEventArgs e)
{
//do something
}
and the code below:
public void Button_Click(object sender, EventAr... |
My job is to come up with an implementation to save searches linked to an individual user, as well as the ability to analyze this data for business cases.
The data will be used for users to see their search history, and for data mining to get insight in user behavior
It will be implemented on an app to find houses, the... |
Now that we have const implemented javascript we can use it to declare variables. But unlike let or var it is 5-character long and I believe it is a big deal actually. Something that even slightly takes longer to type (and read) affects our coding experience.
My question would be - say, one is trying to come up with s... |
I'm working on yesod application which has routes like
/make/something MakeR POST
on which server generates an object and returns its ID wrapped into JSON. I use Int as ID.
So, I ended up using a data types like this
data Manager
= Manager
{ objects :: IntMap Object
, nextId :: Int
}
I store them in TVar in ... |
One of the common arguments for using microservices is better scalability. But I wonder whether this argument is really valid.
Lets say we had an application consisting of 10 microservice with 9 of them having each two instances (for redundancy) and one of them with 4 instances to handle the load (scalability). The pr... |
I have an acquaintance, a more seasoned developer than me.
We were talking about programming practices and I was taken aback by his approach on 'if' statements.
He insists on some practices regarding if statements that I find rather strange.
Firstly, an if statement should be followed by an else statement, whether ther... |
I find myself often having a function, for example authenticate:
authenticate(user, token):
# do authentication
and a dictionary created by reading a configuration file, like this:
conf['general']['auth_user']
conf['general']['auth_token']
My question is, in terms of best practice (python in specific), should I j... |
I am trying to give value to a certain package and library by building some usage stats. This package is written in python and invoked/imported by users on remote machines/cluster
What we are trying to do is to set up a certain tracking mechanism that will register or log every time someone imports the package and idea... |
Firstly i hope im in the right place to ask this question.
I am building a web page that allows the user to select one image from a set of a 100+. i want to display them 6 at a time and the user must be able to search trough them (preferable key up search).
My first implementation queried the Database and returned th... |
Usually on Php or in Java and in other single Inheritance Object Oriented Languages, when I am writing a software I use and Interface then and afterwards I implement the class that implements the business logic.
For example let us suppose we have a File Uploader that allow us to Upload into various ways in our case int... |
I am developing a web application and struggling to follow a clear semantic while returning response to the client. Taking an example of authenticating an user there can be following scenarios:
1. Request is successful
The user is authenticated and I send a JSON response
{success: true} // and an optional message field... |
void Animation::playAnimation() const
{
static const int index = 0;
const std::string& animationFileName =
m_animationContainer.getAnimationName(index);
static const int zOrder = -1;
static bool isLooping = false;
AnimationBank::play(animationFileName,
zOrder,
... |
I've got a Python webapp running in docker container and a DB container/service, and I'm wondering if the apache/mod_wsgi functionality should be contained within the container that runs the python app itself, or separate. I'm currently running them together, but I've seen graphics like the one in this article which de... |
I looked at using python for the AI in a security application for hobby-business but apparently you either release it as source code or it can be easily decompiled. Of the new machine learning languages/packages, which can be kept confidential?
Likely I would use it to identify between good and bad traffic and content... |
Currently working on an accounting application. Wrote the GUI framework from the ground up with Win32 and it works well. The issue I'm having is trying to separate the GUI from the application logic. The classes I've implemented so far are:
class Application
class MyApplication : public Application // Is this my contr... |
I work in a small contracting firm doing small custom projects. We have this continual problem where the customer wants to be responsible for testing the final build to save some money. Most of the projects are reading from a file from one system and creating orders or whatever in another system. So the customer figure... |
I found myself wanting to put a table in a table. I had a momentary war flashback of legacy webpages and email html templates and was about to shelve the idea, but then I considered that it kind of made sense in this case.
I have a table showing tabular game information. There are 2 players in a game. I want to show th... |
Long methods are generally considered bad, however in my code I have some hard-to-understand long methods (more than 50 lines). I have trouble making those methods easier to read because a single statement inside is already more than 50 lines long, and that hard-to-read single statement is to build a database query usi... |
I got a class A that creates an object of type B and persists it on a database.
The class B can be created in several ways so it receives an interface ICreator so it can create the object. Problem is that now I found myself needing to do something after the object is persisted on the database. This is a very specific c... |
We have a Java Application running on Tomcat as the AppServer & Apache as the Webserver.
Currently, we are handling Malformed requests in the Application itself. However, I was wondering if it's better to handle it in Apache by writing some mod or using some existing mod.
What's standard practice for this?
|
I am using DDD approach with c# and for data storage I am using SQL server. Also I am using code first approach with fluent api in order to build database objects from domain.
Since I am using domain to write data and finders to read data from SQL, I was thinking about an approach where fluent api in write mode would b... |
Basically, TCHAR and the associated macros (_T/TEXT) are only really necessary if you're targeting both ANSI and Unicode, and, like 99.9% of developers out there, the possibility that someone might be using Windows 95, 98 or Me is not really a concern of mine. I use WCHAR, LP(C)WSTR, etc. in my applications.
If I'm e... |
For each row entered, the user will have one piece of data in either grams, kilograms or pounds. I supply 3 fields and the user must enter in one. The app then calculates the other two values off the entered value.
I am wondering if it is best practice to store all 3 values in the database, or just store the single va... |
EDIT: note I want a static compile time method, when I know exactly what needs to go where at compile time.
I often find myself having multiple functions which follow the same pattern, but only a few parts change. Often I opt for the Template Method Pattern, however class based approaches (especially in c++) seem ver... |
Based on this Question and its answer :
Object in Business layer same as DTO with logic?
I want to ask :
What if instead of DAL, I'm getting data from a remote service (API) through DTOs. My DTOs here represent prettymuch the business objects with all the relationships in between. Although there is BOs in the API t... |
I came across a DTO class like the below one.
class PersonDTO {
private String firstName;
private String middleName;
private String lastName;
private String dob;
// some 50 fields more
private List<PersonDTO> persons;
//getters and setter
}
Question 1: Is it a good practice to have such huge DTO... |
It is said that in CQRS it is easy to fix a bug, you just redeploy and then replay the events.
But, what if one of the events should cause an external system not in your control to "ship an item" to the customer if you just replay the events the item would be shipped twice.
How do you resolve that?
|
I am designing a database for a document management app for my office. I want to get the backend right so I don’t have issues in the future. Basically all users will be categorized into roles e.g, super admin, admin, staff and interns. All documents will have access restrictions e.g public(all user roles can view the d... |
I am working in a Peruvian company that develops desktop accounting software(.net C#).
We have many clients (companies) each customer can create several companies, in addition there is a new database for each year of each company.
Example:
DBCOMPANY1_2045658512_2015
--------------------------
DBCOMPANY1_2045658512_2016... |
I have a application where user purchases/click the certain products. I need to design the click stream analysis here which product got clicked how many number of time,
user/geographical detail click those product
Here is the design i am planning
Whenever user clicks the product , generate the async call to produce t... |
I have a class like this
public final class Outer {
static final class Inner {
/* Used in the package. */
void f() {...}
/* Used in Outer. */
WHATEVER void g() {...}
/* Used in Inner only. */
private void h() {...}
}
}
In Java, every member defined in the same ... |
I wish to write a chess AI which simulates the way I think over the board, using C++. My focus is on writing the algorithms for choosing moves (decision making), not defining the board and pieces. To my knowledge, most chess programs written to date are focused on taking advantage of the computer's calculating powers (... |
I've switched back and forth ~5 times already. This REST endpoint at /api/tags/ will be for internal use (no 3rd party clients), I'm the only one working with it.
I'm deciding between these two representations:
Flat
{
"types":[
{
"id":1,
"text":"Utility"
},
{
"id"... |
In golang, one can import packages with urls such as import "github.com/foo/bar". Do I still have to include the license of the remote package, as I'm not including library source code directly? How should I deal with this?
|
Lately, there has been a lot of hype around Neural Networks. They took over the field of AI, finding applications in computer vision, medicine, natural language processing, etc.
There are active fields of research in understanding them and their capabilities, but it seems like solving more and more AI problems is more ... |
Suppose I am to make a commit that wrapped a section of code inside another thing, so the section came to have 1 more level of indent. In diff it will show delete 100 lines, add 100 lines though all it changed is indent level, and this is very noisy noise.
If I split one commit into two, the first one is the real code... |
Let's say I have a container in C, for example something similar to C++' std::deque:
struct deque
{
// blah
};
struct deque* deque_create(size_t element_size, size_t init_deq_size);
void* deque_get(struct deque const* deq, size_t index);
void* deque_push_back(struct deque* deq, void* elt);
void deque_pop_front(str... |
Service-oriented architecture (SOA) is a style of software design where services are provided to the other components by application components, through a communication protocol over a network.
Web services are a popular implementation of service-oriented architecture.
What are the other implementations of service-orie... |
I have some doubts about defining non-functional requirements relative to security, modifiability and usability.
Relative to security for example a requirement for a system that needs to use https because it deals with financial information. Can a security non-functional requirement for this be "all transactions that i... |
This question might seem too broad, but I really need help with this.
I am required to choose a standard or notation to model an integration between two business processes, one of which is external.
I'm thinking of UML Activity Diagram or BPMN. But are there any other standards or notations than could compete with th... |
Say I have a Business class called person:
public class Student { }
Say I want to create a factory method for this Student class - something like this:
public Student getStudent(string studentType)
{
if (StudentType=="P")
return new PostGraduate();
else
return new Undergraduate();
}
Should this method go i... |
How do I make a good project structure that allows me to work on Linux as well as Windows with Visual Studio?
So far I've only been using my Linux machine when working on my project and I used this, A Simple C++ Project Structure.
For each application, the folders are:
* bin: The output executables go here, both for ... |
I'm creating a math library that will deal with points as function inputs (as shown below).
public struct Point { public int X; public int Y; }
public static class MyLib
{
public static float CalculateSomething(Point point1, Point point2)
{ ... }
...
}
My plan is to be able to use it alongside various g... |
We have a concept that all code in a Pull Request into master should be production ready. This makes sense and is a fair statement in my opinion.
The idea here being that once you create the PR, you are stating that you would have put this into master, but would like some reviewers to simply 'concur' with you and spot ... |
Why do some companies prefer private Microsoft solutions when in the majority of cases there are open source solutions or free software for them? What does Microsoft offer that the open sourece or free software communities do not offer?
|
I have read this article: https://www.gaui.is/how-to-mock-the-datacontext-linq/
Since this article is almost 4 years old I have no hope that in article's comments my question will be answered so I decided to ask it here.
In this article author creates another MockRepository and MockUnitOfWork classes and implements the... |
As interface segregation principle suggests no client should be forced to depend on methods it doesn't use, so a client should not implement a empty method for its interface methods, otherwise this interface method should be put into another interface.
But how about concrete methods? Should I separate the methods that... |
Sometimes when I write a class or piece of code that has to deal with parsing or processing of data, I have to ask myself, if there might be a better solution to the problem.
Example 1:
In a recent exam we had to write a simluation for a carsharing service. We were given a city which was divided into several (n*n) dist... |
So I'm writing a Flocking System (http://www.red3d.com/cwr/boids/).
Each boid calculates it's vectors, I would like to draw these vectors with a helper class for debugging purposes.
Who should implement the DrawAllLines function ?
Please note that I'm using c#, so there is no friend functionality like in C++.
Please a... |
I'm working on a Scala project that uses DynamoDB for persistence, and does this by modelling the records as case classes.
This is becoming increasingly more relational, which means we have classes like this:
UserRecord(
id="1",
name="Matt",
friendIds=Seq("2", "3")
)
which are then converted into a busines... |
thanks to the .NET evolution, today we have a lot of different frameworks and technologies. I'm very confused about the differences about it.
What is the difference between:
.NET Framework
ASP.NET
.NET Core
ASP.NET Core
.NET Standard
?
|
I have read that Windows 3.11 uses cooperative multitasking, which means that the OS does not do process scheduling whenever it wants, but rather the currently running process "yield" the execution to the OS whenever the process wants, and then the OS chooses the next process to run.
But what I want to know is what is ... |
I'm pretty new to domain driven design, but I'm interested in its benefits. Currently, I'm working on a C# application that will run on a one-off basis to import data from many different spreadsheets (over 100) into a cloud-based system. There is no UI, and there is no user interaction. There's simply a target folder t... |
I am developing a Rest API, and I am asking myself:
Is it a good Idea to put base64 encoded data in Json, e.g. for file uploads? What if the base64 contains some of {,},: characters and breaks the json content?
If is not a good idea, what alternatives are widely considered to be best practices?
|
I used Spring Boot 1.5 which uses Logback.
I created event objects in controllers and validated them using @EventListener. When a validation error happened I raised an ApplicationSpecificException and caught it globally using a @ControllerAdvice @ExceptionHandler. I thought it will make my design cleaner.
The thing is ... |
Is it OK to use table column names as keys in a key/val pair on the JS side when making XHR/AJAX requests?
In JS, I'll do something like this, where I specify the data to insert into the table, using actual table column names as keys in the key/val pair:
function createAccount() {
var params = {
name : 'John Smi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.