instruction stringlengths 34 36.1k |
|---|
After reading a lot about semantic versioning I got a basic understanding of the concept but I'm not sure what's the best way to increment the version number in the following case:
Let's pretend that the last release was version 1.0.0. Now, I've a bunch of pull requests. Some of them are fixing bugs, others add new fea... |
I'm implementing an algorithm that needs to
Sort elements, in parallel (this will be done on a GPU, but that doesn't matter much)
Compute a comparison metric for every pair of elements. This comparison metric is the identical to the one used in a sorting.
My initial plan was to use bitonic sort for step 1 but I don't... |
I was going through a fantastic talk by Alex and nearly all the things he spoke made sense to me except for the given thing.
Link
In a nutshell how does module manage versions. If I have a module v1 with a method with different implementation, a separate module v2 with a same method signature and return but a different... |
I am developing software in Window 10 and Visual Studio in C++. I would like to restrict the use of the software to a set of computers, by implementing a license control.
My thought is to query a few key parameters from the system such CPU Type, Harddrive Serial Number, MAC address, and create a hash. I would then t... |
IOC principle can be implemented, using either:
Dependency Injection
Service locator pattern
This article also supports these two approaches for implementing IOC principle.
Spring IOC container is named after IOC principle that supports IOC implementation using Dependency injection, where implementations(<bean/>) ca... |
I have started a new job as a software engineer one month ago working on a web, saas oriented piece of software.
I like it, but I have spotted an area where I need to increase my skills, which is visualising new features of software in my head, fast.
Let me explain the context: we are a small team of 6 developers, we w... |
When the load of the hash table grows too large in proportion to the hash table size, you increase the size of the hash table to improve performance. When the load is too large is dependant on a predetermined value, the load factor.
How do you refer to the term that decides when to decrease the size of the hash table w... |
I am making a website for a competition my school is taking part in, however I am not on the team and am not receiving any compensation (save for better references :P). The only condition I have set is that I receive full credit and attributions.
All of my Javascript files have MIT licenses at the top, as they were wri... |
I want to be able to call on a list of files that are being processed by the server. The problem is, I want to call them on a web app (think React) whenever a user does something. i.e. a list of all possible choices and possible regex to narrow the list down.
How do you think I should store these names? I don't want to... |
I am new to adopting a completely TDD approach using DI so that I can mock every dependency. One of the pain points that I identified so far is the fact that whenever I do work in my constructor every test has to prepare for that sequence (expect the corresponding mock calls). An example for such a sequence might be cr... |
I'm just starting to look at understanding the graph data structure and the breadth first search and depth first search algorithms. For a package manager like npm, where one package might have dependencies and those dependencies might have more dependencies, if you wanted to check whether you had those dependencies al... |
Does this make sense or what is wrong with this approach?
So instead of using event store, we may use aggregate repository to update the aggregate based on values contained in published event.
|
What is the exact definition of a memory address space?
Is it correct to name the set of all the numbers from 0 to the highest addressable byte the definition of an address space?
EDIT:
I would like to know if there is a formal definition of an address space the same way as there is a mathematical formal definition for... |
In the React docs, the constructor functions of class components contain lines where this is explicitly bound for event handlers e.g. in the docs for handling events
class Toggle extends React.Component {
constructor(props) {
super(props);
this.state = {isToggleOn: true};
// This binding is necessary to ... |
I'm currently developing some Standard Operation Procedures for the company I work for. I'm starting with the very small examples; like scripts. There are currently several scripts being written in different languages. The idea is to stick with the best practices of each language for when developing a tool. The real pr... |
Suppose that the server restricts a JSON field to an enumerated set of values.
e.g. a POST request to /user expects an object with a field called gender that should only be "male", "female" or "n/a".
Should a wrapper library make sure that the field is set correctly before making the request?
|
This piece of code is in many of my methods, in a certain area of the codebase. It's not violating DRY since its a bit different for every method. But it still bothers me that 5-8 lines of code like this is in every method.
So I want to hide it away :) The question is how.
//e.g /configurators/configjohn/defaultfronte... |
I've recently been reading about Object Calisthenics and I'm stuck on Rule 9.
My typical approach to code (I'm a C# .NET developer) is to model data as POCO classes which only exist to represent data schemas. Inevitably this means a set of properties exposed with getters and setters. These classes implement few, or mo... |
Given that we cannot build on every commit, we end up building from multiple commits. Typically this is about 30 commits to a build.
Eventually, we break the build. How does one go about identifying and fixing code changes that introduce regressions? Are there any practices to tracking down the bad commit?
|
A number of tutorials on polymorphism state that "Any object that can pass more than one IS-A test is considered to be polymorphic." I wonder what they mean by that, and if that's even a true statement.
From my understanding, (subtype) polymorphism is when you have the interface of the base class and the implementation... |
I've been working on a 24-bit virtual machine to help me learn more about computers and programming in general and was hoping to find a bit more information on memory mapped input/output and hardware interrupts.
At the moment I have most of the opcodes implemented and about have of them implementated in an assembler. A... |
I need to modify the data members of a class, but since there are a lot of use cases, I would like to put the modifier methods in separate classes to not make the main class too large.
So I'm thinking of making the data members protected, and using derived classes as interfaces to modify the data members for each diffe... |
I've been looking around hoping to get some perspective of the pros and cons of using a Single Page React App vs. a Multi Page React App. The end product of the project is a page with 5 tabs, each having a form within it, with some of them having form dialogs.
We're using React on Rails. My initial thought was to allo... |
I was discussing a project structure of mine with a friend and he pointed out an interesting point about how my architecture seems to introduce complexity and over abstraction into my layers by having "clones" of existing models.
My project structure, overall, is such:
[UIL] ---- Consumption / U.I. Layer (Just for the ... |
When writing tests, why would someone want to use an in-memory database over just mocking the data?
I could see that in-memory databases could be beneficial for testing out one's repositories. But if utilizing a framework (such as Spring Data), testing the repositories would be testing the framework and not really the... |
So I am working on an existing website project that has a BLL layer with some functions that use physical file paths.
But now I am creating a console app that will be setup as a windows scheduled task that will call some of these functions and it is complaining about not having the existing files.
Sounds to me like th... |
I am part of a development team producing a project which requires many rounds of iterative development, each of which must be user tested, frequently in an A/B kind of environment.
In our deployment environment it's not straightforward for us to deploy side by side versions at the moment so I was interested if anyone ... |
Let's say I start developing a role game with characters that attack other characters and that kind of stuff.
Applying TDD, I make some test cases to test the logic inside Character.receiveAttack(Int) method. Something like this:
@Test
fun healthIsReducedWhenCharacterIsAttacked() {
val c = Character(100) //arg is ... |
According to following article Named Constructors The Author suggests using static factory pattern to construct objects is way better than instantinate with new keyword. At the begining the idea is appealing(according to some details in article) yes method names are more obvious and it gives a sense that the constructi... |
Is that okay to share the business logic between a web application and scheduled tasks.
Or should the business logic of the scheduled tasks be separated.
Currently some of the methods of the business logic layer are used only by the scheduled tasks. This seems a little dirty to me taking in consideration the SoC princi... |
I'm evaluating the Kafka. It provides some nice features which I want to use, especially durability be default and the access to past messages for new consumers, whenever the consumer wants to reach something from the past.
I split the communication into three types:
app to server - where I want to use simple messagin... |
Is there a difference between defining a variable in C and assigning a value to a variable in C?
I know that declaring a variable simply means telling the name and its type like int a.
On the other hand defining a variable means telling the compiler its value.
So in my understanding there are the following associations... |
I currently have the following set up where I have 2 or 3 classes implementing IZoneController and I have a set of conditions determining which function they need to execute when called. I first started out defining about 20 classes for each different function, but they were really sparse, and I thought I might be able... |
I have a simple VS project which references DLLs which must be specific to a version of the software I am integrating with and I need to release my project for multiple versions of the software - 2015 & 2016.
So I need to build MyProject2015.DLL and MyProject2016.DLL - let's pretend each must reference Application2015... |
I'm planning on writing a C++ program which is heavily influenced by plugin modules. Initially I had only thought of making the APi available as an abstract class that others extend. After talking to someone they mentioned that I should think about making it available in a language agnostic way.
How do I effectively ex... |
Given that one needs to deal with case sensitive environment, when would one benefit from having all caps or all non-caps names of variables or similar identifiers, as opposed to have camel case? Limit being number of characters being enforced - max 6!
Normally one would not care about the case (machines would sort it... |
I noticed that if I declare a global variable multiple times the compiler does not even output a warning.
However if I declare a local variable in a function multiple times, for example, the gcc compiler outputs an error and does not compile the file. (I ask in terms of gcc, but this is more a general language design q... |
I am trying to learn C++11/14 new features and I am playing with tuple and variadic. I wonder if it is possible to use tuples to return multiple values that are not fixed at compile time.
Something like (not working code):
template <typename... Ts>
std::tuple<Ts...> get(bool f) {
if(f)
return std::make_tup... |
I have the following code in PHP:
abstract class AlgorithmOnArray {
public function runOn($array) {
$this->setup();
foreach ($array as $item) {
$this->processItem();
}
$this->cleanup();
}
public abstract function processItem();
public function cleanup() { ... |
In order to ask this question I need to define a couple of terms to ensure everyone reading it is on the same page:
Unit testing is the testing of a single class with all dependencies mocked / stubbed in some sort of way.
Integration testing, in this context, means integration of a selection of objects within a system... |
A side project I'm working on with some friends currently deals with an API interface that, for many reasons, is slow and cannot be changed to improve speed. I'm talking API responses that take anywhere from 5 seconds to 25 seconds. It's old software, but we have to integrate with it, period. After that API response co... |
I am bit puzzled as for why this does not throw an exception - I believe the CLR does not delete the object because there is a reference to it?
static void Main(string[] args)
{
List<A> listOfA = new List<A>();
A a = new A();
listOfA.Add(a);
((IDisposable)a).Di... |
Many projects need more than a Dockerfile or a docker-compose.yml in their root to work out of the box (e.g. for local development or a demo): For example a web application might need its runtime, a web server and a database, each one configured for the application. Are there already "best practices" or at least common... |
I work in a team of 8 people and today it receives demands from several stakeholders, some development demands, others operational. When there is development, it is usually done by one person of the team only, and in several situations this model is harmful, for example, when there is exchange in team members.
I've be... |
I'm working on an application where I need to save basically :
CreatedBy (FK to the person table)
CreatedDateTime
UpdatedBy (FK to the person table)
UpdatedDateTime
Right now I have these fields in all the tables in my database.
But I feel like there should be a better way to do this.
|
I have 3 Lambda functions that do very similar things: scrape data from different sections of a website.
Each function returns a collection of objects that have similar properties. The method of fetching of the pages is all the same throughout all 3 functions, only difference is the HTML elements that are being scraped... |
This video mentions the following:
What does it mean for the DMA controller to be granted the data bus control, does that mean the CPU cannot use the bus to access memory and IO devices until the DMA controller re-grants the data bus control to the CPU?
|
I was recently watching a great Computerphile video on passwords in which Mike Pound brags of his company's supercomputer having 4 graphics cards (Titan X's, to be exact).
As a numerical simulation enthusiast, I dream of building a desktop solely for simulation work. Why does Mike Pound measure his computer's computati... |
I am an amateur developper and would like to share some of my code via GitHub or GitLabs.
The problem I am trying to resolve is that I have a configuration file with my real credentials (used during development) and would like to provide a generic one (with placehholders for the credentials) -- all this without changin... |
I'm communicating with a device that's connected to the computer via com port.
The device accepts certain predefined commands in order to interact with it.
I'm essentially creating a more abstract API on top of the one provided by the device.
I encapsulated the charactersistics of the Commands I use, so that I can just... |
Encapsulation tells me to make all or almost all fields private and expose these by getters/setters. But now libraries such as Lombok appear which allow us to expose all private fields by one short annotation @Data. It will create getters, setters and setting constructors for all private fields.
Could somebody explain... |
i am working on a SaaS project that provides some services that people can call via API. My problem is how do I build the billing algorithm. I want to charge on every call to the service.
Now I'm looking for ways to make the call faster and I fear adding a billing algorithm to would make it slower. Because the billing... |
Relatively new git user here, so just trying to figure out the best way to keep my project as 4.0 and 4.5.2 framework variants in parallel. Maybe this shouldn't even be done within git? Just create a completely new/separate project that uses the 4.5.2 framework as the target and start a brand new repository?
Thoughts? ... |
This is a simple question, but one I've never seen a definitive answer for:
In the majority of the world that has postal codes, is it safe to assume that given a postal code, there is only one time zone associated with that postal code?
Or alternately, even if it it's not safe in principle, has there ever been an act... |
I'm making a blackjack game, and I want to take my cards images and give each a value for the game.
I'm not sure how to determine their value. Should I just do a big switch statement with all the images names?
Or maybe should I check for contains with a big if statement? Like if the image name contains "king", then the... |
I'm trying to solve the following problem in the most efficient way I can find.
I want to trade my items for someone elses items, every item have a price and a value.
I want to maximize the value of the items I trade, so for example:
My items:
Banana, P: 10, V: 5
Pen, P:3, V:1
Paper, P: 1, V: 1
Their Items:
Phon... |
Suppose I have the following class:
public class Course {
// data
public string Name { get; }
public List<Student> Students {get;}
//...
// logic
public int AverageGrade() {/* do something*/}
public bool ReachedMaxStudents(){/* do something */}
}
I have some operations that interact with t... |
In the code snippet below, I have a class that holds a vector, and a getter to access it. When I compile my code with optimizations turned on, I would have expected that the call to get_value() would be optimized out, and one accesses directly the data. Instead, the process is slow, and a quick profiling shows that the... |
I have a class
public class CertificadoHandler : ICertHandler
{
Type typeAfirmaValidate;
public CertificadoHandler(){
typeAfirmaValidate = typeof(AfirmaValidateCertificate);
}
//testing
public void SetTypeAfirmaValidate(Type t)
{
typeAfirmaValidate = t;
}
public Crede... |
I am thinking how to implement the login of a new web application and as I search the net, most search result as about authentication instead of encryption.
Assumption: The web application is designed for corporate purpose. The web application are going to use REST api to communicate with backend.
The first two search ... |
I have started working on a new project and to my surprise its written by a single developer with almost no tests at all, the remaining tests are either buggy or feel error prone throwing a lot of NullPointerException when anything is changed. To my surprise a release was scheduled just after I started so I hardly had ... |
Why do we need to write same methods in Service Interface, when we just want a replica of DAO Interface.
interface DAOI
{
method1();
method2();
}
interface ServiceI extends DAOI
{
}
instead of below
interface ServiceI
{
method1();
method2();
}
|
There are situations where we can store values in local variables and work with them. For example:
String data;
int a, b;
data = Integer.toHexString(memory.read(PC));
a = ("00" + data).substring(data.length());
data = Integer.toHexString(memory.read(PC + 1));
b = ("00" + data).substring(data.length());
Or we can jus... |
I am starting to get into versions/releases more now with Git and wanted to know if the structure I am doing now is correct.
Right now, there is typically a few feature branches. A few commits from those then get merged into the develop branch for review.
After that I merge them into the master and the package.json ve... |
I have an issue with structuring som data.
The idea is to have some sort of menu card, where you can build your own menu. The different products are categorized into groups, and in some of the groups you can choose between eg. three different predefined 'submenus' - so you would have nested menus.
As it is now, they ... |
I'm currectly reading the book JavaScript: The Good Parts by Douglas Crockford.
The opening of the Chapter 3 Objects immediately confuses me with a (possible) contradiction. I re-read the two paragraphs at least a dozen of times and am still not sure which part is correct, and which is wrong.
I will definitely try thin... |
I have a program that produces a command line tool called GetFood. The source code lives in a directory named GetFood/, and I have a main file that interacts with a class that gets the food. It seems to make the most sense to name the class "GetFood" since it provides all the functionality of actually getting the food,... |
The release method I am talking about is this:
Release code that works with both old and new clients (forwards and backwards compatible)
Release client that only works with the new code released in step 1
Release code that removes the backwards compatibility that was supported in step 1
Example:
Add new stored proce... |
Long story short
What is the best way to design a shared CD for multiple Git repositories (frontend and backend)?
I'm struggling to find the best design for our CD.
The whole picture (The details can be changed)
Frontend - Angular 2 (Javascript), no artifactory.
There will be only a single frontend in the project.
Ba... |
In the Google C++ Style Guide it says:
Preincrement and Predecrement
Use prefix form (++i) of the increment and decrement operators with iterators and other template objects.
When a variable is incremented (++i or i++) or decremented (--i or i--) and the value of the expression is not used, one must decide whether to ... |
I am learning about the PCI bus, and there is something that I am not sure of. A motherboard have some PCI slots to put the PCI cards in:
Now when we say that we have a PCI bus, do we mean that the PCI bus only consists of the devices in the PCI slots, or are there other devices that are not in the PCI slots that are ... |
I'm working on a IT service desk system and I'm trying to figure out how to raise tickets via an email or add comments to existing tickets via email replies. For example something like the JIRA Service desk where customers can open and work on requests from the comfort of their email inboxes.
Currently I have a system ... |
Java author mentions: Threads can simplify the development of complex systems by turning complicated asynchronous code into simpler straight-line code.
Again the book says: Threads make it easier to model how humans work and interact, by turning asynchronous workflows into
mostly sequential ones. They can also turn oth... |
In general, what is the legality of website forking?
I am based in the United Kingdom and intending to host my website on U.S. or Canadian servers.
I am looking at creating a website about automobiles (with original MSRPs and specs) that is a sort of fork of http://www.autos.ca or http://www.parkers.co.uk in terms of d... |
A team simultaneously made several refactorings (to raise system genericity) to the same project with some overlaps (yes, unfortunately, more like "big bang"). Code is spanning representation, application, domain layers and has pretty high code coverage. There are N branches waiting to be merged into the master. Some r... |
I want to make some software which relies heavily on Plugins. I plan on writing it in C++ and will most likely be getting plugins built in C++, Python and possibly Java But most likely C++ and python but since I don't want to rule out any languages that may be slightly more obscure or uncommon. How do I design a plugin... |
If we have an array in Java like this-
int[] arr = new int[10];
Then, it's sorted like this-
Arrays.sort(arr);
Instead of this, if we had a LinkedList-
LinkedList <Integer> ll = new LinkedList();
We'd sort it like this-
Collections.sort(ll);
How can this be explained using design patterns? Why this design and is i... |
According to LSP wiki:
Substitutability is a principle in object-oriented programming stating
that, in a computer program, if S is a subtype of T, then objects of
type T may be replaced with objects of type S (i.e. an object of type
T may be substituted with any object of a subtype S) without altering
any of t... |
I did a lot of reading on popular git workflows including A Successful Git Branching Model, merging, rebasing, and cherry-picking, but I'm still not able to apply all this on how to solve the problem described below. I feel like cherry-picking might help here, but I'm not sure if that's the best idea.
Let's say I have... |
For example a CSV parsing library looks to be the most popular CSV parsing library, yet it only has 301 stars.
C++ is one of the most popular languages yet C++ libraries on github do not look to be very popular?
I realise that some of it is due to C++ being more difficult then many other languages. On the other hand a ... |
I was recently reviewing a few Helper-style "utility bag" static classes floating around some large C# codebases I work with, things basically like the following very condensed snippet:
// Helpers.cs
public static class Helpers
{
public static void DoSomething() {}
public static void DoSomethingElse() {}
}
Th... |
This doc states the following:
If you happen to modify the public API of Angular, API golden files
must be updated using...
Also this commit has the following heading:
fix: public API golden files #16414
I'm wondering what is usually referred to as "golden files". I've googled around and it seems that this phrase... |
Please see the code below, which creates a Session Factory per Unit Of Work:
public int Update(IdentityRoleView role)
{
var role2 = AutoMapper.Mapper.Map<IdentityRole>(role);
ISessionFactory SessionFactory = NHConfiguration.BuildSessionFactory();
using (ISession session = Ses... |
Usually passing data inside a project isn't a big problem as long as everything is written in one language. However things may turn ugly, if parts of the program are written in different languages. For example: A java method suddenly needs to call a method written in python or vice versa. This is of course manageable, ... |
Suppose I have the following requirements:
We organize books by author first name, this might change in the
future.
When ever an Author we carry at our store releases a new book, the
Authors previous works are discounted at the managers discretion(i.e
10% 15%).
Storage is done in an SQLite database with the appropriat... |
I'm wondering why all databases seem to store hashed passwords and typical hexadecimal data as char(x)/varchar(x)
MySQL uses latin1_swedish_ci as default character encoding, where each character is made of 8 bits.
When storing hexadecimal data as strings, you're only using 4 bits of those 8 bits you can use, as there a... |
I'm making a self-stabilizing camera mount for a Digital Systems project using Arduino. I plan to read angular position from a gyrospcope and adjust servos on the mount accordingly to keep it level.
I've found that the gyro I'm using only reads angular velocity. I've only taken Calc 1, which was three semesters ago now... |
I am trying to understand how the Base Address Registers (BARs) in a PCI card work, this is how I think they work:
Each function in a PCI card have 6 BAR fields, and each BAR field is
32-bit in size.
The PCI card manufacturer will write in each BAR field how much
memory it wants the Operating System to allocate, and e... |
Our company buys second hand valuables (item) from clients and resell them for them. In order to do the client comes to our site and ask for a shipment he may choose the time that the delivery man comes to collect the valuable. If he does not choose the time a salesman calls him and arrange the time for him. It is also... |
Im working on a application that uses camera motion detection to determine changes from high to low level of motion and vise versa.
The motion detection algorithm returns a single score value for every frame of the motion at about 10-30fps.
What i need is a way to accuratley determine where these changes changes occur... |
Should messages that will be shown to the client be resolved in the client-side or in the server-side? Any design (dis)advantages that you can think of between the two approaches? If the system maintains sensitive information and different sets of information is maintained by users with different sets of authorities, w... |
This is an example of what I want to do via code. I know you can use jump point search to easily get from the green node to the red node with no problems, or even A*. But how do you calculate this with warps.
In the image, you can see that it only takes 8 moves to get from the green node to the red node when taking th... |
I have a NoSQL DB with parts of my data denormalized and duplicated. For concreteness, let's say I have:
A document set called "people" containing full specifications of people.
A document set called "votes" containing outcomes of voting rounds in a certain organization. Each vote document has an embedded list of peop... |
While studying for Data structures and Algorithms, I noticed that there is a pattern/group in which every question falls into.
Example - Given this, do/find that - Category 1. use these methods/techniques first and then approach it.
Similarly for another set of questions.
Do we have a list of patterns which we can u... |
A while back I wrote this answer to a question on how to avoid having a getter and setter for every mutable variable. At the time, I had only a hard-to-verbalize gut feeling that this is a Bad Idea, but OP was explicitly asking how to do it. I searched here on why this might be a problem, and found this question, whose... |
I am working on a multiplayer collectible card game. Server side is node.js + websocket.io. I am now considering which database to implement.
I got really intrigued by MongoDB, mostly due to the fact that I can exchange JSON between DB and my application and also because I can describe entire game state in one mongodb ... |
As mentioned by Java_author,
When defining which variables form an object's state, we want to consider only the data that object owns....
In many case, ownership and encapsulation go together— the object encapsulates the state it owns and owns the state it encapsulates....
A class usually does not own the objects pass... |
I'm refactoring my desing to use a service layer - however I'm confused about how you would pass arguments, when it's only allowed to update certain fields of the entity. For instance I have some fields which are only allowed to be set at creation (meta data). But every examples I see about service layer takes the enti... |
Pretty straightforward fundamental, albeit naive, question:
Would having 4 states per "bit" rather than 2 mean twice the storage space? In case that isn't clear, I mean as in if every "storage structure", rather than only representing 2 values, (base 2 : 0, 1), could represent 4 values (base 4 : 0, 1, 2, 3).
|
I have made a custom DialogBox that accepts a key in the constructor then sets itself up based on the key.
It functions as a box for adding editing or deleting objects depending on which key is passed in the constructor.
For example, if the ADD key is passed then there are TextBoxes to allow editing of parameters for ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.