instruction stringlengths 34 36.1k |
|---|
We have the requirement to implement some fire and forget long running tasks that fit perfectly into windows services (remote data acquisition and processing, etc) but the requirement is to deploy them into hosts without remote administration rights.
We are thinking on the possibility of hosting these tasks as backgrou... |
A few days ago I found a fun fact, that finding a collision of 256-bit hash using brute-force is physically impossible in solar system.
That made me think, what would happen if we used a good (uniform) 256-bit hash in a hash map. I guess, we could consider, that there are never false key hash matches, so we could get r... |
I'm working on a personal project and I've found myself switching between doing some refactoring for a day or two and then some feature-adding for a few days. I like it, and I noted it was similar to how an instructor I worked with wanted to rework the class website. First, she froze the features and worked on refactor... |
I was having a discussion with a colleague regarding the HTTP method of an API. The purpose of the API which looks like /booking/{bookingId}/receipt is to send the receipt of the booking to the registered email of the customer who completed the booking.
I argue that the method should be GET because the API caller is r... |
This is a simplified example, the actual problem has more reports and data points that are requested. Also, more reports could be added in the future so I would like to have something "smart" and dynamic.
Let's say I have the following methods:
public CustomerInfo GetCustomerInfo(int customerId){/* implementation */ }
... |
I already have this core class structure that can not be changed:
class A {
//some basic fields and methods
}
class B {
//some another basic fields and methods
}
It is core classes and I'm adding some functionality in addition to the existing system.
I need to add some common functionality to this classes. It'... |
Most people as they surf the web would get a warning by their browser if they approach a website with an SSL certificate issued by an unnknown authority, or even known as malicious place.
Now, thousands of developers - over 80% of Java related projects using Maven Central - download software components known to have v... |
I have a system which hits a API on daily basis and collects data. This data is divided into logical groups, with a logical group defined as all data belonging to a particular user. A user has 30 subaccounts and for each account I hit the API and insert data into the database. After each hit, I perform an insert so I h... |
The Situation
I'm developing a JavaFX desktop application that can be described in three parts:
The Data
The GUI
The Process
The GUI is a means of seeing and editing the data and the process is a, well, a process that requires the data to perform its job. Think of the GUI as more of a supplementary piece that allows ... |
How a HTML5 game can be buyable? I mean, if it is HTML, even though you obfuscate the code or apply encryption, the whole html and javascript is already on your browser means you already have the whole code. then how can it be buyable? I don't understand.
I mean even if you make sure that unauthentic person can not pla... |
I need to make some get/post requests to a website that I have credential to log in. I plan to do this with Ruby and Net::Http. As I'm new to this kind of experience, I'm struggling with the fact that the log-in page requests robot verification (check-box kind) - that means I'm not able to automate the log-in phase. Be... |
What is more important? SOLID or KISS?
To be consistent with SOLID I would have to inject Decorator and Footer classes and create interfaces for them.
public class HelloService {
String name;
HelloService(String name){
this.name = name;
}
public String getHello() {
Decorator decorator = new Deco... |
I need to open a game save file, read it, maybe modify it and then save it.
The structure of the save is quite simple: it is an object with some members, some of which are data, while others are other objects, those objects have some members, some of which are data, while others are other objects, you see where this is... |
junior developer here.
I am currently working alone on a web application for a big client of my company. I started last month.
The client wants at least 25% of comments in each of its software projects.
I checked the code of previous applications and here are my observations :
each file begin with a comment block (pac... |
I might be missing something but I do not get why in the commonly described worklow the Build follows the Code phases. I mean, isn't it the other way around? We code, we integrate the changes, build it, test it..
The picture is for example on the site below:
http://www.bmc.com/blogs/continuous-delivery-continuous-deplo... |
There is a common argument about multiple variable initialisation in a one liner, that is :
Consider for example int i, j = 1; which might lead some people to mistakingly believe both variables are being initialized
We could argue that someone should know enough the syntax of his language to not mistaken about that.... |
I recently gave advice to refactor some code along the lines of
class Validator<T> : IValidator
{
public ValidationResult Validate(Validatable thingToValidate)
{
if(typeof(T).Name == nameof(FooThing))
{
ValidateFoo(thingToValidate);
}
if(typeof(T).Name == nameof(BarTh... |
The Problem
I'm looking for a query to help me solve the following:
I have a series of events
Each event has a start and end date.
Many of these events overlap
The answer I'm looking for is the maximum number of events that overlap
Example
Say I have 5 events:
1 Jan -> 9 Jan
7 Jan -> 12 Jan
8 Jan -> 10 Jan
10 Jan ->... |
The c# application I'm working with executes many T-SQL SELECT queries that are stored as strings in a database.
These queries almost all involve selecting data from and joining with several tables from within the database.
Certain combinations should not be permitted, e.g. column 1 from table X should not be returned... |
I've got two applications - one application is essentially a REST service, another app has UI that communicates with REST (uses it facilities).
The idea is that rule engine is a service that can execute rules against the input - input is not neccessary player data but some other (like level specific, or quest specific ... |
I'm in the early stages of building a cryptocurrency tracking app for iOS and looking for a scalable design. My question specifically relates to the element of the app which retrieves data from an API and converts it to objects.
Currently, I have a service layer and a networking layer. The service layer handles a lot a... |
We have a complex app which built by using multiple microservices. At a runtime, one of the microservices emits an event to initialize some maintenance process in another microservices, it's ok. But lately, we were required to initialize a maintenance process at the same service from which this event was being emitted,... |
I asked a question on StackOverflow regarding how to 'best' use the Builder pattern for constructing a Value Object which could be constructed with or without optional parameters.
One answer stated that:
A builder is not part of the domain driven design paradigm because it
cannot be expressed as part of your domain'... |
It's widely agreed that Python's properties are not merely a kludge for working around the past mistake of exposing of publicly exposing data members. But then when is it not Pythonic to use a property instead of a method that doesn't take any arguments?
For example, if we were writing the Python standard library from ... |
I am building a web application that will retrieve results from a remote server and use them to render some charts and maps. The remote server has already been implemented and contains a large amount of APIs, written in Java Spring Framework. The developer that implemented them, has given me access to a set of non-publ... |
I'm building a web extension that will be a wrapper for a public API. There aren't any paid tiers for the API currently, but I'm trying to secure the API key so it doesn't get stolen and used outside of my app. I'd like to avoid having my permissions denied.
I currently have 2 ideas that would allow me to do such a thi... |
I am trying to write a program to help scheduling shifts for the employees of a small business. There are 28 shifts that needs to be assigned to 28 employees (so this means that each person gets a shift per week). Each employee can provide a set of preferred shifts, so my idea was to procede as follows:
1) first assign... |
For example, suppose I have a class like that:
public class ABC{
private Data data;
public ABC(Data data){
this.data=data;
}
public void ab(A a,B b){
//some codes needs to use data,a,b
}
public void bc(B c,B c){
//some codes needs to use data,b,c
}
}
which ABC depe... |
I am a newbie at data structures.
I have read an implementation of a stack using a simple array. The algorithm for this implementation is presented below.
Stack implementation in terms of an array
Before implementing actual operations, first follow the below steps to create an empty stack.
Include all the header files... |
Reading "Code Complete 2" in a Quality of Requirements paragraph I found this:
Are acceptable trade-offs between competing attributes specified — for
example, between robustness and correctness?
(this above is a point of a large checkbox list in order to check the quality of the requirements)
So, I found a lot of d... |
I have a website where I want to have a partial view on the page that contains a Singleton service.
I am trying to do this with Razor Pages, and have tried Partial Views and ViewComponents, but haven't gotten the desired experience, probably because I am not implementing correctly.
Here is what I would like to accompl... |
Let's say I'm building a trivia game where users can create games with exactly 5 questions and 4 options (games, questions & options have their own database tables) for each question and assume I'm using a front-end MVC and a backend API.
I've always had this dilemma as to how the API should be designed.
Should I:
ha... |
I was asked by a public organization to give an informal workshop about the 101 of agile development explaining terms and concepts of Scrum, Kanban, and the like. I have worked in agile environments for about five years now, but I don't think of me as a Scrum evangelist.
After the workshop they liked the idea. However,... |
My team and I are currently maintaining a caching system that is purely based on keys.
From what I've read we are striving for a system that's based on the cache-aside strategy. Where we have a website that talks to a rest service using httpclients. These clients make use of a memory cache which works based on a combin... |
We are planning to create REST API which has main objects as User and Article.
Article object has following fields
Title - one line
Description - it can expand to few paragraphs
Image - one or more images about article
List of categories - categories of article ( starting with one but in future can be more)
List of... |
Hopefully the title is not painfully obscure, but as it indicates, I'm really looking for advice on my architecture proposal, as the current architecture is subject to concurrency issues, performance issues and dictated by third party software.
The platform is essentially a naïve Micro-Service pattern followed by being... |
Summary:
Is the usage of the word "Friday" to refer to released/old software or requirements something widely used and if so: is there a definition and/or reasoning behind this terminology?
Longer version:
At my current workplace, some formal requirements are written in the form 'High-level description of some function... |
I have implemented clean architecture for my app, and I have a few questions.
Typically, pure DI is argued for over a Service Locator pattern, because it is very explicit and more testable.
However, I like the idea of having an object that contains all of my services or all of my repositories, and I can just inject tha... |
I have few state machines which run "concurrently" in a super loop.
do
{
state_one();
state_two();
state_three();
/* The point I want to deal with the error */
} while(1);
Each of these state machines might consist of other state machines.
I'm trying to figure out a way that I'll be able to catch an unexpect... |
Is it okay to implement a virtual method in a base class because I know that the majority of derived classes will use that particular implementation?
Suppose I have the following class hierarchy (in C#):
public abstract class BaseClass {
public virtual void MethodA() {
//Implement MethodA as DerivedClassA a... |
I'm new to TDD, and relatively new to software development in general (e.g. < 4 years experience), but I am trying to learn.
I have been toying with TDD but ran into what I know realize is a common problem. I have been testing both higher level API contracts, sometimes with integration tests when necessary, and lower l... |
So I was having a discussion with some co-workers, imagine I'm designing an API. The API takes in a list of IDs, and returns a list of corresponding objects for each ID, each ID corresponds to exactly 1 object, and if any ID is not found the entire call fails. The objects returned do not have the ID used to query for... |
Does using touching a database mean a unit test is an integration test even if you are using fixtures?
If so, what are the alternatives to write a unit test when you need to use models as a part of a test in a CRUD app (e.g. Ruby on Rails)?
|
We are developing internal api's for integrating the server side logic (backend) with frontend (web, mobile etc). We have a java stack in our backend and front end is coded in react and react native. Since both of these are developed by our organization, as API providers we have complete control over the API consumers.... |
I want to document my code such that there is minimum need for reading and browsing the code again months later.
I know that there are different types of documentation (in source code and outside, sequence diagrams, and so on).
I just want to know what is an efficient way to document my code so that, when a few months... |
In my team we have been cleaning a lot of old stuff in a big monolithic project (whole classes, methods, etc.).
During that cleaning tasks I was wondering if there is a kind of annotation or library fancier than the usual @Deprecated. This @FancyDeprecated should prevent the build of the project from succeeding if you ... |
I have the task to port some code from Visual C++ to gcc.
Some calls are gcnew and gcroot to handle managed code inside cpp module.
How can these calls be ported to gcc in a fashionable way?
|
In general, I would my domain objects (customer, contract, etc.) to be always in a consistent state. However there are situations, where they might be in an inconsistent state, and nevertheless I want to work with them:
When I load the domain-object from the database and it is in an inconsistent state (maybe someone c... |
Community,
as our software and development team grows, we ran into multiple problems:
Multiple Config files with different paths for each machine
"Do I need this tool? And what version, I don't have this yet" - "I use it with version x.x"
"Why does this work on my local machine but not on the prod server?"
"Which Visu... |
I'm writing the service layer for my DAO and I've made it extend the DAO interface. It looks a bit like this:
public interface FooDAO {
Foo get(long id);
boolean update(Foo foo);
These two methods will do for now. Now, writing the Service layer over that:
public interface FooService extends FooDAO, AutoCloseab... |
I am trying to learn Specflow. I have bought a book and it arrives at the weekend. Most of the scenarios I see online are for simple things like calculators. For example, please see the scenario below:
Feature: Calculator
In order to avoid silly mistakes
As a math idiot
I want to be told the sum... |
I was in a job interview demo-ing a RESTful API in Flask when an argument broke about the API. The interviewer argued that the URL for adding a new user (/users/new) is not proper REST.
My API endpoint looked pretty much like below:
GET /users # get all users
GET /users/1 # get user 1
DELETE /users/1 # delet... |
I am currently developing a simple game in Unity.
I got a game board composed of hexagons. Let's say, the red dot is the player.
Now I want to show the user on which fields he can go, depending on the number he diced.
The user should not be allowed to enter one hexagons multiple times in one move.
Is there any algorit... |
I build an object in vb.net where I store data from JSON file that I get from a RESTApi. The object is nested and looks like this:
Public Class FullData
Public Property userID As ULong
Public Property data As List(Of String)
End Class
Public Class GeneralInfo
Public Property id As Integer
Public Proper... |
I am faced with taking a mvce's for SQL which happens to be the WideWorldImporters Database from Microsoft and migrating it to a NoSQL on mongodb.
The system in question may use certain fractions of the SQLDB lesser than the others, but certainly no clear approach has been formulated except that, we understand, denorm... |
I am looking to create a website.
There will be a portal, from which the user (and thier associated users) can create/access one or more databases. There will be many different databases in the background (for historical reasons, please just go with that bit).
It must obviously be as secure as possible.
I thought it pr... |
IComparable only works one way
Let's say you have a Employee class. In one view, you want to show all Employees sorted by name - in another, by address. How are you going to achieve that? Not with IComparable, at least not in any idiomatic way.
IComparable has the logic in the wrong place
The interface is used by calli... |
User story:
I'm developing a new program and try to put as much program logic into different libraries as possible to increase the reusability.
For interfaces where only a single library or "module" is needed, it is easy. Simply add the library to the project and work with the interface of the library.
Problem:
But n... |
I have been reading up on UDP connections and understand that UDP transmissions are "Best Effort", maybe your data will be received, maybe it won't, and if it is, it could be out of order. What I'm struggling to find information on is, what happens if the data you are sending via UDP is large enough that it must be sen... |
I'm trying to learn DDD/CQRS in a hobby project. And have no prior experience. In this project I use MongoDb as a read db and EventStore as a write db.
I'm building a simple 'Sprint board' application. (JIRA / Asana like)
Model
Sprint
Tickets
I decided to model this as two separate aggregates. Because I wanted to ke... |
I have decided to start a personal project using Python since I have used it for several years now and I would like to know if the approach that I have considered is good or not.
Description
It's really simple if you know Alexa / Siri / etc. I have a device which will interact with it's owner given a single area: Musi... |
I'm a junior software developer and I was wondering when would be the best time to optimize a software for better performance (speed).
Assuming the software is not extremely large and complex to manage, is it better to spend more time at the beginning optimizing it or should I just develop the software that executes a... |
I want to generate a GUID/UUID for my web app to use but I'm not sure if I should generate it on the client or server or what should be the preference.
Basically, I'm working on a web app similar to e-commerce app.
Here are the steps:
1) User logs into the web app
2) User can create a new transaction or search for an e... |
For example, consider I have constants VOL_MIN and VOL_MAX, which is used inside 1 function only:
public void setVolume(int val){
final int VOL_MIN = 1;
final int VOL_MAX = 10;
val=Math.max(VOL_MIN,Math.min(val,VOL_MAX));
//some other code
}
Originally I think everything should be accessible only when ... |
This is for one of my personal projects. I want to store a table of data in a BLOB/TEXT column in the database. I don't want to store the data in its own database table because the schema of this data will often change, and I don't really need to query it.
So I am searching for a data format that would be:
Suited for ... |
I study computer science and I learn about sign extension. I wonder: Are sign extension and padding referring to the same technique?
|
I am working on an project for development of an Embedded system with following requirements.
Should be able to receive a text in English language from a Host device. Interfaced over Modbus.
Should be able to convert a given text into a bit pattern which would be later processed to be displayed on a fixed-dimension L... |
I use laravel with repository pattern.
My project strucuture is:
I have an Entity class(POPO) which implements an Interface and has a repository class related to it.
For example for a User Entity, I have:
App\Entities\User - Entity class
App\Repos\User - Repository class
App\Interfaces\User - interface
Most of the acti... |
I've joined a new team of great colleagues and a difference of opinion has come up concerning including //given //when and //then comment blocks in unit tests.
For example
public void mapToitemList_MapsCarsToitemsCorrectly_ForSingleFurrari() {
// given
String commercialProductName = "Furrari";
String produ... |
This link (http://www.taimila.com/blog/ddd-and-testing-strategy/) says: "Feature tests should depend only on the application layer" i.e. presentation layer.
I am trying to understand how BDD fits in when using Onion architecture and TDD to develop a system. I have bought a book, which should arrive at the weekend.
My u... |
I've read that when using the Strategy Pattern, you should stick to composition rather than inheritance. But does this mean that any inheritance at all is bad practice? If there is functionality to be shared between similar strategies is it anachronistic to implement a base class to encapsulate that functionality? Belo... |
When developping a project I follow the OOP principles and break my code into classes and most of the time I go for one file = one class.
Now I dont know how to organize my code into the class and even into my own functions/methods I'm still looking for ways to improve the readability.
I think the general consensus is ... |
An open source project licensed under BSD, MIT or another permissive license accepts code contributions from the community.
How can I prevent someone from taking GPL-licensed code that they don't own and submitting it to my BSD-licensed project? I do not know that the contribution was stolen from a GPL-licensed project... |
Currently we find we have a lot of code that sometimes overlaps an end user feature, in some cases only contributes to a tenth of a feature, or it even looks like shouldn't be there anymore
The codebase is quite big so we don't feel confident enough to rip things out without a solid reason.
Is there a recommended appr... |
I'm developing a module that should be able to interact with other modules such as numpy or PIL. To accept parameters and test if, for example, a parameter is an numpy.ndarray, I'd need to import numpy first.
What I used to do on previous projects is
numpy_exists = True
try:
import numpy as np
except:
numpy_exi... |
Our current business process is that the domain experts will write down the business logic in a Word document, and developers will try to reflect those logic as closely as possible with the implementation.
This process violates the DRY (do not repeat yourself) principle, and thus creates many problems that are associa... |
I want to add some example projects to my repository. However, I have some files with copyright notice. The disclaimer says owned by Xilinx, use at own risk, don't delete copy right notice.
It confuses me, it says it is confidential so I cannot use it? At the same time, if I use it, it is my responsibility. The notice... |
I developed c# winform application which monitors database and I want to license it.
License will be concurrent based. Standart license 2 concurrent users, Premium users 5 concurrent users.
I want to check license in online. Which means that users need internet connection to use my application.
However this will be dat... |
Please check this in sqlite :
agents may make bookings for performers, and performers may also make bookings for themselves. It is only possible for agents to make bookings for functions that involve performers. An agent may be responsible for making bookings for more than one performer. If a performer is represented ... |
I recently started learning about OOP, and I have read that OOP is a different programming paradigm than procedural programming. But I didn't find any examples that shows in what way they are different.
I mean say that I am using OOP and I created a Car class with a moveForward() function and then I called this functio... |
I just completed a research project in computer science for a college professor and I wanted to upload it to github so that people can use it and possibly benefit from it for free. What do I have to write at the top of my code so that no one can steal it and claim that they created it?
I am not sure how licensing works... |
In evaluating the work of an outsourcing company, I have found that they have a propensity for dividing work into as many classes as possible, each one being testable. In some ways this seems commendable, but they are taking it to an extreme and no one seems able to control them.
Recently I found what should have been... |
Is it possible to compress true random permutation using low order polynomial interpolation? If yes, how it can be achieved?
|
For example, given node types User and Post, and expressing that a user posted something on Twitter, what factors would I need to consider in deciding between:
(u:User)-[posted]->(p:Post {platform: 'twitter'}),
(u:User)-[posted {platform: 'Twitter'}]->(p:Post)
and
(u:User)-[posted]->(p:Post)-[postedOn]->(twitter:Platfo... |
I'm making a plugin in maxscript to detect mesh self intersection.
At first I just looped all edges vs all triangles (excluding pairs with shared vertices) but that was horrificly slow (1h+ on 6k vert test mesh)
Then I tested the bounding boxes of all the edges and faces first, that cut it down to ~3 min
Then I sorted ... |
I am a fresh frontend web programmer. and I recently programmed few types of web based mobile applications(means originally developed on web using angularJS and I have used a tool to create .apk file) basically for myself .these apps are including " Creating Shopping List" , "Price Comparison" , "Things To Do" and "M... |
I want to display the product, and the product card has a lot of information about the product and the owner. How to deal with Law of Demeter in this product - owner relationship?
In controller I currently have:
Product product = productRepository.get(1);
And in template:
product.name
product.description
product.owner... |
Sometimes, ex. when using common mocks (same for data access layer as for presentation, I use often xunit ClassData), I come to the moment when I either copy common code to new unit test library or create "UnitTestsCommon" project.
I cannot find definitive answer which one is better, though I tend to rather duplicate ... |
In a CQRS/async microservices context, I have a command handler e.g. SendOrderConfirmationEmailCommandHandler implemented in a communications service.
This depends on information from the orders service, which can be retrieved via an GetOrderDetailsQueryHandler.
The sequence of messages for this process is:
SendOrderCo... |
I'm trying to follow MVC concepts when i develop my application ,but I'm confused between Using String or StringProperty in Model classes.
Example one :
public class User{
String name;
String password;
public String getName() {
return name;
}
public void setName(String name) {
thi... |
So basically, it is a web server that is hosting a php project. The project accepts some inputs from the users and send them to the server via ajax for validation each time the check button is clicked. Then the result is coming back to the client via json.
What happens if multiple users send requests to the server con... |
Following on from my previous question and the comments under the accepted answer: One Acceptance Test project per layer or one Acceptance Test project per Bounded Context
I have done a lot of reading into BDD recently as I try to decide whether it is applicable to a project. I have come across the term Honeycomb (htt... |
We have created an LMS using Angular JS 1, Python(Django ) API and mongoDB as a database. Now we want to extend the LMS to make it a job portal. We have decided to create another front end project and keep the database as same. We decided to change the front end as we want to create the new project in Angular 5 and get... |
Let there be a static web application.
Let the following be a priority:
First loading time (ignore cache etc)
User experience
Search Engine Optimization (meta tags & bot friendliness)
When writing a web application, there are two broad approaches:
Single Page Application (AngularJS, Vue.JS, React, ...)
Benefits:
... |
It seems inefficient to go through the whole HTTP process. But I can't really come up with an alternative solution that doesn't involve coupling the code for the API with the code for the public-facing website, which seems to defeat the whole purpose of "dogfeeding" in the first place. So is it possible to skip the ove... |
I am redeveloping an application with the aim of going along with the more modern techniques. That is how I came across Socket.io, which I integrated with express.js.
I implemented live searching with datatables using socket.io for the filtering & fetching part. Users then can click on individual records and go to a pa... |
Is there any fundamental difference between to using an action and a list of actions? Seeing that action is a delegate and therefore is a list itself. For instance:
List<Action> technicallyRedundant = new List<Action>();
technicallyRedundant.Add(() => { Console.WriteLine("Action 1"); });
technicallyRedundant.Add(() =>... |
For example, suppose I have a class like that:
public class PlayerInfo{
public loadDataFromDB(){
//some code about DB framework
}
public string name;
public int age;
//other methods
.
.
.
}
I found many classes would use PlayerInfo, but loadDataFromDB() is called only when the ... |
I'm building a location based REST API using Spring Boot, and I have run into a bit of a testing philosophy question. I have an object called Location that, among other things, requires a Google Places id to function. I've exposed the CRUD of this resource at /locations which delegates its work to LocationService.creat... |
This past year I took the leap and learned a functional programming language (F#) and one of the more interesting things that I've found is how it affects the way I design OO software. The two things I find myself missing most in OO languages are pattern matching and sum types. Everywhere I look I see situations that w... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.