instruction stringlengths 34 36.1k |
|---|
I want to release some C++ code under MIT license in GitHub. I would like to include required BOOST libraries in the repository. No commercial use is currently foreseen. I am pretty new to IP issues, sorry if these questions are obvious.
Can I freely redistribute BOOST binaries in my GitHub repository?
Do I need to in... |
This is actual production code, and I think what I have stripped out is truly irrelevant to the question. (If I'm wrong I'm sure I'll be corrected.)
This is a request object received by a .NET Web API application. Our application has dozens of them, and they each have a Handle() method.
I'm not the most experienced Web... |
What is Allison's Algorithm and how does it aid in converting hex digits into ASCII characters?
;algorithm (found online)
ADD AL, 90h
DAA
ADC AL, 40h
DAA
http://computer-programming-forum.com/46-asm/f85ec43b17441011.htm
|
I am currently reading and working through "Clean Code: A Handbook of Agile Software Craftsmanship" by Robert C. Martin. The author talks about how a function should do one thing only, and thus be relatively short. Specifically Martin writes:
This implies that the blocks within if statements, else statements, while st... |
This is a design-based question. I'm not at liberty to discuss the actual case I'm dealing with, but the example I provide is representative to the actual problem.
Background
Let's say we are creating books that have different endings based how somebody progresses through the book. For simplicity, our system generate... |
I've been looking for the ideal coding patterns used to score well in a Cyclomatic Complexity.
Of course, code will be subject to change according to what is being developed but regardless the objective of the application there will always be the fundamentals: conditions, returns etc.
For an instance, what is consider... |
Here the professor said that, Tournament sort needs (n-1) + 2(n-1)logn comparisons.
{Where (n-1) for calculating Maximum or say creating Tournament structure
and
2(n-1)logn for other elements to sort}
Why did the professor leave out the number of comparisons needed to find the Minimum? Because to calculate min elements... |
I am working on a large J2EE application. I am not very familiar with front end development, and I am trying to trace through the entire application(not in one shot). I am looking at a test case right now and know how to create the problem (functionally) now I am wondering how to stop the code at this specific spot in ... |
I am refactoring a large code base, and noticing the author often uses "my" to prefix object names. For instance, using myThingy to identify an object of type Thingy. Is this generally considered a good or bad naming pattern?
After listening to Software Engineering Radio's episode on naming, I am suspect to naming patt... |
I have one interface with let's say 2 methods and has 3 different implementations.
public interface IFace {
public void method1(Param1 param1);
public void method2(Param2 param2);
}
public class A implements IFace {
public void method1(Param1 param1){}
public void method2(Param2 param2){}
}
public cla... |
My company is rewriting our web application from scratch. It's a large enterprise level application with a complex domain in the finance industry.
We are using an ORM (Entity framework) for persistence.
In essence, half of our application centers around gathering raw data from the user, storing it, and then the other ... |
Javascript has a pattern for creating private functions called JavaScript's Revealing Module Pattern.
It hides your functions in a closure that returns an object modified to provide access to the functions you want public.
Both languages have the same lack of a private keyword. Sure you can use the leading underscore c... |
I recently asked this question: Return domain objects from the repository
I have come accross this article: http://enterprisecraftsmanship.com/2015/04/20/types-of-cqrs/. Option 1 and part of option 2 talk about having a Data Transfer Object for queries and domain objects for commands.
Say I have a domain object like t... |
I'm working on a larger project. I hope I understood DI well and based-on that I'm able to do this:
// domain object holding configuration ata
var input = new GeneratorInput
{
Constructions = new List<Construction>(),
InitialConfiguration = null,
MaximalNumberOfIterations = 10
};
// poor-man's-DI solution
... |
What are the techniques for C programs which allow easily inspecting the state of the embedded device, through a communication link?
For example, for a microcontroller device which communicates with other devices, an external device might want to perform queries similar to:
What is the battery level of this device?
Wh... |
I've been seeing people combine SDL2 and OpenGL (glfw.h or glut.h) for a while now, I've done some research and found out SDL2 runs on OpenGL. So why does people combine these two? Some people discussed how they use SDL2 for making the window and OpenGL for everything else, but that doesn't make sense since OpenGL can ... |
I have a large calculation to do. While I can utilize all cores, I thought is there any reason to leave off 1 core and not to utilize it? (calculation cpu only no IO). Or am i underestimating the OS that it would not know to handle and do proper context switching even if I utilize all cores?
|
I was reading this article recently: http://enterprisecraftsmanship.com/2016/09/08/domain-services-vs-application-services/
The writer recommends a class like this:
public sealed class AtmService // Domain service
{
public void WithdrawMoney(Atm atm, decimal amount)
{
if (!atm.CanDispenseMoney(amount))
... |
I intent to release my code under the GPLv3 license. No problem to do this, until I came upon a 3rd party file. Their owners have the following statement in it (and no other statement regarding copyrights/licensing)
Copyright (c) B.J. Frey & D. Dueck (2006). This software may be
freely used and distributed for non-comm... |
In for example web-frontend development, there are two main ways to structure a project:
client
-js
-component_1.js
-component_2.js
-html
-component_1.html
-component_2.html
-css
-component_1.css
-component_2.css
vs.
client
-component_1
-component_1.js
-component_1.html
-component_1.css
-compo... |
Most domain driven design examples are for explicit domains - Accounting interface, Airline booking systems, and such.
Sometimes, your domain is much more abstract than that.
In my case, the application is built around a specific domain, but a very important aspect of the application is the ability to pivot to other, v... |
Problem
So I'm making a video game and I'm facing a design problem. I would like to pass the reference of a class being constructed to a constructor of another object and pass this other new object to the super constructor of the first class.
Basically something like this:
class B extends A {
B() {
super(ne... |
Do any lifecycle models exist that are iterative without incremental? Is this even possible?
|
I'm trying to learn the N-Layer architecture and several other things, and I have a C# solution where I have the following layers:
Core/Infrastructure (Folder)
Core (Project)
Service interfaces
Domain models
Repository interfaces
Business Logic Layer (Folder)
Services (Project)
Different ser... |
It seems to me that Java was the computing language that could be used anywhere and JavaScript was the scripting language for the web and things stayed that way for a long while.
There are countless articles about how Java is not JavaScript and vice-versa but they are often quite old.
JavaScript has started to move tow... |
I am learning about c# and I am a little confused about (non-automatic)properties and the local variable that the property uses.
When I use properties, I put an underscore for all the private variables that is used by properties. This helps me differentiate between regular private variables and private variables used b... |
Long story short, I've inherited a Java piece of code made of methods like this one:
@Override
public Action decide() {
if (equalz(in.a, "LOC")) {//10
if(( //20
equalz(tmp.b, "BA")
&& notEquals(in.c,"U")
&& equalz(in.d,"Y")
)||(
eq... |
I have a legacy application that works with DirectShow filters installed in the system, these are essentially treated as COM components and not directly linked or distributed with the application. If these components are pre-installed in the system, then I can use them, if not then this particular function of the appli... |
I'm referring to some architectural styles here and under Object Oriented architectural style there are couple of invariants mentioned.
Objects are responsible for preserving the integrity (e.g.,some invariant) of the data representation
The data representation is hidden from other objects
But no clear explanation pr... |
By this I mean something like Student, which is modeling a Student table row:
class Student
{
public string lastname;
public string firstname;
}
It doesn't make sense to me to program to an Interface or even inherit from a "regular" class. I really don't see where I have to worry about coupling here, if I am ... |
I am currently working at a company that has a small(2) development team for our ASP.NET WebForms project. This was something we picked up from a previous team. The current team is made up of recent university graduates with little to no experience in source control. We have all read the gitflow page and understand it,... |
In MVC (I'm using Spring, although it's not relevant to the discussion) I have a following model:
public class User {
private Long userId;
private String username;
private String password;
private String passwordRepeat;
private String email;
private boolean rememberLogin;
/// ctors, setters ... |
Let's play everyone's favorite game, find the Aggregrate Root. Let's use the canonical Customer/Order/OrderLines/Product problem domain. Traditionally, Customer, order, and product are the AR's with OrderLines being entities under the Order. The logic behind this is that you need to identify customers, orders, and p... |
It seems there are lots of resources on how to Mock third-party code when that code is simple. A JSONRequest, etc. but when using a third-party library which requires the configuration of a relatively complex object graph – three or more classes for example – resources appear to dry up.
For example, say you been given ... |
My application does a lot of database inserts, so disk I/O is a big part of the workload. QA does almost all testing on VM's. I'm concerned that tests intended to detect performance regressions won't give valid repeatable results in a VM environment, since other activity on the physical machine will affect the applicat... |
In three popular platforms I'm familar with(.NET, java, python) strings are immutable but lists are by default mutable.
In all languages there is some functional support(linq, streams, list comprehensions) so it is easy to transform/filter a list to a different list.
Strings and lists are quite similar in that both ar... |
One company (who I will refer to as Company NNN from here forth), has a REST API. At my company, we use Company NNN's REST API to provide some content to our end users.
If I send the request with the User-Agent header field filled in, the REST API returns valid JSON data. If I send the request without the User-Agent he... |
I've been doing Swift development for a while now with Firebase, and I find myself making a lot of code like this:
Auth.auth().signIn(with: credential) { (user, error) in
if let error = error {
print("an error occurred while signing in!! \(error)")
return
}
print("user is signed in with fac... |
I'm attempting to build a web front-end based on the MVC pattern, as opposed to based on the libraries involved (e.g. React.js).
I'm using constructor-based dependency injection and interfaces to de-couple the implementations of each element (of MVC), but this still leaves a circular dependency.
Controller depends on ... |
I am currently planning a new project. It is a card game. Users can collect cards a play against others. I started thinking about how an architecture could look.
I am a .NET fan and will use C# as my language. I also want to use Azure as my backend.
I am curious, how you would split client and backend stuff?
Would y... |
I have a requirement where I need to validate excel file before importing into application. Excel file will have around 15-20 defined columns. And we are having around 200-250 rules to validate the excel file.
Right now, one windows service is there, which is scanning the directories to process this excel files. window... |
Backstory:
I have been working as part of this team for the past three years and in this time we have had three different Scrum Master who have all run things differently.
Because of this change in Scrum Masters and their way of running the show, it has left my team numb to the idea of Scrum because the principles have... |
I am little bit confused about whether I can put all below functions to one class or if I should split into more classes.
I think GetCustomerByID and AddCustomerData got different responsibilites but on the other hand I think it's the same responsibility. Please help me by clearing the concept what is SRP in following ... |
In a project, I have a task scheduling service, which is allowed to execute certain public methods from other services. Each service decides itself, which methods it want to make available for the task scheduling service by annotating them with @Operation. The task scheduling service simply will scan all given services... |
My manager give me the task to implement new ISO procedures of analysis and design (later it will be of the entire software development cycle) because in the team we don't have any kind of methodology to develop the requested software which tend to be a "developer do what they want thing".
My manager wants to implemen... |
Summary
We're a medium sized company that has a development team of five team members. We recently started learning/employing the Scrum method to our R&D department.
Our core team has one project, while each employee has individual task and projects. Some of those individual projects are only big enough for a single de... |
To hone my skills - and for the pleasure of it - I am writing a small game for my kids in modern C++ (C++11, C++14 and the part of C++17 already supported by Visual Studio), which is a nice break from my usual (enterprise) programming tasks.
I need a small interpreter for user input and of course I must handle erroneo... |
I'm struggling with finding the best branching model for my team and would like advice on what branching models will work best.
We have 2 enviroments - Test & Production.
I recently started to work with "nvie gitflow" with my team, without the release branches - so we have a develop branch that is the Test enviroment, ... |
We're using (and loving) the jest test framework. Most of our tests are nice compartmentalized good-code-hygiene style unit tests.
However we've also written some service level tests (setting up servers and issuing requests) and also some longer running deployment tests for testing the automation around deploying our s... |
TL;DR: How should I structure my C++ project to allow for starting, stopping, and pausing my program?
Overview:
I am designing an application that needs to allow users to start, pause, and stop the running of a test. The test functionality itself will be fairly straightforward, but the architecture around it has been a... |
I have to create a service which expose an API (REST). It will use MongoDB as a database and structs as data model. The problem is I really can't find a nice solution for making the basic CRUD non repeatable. For example:
I have 3 struct (ModelA, ModelB, ModelC) Each serves as a model for a db document. I have to expos... |
Most, if not all IT people I know believe that it is beneficial to model software with UML or other types of diagrams before coding. (My question is not about UML specifically, it could be any graphical or textual description of the software design.)
I am not so sure about it. The main reason is: Code doesn't lie. It i... |
In my past experience, the way we enabled blue/green style deployments was to provision some servers for the new release that were copies of that app's production environment servers, deploy the new app version to them, test, then switch over the traffic routing to point to the new servers. When I suggested this in my ... |
Sometimes I just need .h but not .cpp file, eg : interface class or enum class, and when the class list is displayed on file list of IDE (eg:Xcode):
Animal.cpp
Animal.h
Cat.cpp
Cat.h
Dog.cpp
Dog.h
IEnumerable.h
Lizard.cpp
Lizard.h
MyEnum.h
Penguin.cpp
Penguin.h
I felt uncomfortable to see this file list because IEnume... |
Hi I'm working with an API Where an employee can see his Vacation (overview and balance) and Request new Vacation. A manager can Approve or Reject a Request for Vacation. He can also create Vacation on behalf of an employee.
I'm in doubt what would be the best design. Most understandable for a developer (say mobile dev... |
When writing java tests for an application, be they unit tests or testing a broader scope, the java community tends to model fixtures in terms of object factories that produce fixtures of a defined state.
eg:
public class TestFixtureGeneratorA{
static public A modelAState1(){
A a = new A();
a.setFoo... |
Why is LLVM's intermediate representation (LLVM IR) assembly-like rather than tree-like?
Alternatively, why do language implementations target LLVM IR rather than clang's AST?
I'm not trying to ask two different questions at once if it seems that way. To me, it simply seems like both client and library programmers have... |
So I'm having trouble understanding the relationship between threads (software) and processor cores (hardware).
Basically my understanding of a processor core is a unit that deals with commands and is essentially what executes them. A processor with 2 cores operating at 1 kHz can execute 2000 commands per second, right... |
I made a test today, how good WinRAR can compress a folder with several times the same picture in it. For that I just put one picture with 300 kB into a folder and copied it there 11 times, so that I had 12 times the same picture, only with different names. I expacted WinRAR to realise this fact and to get a compressed... |
If got a scenario with accounts in any currency.
The account got multiple lines/items for each transaction which adds or removes an amount of the account. Basically similar to a bank account. The requirement is that a user should be able to see the total amount of account.
My scenario includes multiple clients (eventua... |
I inherited a large code base (iOS / Objective-C) that is used to build multiple mobile apps. The apps have similar, but not identical UI.
The apps share a lot of common features, but there are features only found in one app. Some features can be later added to other apps.
Apps have relatively independent life cycle. ... |
I have a situation where I support what is functionally the same library in multiple languages. There are often constants that need to be shared between these (for example, json field name keys or error codes).
The way I currently do this is by having code defining the constants in each language.
The problem comes in ... |
http://librdf.org/rasqal/docs/api/rasqal-section-query-results.html describes an API for enumerating rows (consisting of several values) of data.
In this API there is retrieval of values from the current row and "jumping" to the next row.
In my opinion, this is a misdesign. It violates the rule of single responsibility... |
So, it might be a very fundamental question, but I'm pretty confusing right now...
It's all about Element and ElementCategory: an element belongs to a category, a categoty can have many elements - a straightforward one to many relationship.
At the database level, I have two tables:
Element(element_id, category_id, ele... |
We got 30 or so enterprise applications, some interacting with each other. And I'd like to create a diagram to see the big picture.
Which diagram should I use? System context diagram?
|
I have created a blog for a friend.
I have heavily designed it around jQuery's $.ajax() function and as a result it is only a single webpage asynchronously gets its data (title, article, relative image paths, etc.) from the database.
To navigate, a visitor can do the following:
Type on a given search <input>, site w... |
For example, assume my app has 3 steps with 3 pages:
Step 1 : MainActivity: choose color
Step 2 : EditTextActivity: input text
Step 3 : GreenActivity: display color and input text
In EditTextActivity, which activity to go after Next pressed depends on previous MainActivity, so I write a switch case to do that:
Ma... |
Is it a property of Huffman code to always be translated in one way? Or there are examples where a single piece of binary code can be interpreted in two different ways?
For instance: let code (1001010) be sent to a computer.
Is it possible that the computer recognizes the code in different ways?
Eg (100,1010) or (100... |
Aesthetically and mathematically a map(f, X) function seems great: in just two arguments it tells what is going to happen: we are going to use function f to transform each element from X to create a new array Y.
However I do not know what is happening under the bonnet of either for or map; and my reasons for liking map... |
We're building a web application for company, which administration existed only in Excel sheets so far. We're almost done by now, but recently I was assigned a task to import all their data from those sheets to our new system. The system is built in Java, but as this import is just one-time thing I decided to write the... |
Say I have a class like this:
public abstract class Product
{
public Guid id {get; set;}
public string description {get; set;}
}
This class is populated from the database. I am writing a unit test to decide if two products are the same. How do I establish if two entities are equal:
1) Guid o... |
I've been watching an presentation from Jonathan Blow on Software Quality. He as a point that adding more and more layers of abstraction gives you not only more difficulty to manage your code, but also we are using too much resources and the software is slow.
On this he also shows an giant call stack of some tomcat ser... |
I asked a question on here earlier and Laiv shared the following link.
In the article; it is stated that Eric Evans avoids .equals methods on Entities.
In this question; the accepted answerer talks about using Custom Assertions for Unit Testing rather than .equals
Therefore I am looking at custom assertions. I have c... |
I'm exploring Cargo DDD sample.
There is BookingService which belongs to application layer.
But looking at the code, it seems that all methods correspondent to Domain Logic (bookNewCargo, assignCargoToRoute, etc).
Why is it in Application Layer then?
What is the difference between application and domain services?
So c... |
This is a design/planning question, not specific to any particular software/deployment. The stuff I'm talking about doesn't exist yet, but I am hoping to avoid mistakes early in the process.
Here's the situation that I'd like advice on:
We have 7 business "verticals" (e.g. Sales, marketing, etc) with each vertical sep... |
I see this sometimes:
class SomeClass {
Object param1, param2, param3, param4;
private SomeClass(){}
static class Builder {
SomeClass someClassInstance = new SomeClass();
// standard builder code
}
}
VS this:
class SomeClass {
Object param1, param2, param3, param4;
private SomeClass(){} ... |
I am convinced that software development is essentially a creative process. I also believe that this is the case for all levels, from architecture to coding.
What makes me think so? To put it very briefly, because a software developer is supposed to create something new, not just copy existing stuff. It is more than ju... |
I'm designing a MVC app and I'm having a hard time figuring how to build my models. For example, I have in my database, Managers, that have a role, are linked to an institution, a program and courses.
I'll have a View for Managers, with their profile information, contact info and the like. I'll also want to link them ... |
Something that bugs me with sprint planning, is where training fits in. Let's say you have a requirement to learn JQuery for a small web application. There would seem to be a number of possible approaches - each with their own potential pitfalls.
Specific task
A task is added to the sprint to learn the technology. The ... |
As the title says what is the difference between watchdog timer and heartbeat signal ? When to use each of them.
|
I hope I've chosen the right community for that (there's no software architecture / design one)!
I'd like to ask you about practical considerations of RESTful APIs (and similar design patterns as for that matter) in context of complex server-side operations / business logic.
Few things to keep in mind:
I know REST is ... |
Our microservices are going to be deployed on AWS, using Pipelines.
A step on this pipeline will execute integration tests using a dedicated database on AWS, a MySQL instance.
My question is: since I want to execute integration tests also locally, while developing, should I need to replicate exactly what's happening on... |
I am trying to build a movie ticketing system. But I am not able to figure out how to solve the below use case:
Let’s say there are 10 seats namely S1,S2,S3,S4… S10.
Now let’s say that User1 had logged into the system and selected seats S1 and S2.
Both these seats must be automatically blocked for a time span of 15mi... |
I sometimes find experienced programmers who will actively avoid using spaces in their filenames, opting to use underscores or camelCase instead.
(i.e. /org map/attach jobs.cpp vs /org_map/attach_jobs.cpp vs /orgMap/attachJobs.cpp)
From what I understand, this was originally done on older systems which had more strict ... |
In a generic sense, my question goes something like this:
if (p) {
if (q) {
a();
} else {
b();
}
} else {
if (q) {
c();
} else {
d();
}
}
There are four outcomes a(), b(), c(), and d() depending on the conditions p and q. Even though p and q will only be evaluate... |
I'm currently writing a SAML Identity provider(Idp) to enable SSO and one of the easy ways to go about it is to use Shibboleth Identity Provider which is a ready deployable web application on it's own.
We also have an in-house authentication system that authenticates users via login screen and also has certain OAuth se... |
This is a bit experimentation from my part because I had written a lot of procedural code back in my school days hence I have trouble in thinking in OOP way i.e. to find proper classes and relationship between them. I know I cannot do this every time but I need to create some kind of correlation which may help me under... |
From my understanding, the form and all of its graphical controls run on the main thread. The form is displayed by the main thread and the inputs from the keyboard and mouse are received via the message pump and are executed on that same main thread. I also believe that the code you write also runs on that same thread,... |
I read in a data science book that there is the concept of a code permanence spectrum. If your code is low on the permanence spectrum the code is ad-hoc/throw away work. I work mostly as a scientist where the code is my tool for doing analysis. However, I've noticed from studying some of my colleague's code that there ... |
While direct Language-Assembly compilers generate the code required to perform specific task for the given platform, how do interpreters do it?
Abstract example
The following pseudo-code...
printf("Hello World");
...would compile to this assembly language code.
org 100h
mov dx,msg
mov ah,9
int 21h
mov ah,4Ch
int 21h
m... |
I'm developing a webapp with users and roles, and I need to keep track of any changes that are made, so that I know when and who has changed a user role.
I have my user table:
CREATE TABLE user(
user_id,
name
);
And my user_role table (one user can have many roles):
CREATE TABLE user_role(
u... |
I'm a long-time Java programmer familiar with the Java Memory Model. I'm starting to learn C#, and based on what I've learned so far, the C# memory model seems to be very similar to the JMM. This validates my previous understanding that the JMM reflects the characteristics of architectures supported by the JVM. The l... |
Implementing operator overloading for e.g. + (plus) isn't terribly difficult if you know it's a binary operator. One can just parse expression + expression
But what if the programmer can choose whether + is binary, unary (prefix/postfix), part of a ternary, or something else? E.g.
.. ? .. : ..
..²
.. | .. | .. | .. |... |
What is the correct way to apply commands to objects deep within the model hierarchy?
Given the following model:
public class Picture : AggregateRoot
{
private string title;
private List<Shape> shapes;
}
public class Shape
{
private ShapeType Type;
private Color color;
}
We can define a CreatePicture ... |
At work, we are discussing about two system models:
First one with a centralized server:
Second one without a centralized server:
The goal of the system is to allow clients access information, by browser, served by some remote raspberry-pis that will be connected with different kinds of sensors.
As the pictures show,... |
In Think Python the author introduces defaultdict. The following is an excerpt from the book regarding defaultdict:
If you are making a dictionary of lists, you can often write simpler
code using defaultdict. In my solution to Exercise 12-2, which you can
get from http://thinkpython2.com/code/anagram_sets.py, I ma... |
RDBMS design often emphasizes data normalization (especially 3 NF) for the sake of efficient transaction processing (OLTP). OLTP is the predominant use case for an RDBMS.
Goals of Normalization in RDBMS:
Free the database from modification anomalies
Minimize re-design when extending
Avoid bias toward any particular ac... |
If I have microservice architecture and one or more microservices have layered architecture that contain service layer, how can I avoid naming confusion between microservices and structural units of an application called services?
|
Imagine you have a Vehicle entity in your domain model. Vehicle entity has Reserve method that put vehicle in "reserved" state and do another stuff. But Reserve method have to do some checking first to ensure that reservation could be done. This checking is done by legacy stored procedure that have to be called as a pa... |
Please see the article here: http://enterprisecraftsmanship.com/2017/02/16/on-automappers/
The writer advises against using Automapper to map DTOs to domain objects as it can cause problems with validation. Why is this? My domain models have a function called Validate(), which is called by the Service Layer i.e. it ha... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.