instruction stringlengths 34 36.1k |
|---|
I'm trying to write a REST API client for practice and I'm having trouble figuring out how lay out the project.
The approach I'm taking right now has Actions, DomainObjects, Requests, and a class that deals with authorization and headers and such (CoreClient) that exposes a generic DoPut<T>(string address,T item) and ... |
Problem Statement :
When I first learned backtracking I made a program to find all the
permutations of the English alphabets in lexicographically increasing.
Filled with elation I showed the program to Rohil. Rohil being someone
who likes to do stuff off the league was not impressed and gave me the
following ... |
Please forgive me if my thought process is incorrect. I'm only a programmer in my spare time, with no formal training.
I'm using VB.net to create a very basic application, but some settings need to be read on startup. So my theory is that in the Form1.Load area, add all the checks for various settings and apply the se... |
I'm going through Apple's Start Developing iOS Apps (Swift) tutorial and I'm confused on how they are using MVC.
They have a custom control (the view, a subclass of UIStackView), it is basically 5 stars that you can touch to rate a meal. Touching the third star would rate it a 3-star meal, etc. Their code that handles ... |
I'm working on a security concept of a bigger project. It will be done with Spring,but that's actually not relevant right now.
The whole system is a hierarchical tree of computer nodes that run a custom platfrom software, whereas layer 1 nodes connect to a node on layer 2, layer 2 nodes connect to a node on layer 3 and... |
I can't for the life of me find any reasonable guides or recommendations on how to properly install or deploy applications made of multiple processes. Some considerations:
Multiple machines
Multiple services
Data and data migration
Different environments (eg dev vs QA vs production)
Configuration
Secret keys
handling ... |
I'm working on a software and hardware system which is completely autonomous in its activities. There is no user involved and one external system which data is sent to. There are a lot of different activities and processes going on inside the system, but they cannot be modelled well with use cases as these are all inte... |
I was watching an OOP lesson with such code:
class UsersConstroller {
protected $userService
protected $logger
public function __construct {
UserService $userService,
Logger $logger
}
}
What this class does is pass other class in the constructor, then it will assign them to variabl... |
My company is recruiting an external agency to do a site redesign/development (agency has not been selected yet).
Regarding the technical design document, should my company produce that document or the agency?
I do not want to be restrictive when it comes to agency's creative process, but at the same time there are st... |
Given three classes:
class A {
B* b_;
A(B* b){
b_ = b;
}
void doThings() {
C* c = new C(b_);
...
// Use c
}
}
class B {}
class C {
B* b_;
C(B* b) {
b_ = b;
...
}
}
The reference to B in class A is useful only for passing it to C when ne... |
I'm working on a sequence diagram for a layered system that has a tree hierarchy. Now I have a process that works itself recursively down the tree. Meaning calling the same function on a child object.
I'm talking about a tree like this:
-layer n
-layer n-1
-layer n-2
-...
-layer n-2
... |
For explaining my problem I'll start off with a code example. Imagine this (very simplified) code:
public void entryPoint() {
Foo foo = new Foo();
foo.doSomething()
method1(foo);
}
private void method1(Foo foo) {
// do a lot of stuff before foo is needed again
foo.doSomethingElse();
method2(foo... |
I've done a search about backwards compatibility and there's not a lot of information about it. The most informative article I've found was one about how Subversion handles backwards compatibility. While it mentions what steps to take to ensure that software stays backwards compatible or what could break it, I'm more i... |
Let's say I have an enumeration of related information types and an enumeration of time periods. Also I have created two operations on a controller for retrieving data of those info types.
Due to third party API constraints InfoA can only be retrieved with a date range and InfoB and InfoC can only retrieved with a tim... |
I'm working on a building what I'm calling a Process Wizard Builder in PHP. I'm interested in using established design patterns where applicable, but my experience architecting a system like this using design patterns is limited.
Here's the gist of the system:
There are many different process wizards that need to be b... |
Picture a simple messaging app written in Django.
Users have the option to delete messages at any time, but the messages need to be retained in the database. There are two options:
A deleted attribute on Message. Then the call user.messages.all() would be replaced with user.messages.filter(deleted=False) everywhere in... |
At present we have 2 PHP applications which share absolutely no code, but share a common database. One app is the timesheet application for administrators, the other is the timesheet applications employees log their time against projects. We are proposing a complete rebuild of the application using Spring Boot, Spring ... |
I was talking with my boss recently about composing services from other services (in a Service-Oriented Architecture, if you haven't already guessed). We disagreed on some architectural principles and I'd like to find some articles to read around the subject to help the discussion.
My thesis is that injecting services... |
We need to get more much more rigorous about managing state in our business application. The heart of our problem is an object, lets call it an "TaxRefundApplication", that has about 20 properties, but there are literally hundreds of interactions between them. Individual properties can be disabled or hidden based on th... |
I am creating a method in an ASP.Net Web App that will be called in a few places of my application and it creates a record in the database. When I started to look at the database model (which I have no control over) I realized there are 50 columns that have I have to insert data into. That means when I build this metho... |
I'm working on a project that has a massive script.js file where all the shared functions, code and more is placed; but it also has code that has some page-specific behavior.
Evidently, this causes issues in certain ways as including the line $('#bank-account').on('change' ... in those files that are not the one it is ... |
I have a method that checks a data structure for the presence of a thing that might be missing but is required. If it is missing, it adds it.
Essentially it is this (although the method is much, much more complicated due to the complexity involved in adding the thing, and the thing comes from a thid party service):
vo... |
For example, the SysInternals tool "FileMon" from the past has a kernel-mode driver whose source code is entirely in one 4,000-line file. The same for the first ever ping program ever written (~2,000 LOC).
|
An experienced software engineer described a database design pattern to me in which there are three kinds of tables: transactional tables, associative tables, and data definition/taxonomy tables.
As he described it, a transactional table might store information about a user, product, etc. For example, the USER table mi... |
I'm trying to understand the database per service pattern in microservices architecture.
Say we have a restaurant reservation application composed of the following microservices:
User
Search
Restaurant
Reservation
Search
Notification
If a user wants to create a reservation, the UI would perform a POST request to... |
For ember acceptance tests is it best practice to mock services? This seems strange to me as I would expect an acceptance test not to have to mock anything as it's testing an entire system. Also, some features may call several different services.
Can someone help me out with the best approach? Trying to test my applica... |
I'm new to actors and just playing around in ruby using Celluloid. I have this code below
module Enumerable
# Simple parallel map using Celluloid::Futures
def pmap(&block)
futures = map { |elem| Celluloid::Future.new(elem, &block) }
futures.map(&:value)
end
end
p Benchmark.measure{
100_000.times.pmap { ... |
My microservice prototype currently has a Spring boot MVC application as its front-end. The application renders the View completely in the backend. It makes rest calls to other microservices like OrderService or ShippingService that are behind an API Gateway. Scaling the micro-services behind the API Gateway is no prob... |
I need a run-only-once method that when all the criteria are met, say A&B&C are true, run the codes once, but only once. So if later on all the criteria are met again (A&B&C are true again but I don't care then), the code won't be run again.
This is not to solve the multithread issue, there is no data synchronization p... |
Consider an ORM that maps tables to classes, and columns to properties. How should it handle a property that maps to an identity column for non-inserted objects?
For example,
[Table("MyTable")]
public class MyMappedType
{
[Column("Id")]
public int Id
{
get
{
// ...
}
... |
Say I have two views (Table View for example) that I'd like them to do different stuff; each loads different data but behaviors are similar for most par except what happens when a cell tapped for instance. One shows a list of entries, another a list of users, another a list of comments, etc. I can write one subclass o... |
Given two classes:
class A {
B* b_;
A(B* b){
b_ = b;
}
}
class B {}
B is a class that should be used only inside A so I would like not to expose its creation to whatever class uses A. Moreover, B should not be created every time an instance of A is needed (it has a slow initialization).
Given that... |
In my project I have a list of items that should be sorted, but instead of re-arranging the positions of the items in the array I want to set a 'Sequence' property defining the item's places in the list.
Currently I use a merge sort to re-arrange the array and then loop over the items to set their sequence property.
Ar... |
All of the examples of bridge pattern show only one level of inheritance, but I would want to apply it to a subclass of the base class too.
The RefinedClass adds functionality to the BaseClass. In the end you want 4 classes functionality (Feature1Foo,Feature2Foo) , (Feature1Foo,Feature2Bar) , (Feature1Bar,Feature2Foo)... |
So I have a project which has BDD tests with Behat/Mink. The scenarios which I have use mink, and so require the testable code to be deployed so that Mink can actually test the pages.
I'm wondering how these tests would fit into a CI/CD pipeline/workflow. Currently our workflow is as simple as push, deploy, manually te... |
Just finished reading this article which claims the Java Fork-Join framework is a bad fit for almost any realistic task. He seems to being up some good points but I don't feel qualified to say if he's right or not. To quote the conclusion:
The F/J framework is lacking as an API
It is deficient in “characteristics of ... |
Due to a number of circumstances leading to a poor deployment last build cycle, I campaigned in our office to perform all future deployments with a dedicated build machine, and my boss accepted this proposal.
However, instead of getting an actual machine in our office to use, we're having to share a single machine wit... |
If I split up the development into a timebox with 3 phases: planning (e.g. with planning meeting), functional progress (software development / implementing user stories) and finalization (e.g. with review meeting). What is the iteration/sprint? Does the iteration also contain planning and finalization or are these part... |
I want to make a randomizer for the items in the game La-Mulana. However, some arrangements of items would mean that the game cannot be completed. Sometimes there's only one group of items required to pass an obstacle, other times, there are multiple groups of items which can pass an obstacle.
For example, to reach th... |
We're performing a delivery from our Developer stream to the Integrated stream that we share - this process allows our build team to construct our application from the Integrated view. This is for a Java application.
There are several activities that were never delivered to the Integrated stream - old changes that we... |
I've been wondering something about how we pass complex ORM objects to background workers — in my case, Django models and Celery, but this could apply to any similar background processing framework.
I usually pass model objects "by reference" using the primary key. In quick Python, this would be how I send an email for... |
I want to be able to have a (pretty) large FSM where I can debug it by jumping to a point and watching the execution.
For example, lets say I'm making a FSM that uses some probability on whether I go left or right at a junction. Maybe I have a bunch of things like "people I've seen go left" and "people I've seen go ri... |
So I want to add our git repo to the server so that we can pull in the latest changes from the master branch and easily update the live sites via SSH.
I don't want changes tracked by Git on the live site though, I want it to only be able to pull in new changes from the master branch as new features will be developed on... |
If we test a function B, by testing a function C which calls that function B, i.e. writing a test program to test the function C which calls that function B, is the test method still called unit test, or something else?
When is it preferred to test indirectly on a function which calls the target function, and when is i... |
Summary: Why is it wrong to design a constructor only for its side effects, and then to use the constructor without ever assigning its return value to a variable?
I'm working on a project that involves modeling card games. The public API for the game uses an odd pattern for instantiating Rank and Suit objects. Both use... |
Consider the following method:
public async Task LoginAsync()
{
if (!CanLoginAsyncExecute()) throw new ValidationException();
try
{
StartLoading();
await _authenticationService.LoginAsync(Email, Password);
}
catch (LoginException e)
{
... |
I have been searching the net for an answer, but I was not able to find a similair question nor answer. So here I am.
I am developing an app where a user can take a picture of a car and they will get back the car brand and possibly a model.
Currently I am using an API as a back-end to recieve the picture, the API will ... |
A year or two ago I saw an excellent article on OOP (Java), which showed the progression of a simple concrete logger of two or three lines of code, and a theoretical excessive thought processes by the inexperienced developer that basically said oh, I should add this in case we ever want that! By the end of the article... |
I'm writing a web app which allows users to upload real-estate listings. Part of what this does is allow them to upload photos of the property they're listing.
I'm using a micro-service type approach so there's a property media service which handles all the uploading of media, querying of what media are available for e... |
I have learned that new Intel processors can do "dynamic execution" (meaning out-of-order execution of instructions). How do programs written in a high level language take advantage of this? Does the compiler modify the code so that they can benefit?
Every year new processor architectures come out but languages like ... |
I'm working on a modular video processing pipeline. It's currently presented as a tree of modules. Each module has a set of "results" and can dynamically request data results from other modules. Each request and result are marked with frame ID. User requests one or more "metrics", i.e. end results, for a set of frames ... |
I am trying to make an effective modf() function that uses floats instead of doubles. An embedded application I am working on only supports the float type.
My modf() function works as expected with the exception of float rounding errors.
Consider the float number 12345.67. The current version of my modf() function si... |
I am looking to develop a piece of software which will probably store hundred of thousands or even millions of datasets with 3 to 5 datasets to look up per ID.
Is there any way to build something like this efficient, fast and scalable in regards of "lookup time" using PHP and MySQL?
I thought about trees for easier loo... |
So I am creating a numerical solver that I want to use for many problems/algorithms. The way that it's written, there is a generic class called "Algorithm_Scheme" (and associated files Algorithm_Scheme.h and Algorithm_Scheme.cpp) that is included as a member of the "Solver" class.
To create an executable for a differe... |
I have a Python client launching a subprocess in C++.
The C++ program runs several threads that need to report results to the Python client.
Knowing that both the Python client and the C++ subprocess are running on the same machine, what is the best way to communicate between them? Using communication through TCP or t... |
Say I have a Car, that owns a SpeedBooster that whenever is active and the car has to move, it will add an extra - configurable - speed to that moving action.
I was thinking about how to design-implement this using OOP, and I ended up doubting between two different solutions:
Solution 1
The Car is the one that checks i... |
Just recently started to grasp on MVC and design patterns.
(back to school at 34 ;) )
I was asked by my teacher to design a two part application. It's a recipe website that as an admin WinForms app.
I started to develop my core domain and then moved on to persistence and then moved to the MVC web app... and then I star... |
Recently read couple of Graph DB tutorials. Most of them tell what is Graph DB/when to use/fetch syntax but no where found high level description
how GraphDB stores the data internally to understand it better.
Coming from java background, I think GraphDB must be storing the data similarly like Java represents the Objec... |
I have three subclasses that inherit from Hero:
Warrior
Magician
Amazon
The three of them hold a Weapon, that is always the same one:
Warrior always holds a Sword (that inherits from Weapon)
Magician always holds a Wand (that inherits from Weapon)
Amazon always holds a Bow (that inherits from Weapon)
I have in mind... |
Specific Background
I'm writing a library to extend the async backbone of a language with cooperative multitasking. (The language is Hack, but C# also implements async-await with Task, if the concept sounds familiar.) I've been able to express what I intend the library to do in code. The problem of the hour is when.
So... |
When do we use template specializations for in C++, if not for SFINAE or metaprogramming? type_traits, enable_if and others rely on it a lot, but I'm more curious about situations which are more "obvious" uses of templates - type-agnostic algorithms and objects.
One can easily create an artificial example of algorithm ... |
Introduction to my problem
I'm trying to design a very simple video game where there are several Animals players (they all inherit from Animal):
Cat
Dog
Rabbit
There are also some performable actions (only one per Animal) they can perform such as:
Bite: done only by Dogs (if an animal gets bitten, it will lose an am... |
I was assigned a refactoring.
We have several modules having similar functions with some differences. My task is to extract common portions of code for DRY principle.
I am a little lost how to do it.
I could just cut&paste similar fragments of code, extracting them into separate functions, but if I do it this way mecha... |
What data structure would be best choice for fast and performant bidirectional SHA-1 to SHA-3 mapping? Or in other words fixed-length string to fixed-length string mapping?
To be more precise:
There exists a set of data (which might count in mega-objects), over each of which SHA-1 and SHA-3 hash of is taken
For given... |
I'm a PHP developer, and what do PHP developers do? They create frameworks, so I'm having my way with my little mvc framework project and I've stumbled across a design problem I'd like some opinions on.
For my models I've chosen to take the data objects path (if that's the correct terminology), not a big fan of active ... |
There is an existing real-time, scientific visualization application that uses OpenCL and OpenGL to render complex 2D graphs. My goal is to incorporate this application into a 3D rendered scene. At the very minimum, the desired application would render a 3D scene with multiple planes that each contain a graph from the... |
We have 10 bags. Each bag has 5 compartments numbered from 1 to 5. We have 100 objects to fill all the compartments and bags.
Compartment number x in a bag is identical to compartment of the same number in the other bags.
Putting some objects together in a bag may be dangerous. The danger ranges from 0 to 3.
Putting... |
Hi I am in my first year of SE. Learning C. Haskell, html, css, mips, Sql, Software testing and other computer related modules. I have been an organised student before. But I am struggling to find a good strategy to keep up this year. Especially how to write proper revision notes in programming. I find myself forgettin... |
I have come up with the following design for my requirement and want know if there is a better way to do it or if you have any feedback on the design.
Requirement
Assume that an app provides different add-ons and each of these add-ons have a licence. The user is given a license key and he can activate/deactivate the li... |
I am trying to write a servlet which does task based on the "action" value passed it to as input.
Here is the sample of which
public class SampleClass extends HttpServlet {
public static void action1() throws Exception{
//Do some actions
}
public static void action2() throws Exception{
... |
The financial application I am building contains data which is a number that corresponds with two terms. It works like this:
number > 0 = overspend
number < 0 = underspend
Unfortunately the overspend/underspend terms do not have a neutral term, like nospend or whateverspend. Now I'm unsure about how to save this data... |
I've done some research and one method used for cross-platform mobile application development is to use the lowest common denominator approach, packaging platform-independent functions in a shared C++ code base, and developing the platform-specific ones in the SDK's native language.
I understand the advantages of this ... |
I had some ideas, but which one is the best (and why), and is it other way(s) to do this?
I thought about :
- Sessions
- GET Params, but if there is a lot of errors(for example a register form) it could be ugly.
- POST Params, but it needs a form with a JS redirection.
Objectively what is the best solution?
|
We have a following scenario where a team A develops a large Visual Studion asp.net MVC project and uses github as a version control tool.
In case team A needs an outside help completing a part of this project, how can we achieve so that team B (outsourced) gets access to only a part of a project that is necessary for ... |
I have to create a real-time display. On this display I have to get the numbers from an existing business logic component (written in C) and display these Live on a classic ASP-page (legacy app).
How can I best structure this solution to reuse the existing c code without refactoring the legacy asp classic website?
|
I have a class representing the state of my application and I want to create many commands to update this state.
class State{
private:
list<int> intList;
...
}
class ICommand {
public:
virtual ~ICommand(){}
virtual void execute(State* state) = 0;
}
ICommand implementations will spe... |
Our team has hired freelancers for creating a website.
They did their job well, but now we want to add services for our core
product using different server and technologies, but we want user
identities to remain the same on the website as well as on the mobile application that will be using these services.
Possible so... |
In object oriented software engineering, domain- or business objects are those objects dealing with the domain model. What are the other objects called that or not part of the domain model? Helper objects? System objects? Are they sub-divided into different other denominations? What would be examples of each?
|
I have a class which implements an interface and have responsibility to create item and "maintain" collection of created items.
Class have method GetOrCreate(int id) which return instance of created item.
public class PoolOfItems : IPoolOfItems
{
public Item GetOrCreate(int id) { }
}
Requirements for GetOrCreat... |
I am working to implement a Web API solution for development. I have a few C# console apps that run on a server and have their own data access operations, as well as a MVC app running on a similar server. I want to centralize the DAL to a WEB API that can be hosted somewhere. My question is, what is the best way to man... |
Let's say you have a validation engine that needs to cover 100 rules to be useful.
Let's also assume the team can only deliver about 10 rules per iteration.
How would you go about making a "potentially releasable product increment" by the end of the first iteration, when the rules engine would still be missing 90 of th... |
I'm making some modifications to an open source project licensed under the GPLv2 (which will of course be released under the GPLv2) but I'm unsure what to do with attribution notices adjacent to the GPL notice at the top of each file. Each file has:
Copyright (c) <YEAR> <ORGANIZATION>
<GPL>
Author: <NAME> <EMAIL>
at... |
Our organization uses IBM ClearCase to manage its versioning controls (for better or worse). We've been working on our application for several years now, and a large number of activities have started to pile up as 'dependencies' for our existing build work.
My understanding from reading the PDF on Dependencies from ... |
Upon inspecting Twitter's URL shortening service http://t.co, I noticed that, instead of redirecting to the goal URL using a Location HTTP header and a 3xx HTTP status code, it redirects using the following HTML (formatted for better readability):
<head>
<meta name="referrer" content="always">
<noscript>
<META ... |
It seems like a chicken and egg problem.
You can make a write function write to some data store, but never know you saved it properly without a tested read function.
You can make a read function read from a data store, but how do you put stuff in that data store, to read, without a tested write function?
EDIT:
I am... |
If I have a Solution with a Project with Production code, where do I do the Unit tests? Do I put them in a whole new Solution and reference the Release version of my .dll?
I am using Asp.Net Core 1.1, C#. I have a "regular" MVC project, and I have a Core Web API as well I'd like to test.
I don't think this question i... |
I was wondering which symbol should be used for representing a user event (i.e. button click).
seems like it should suffice, but isn't a user click technically ?
|
For example, a language that I was looking at recently- Terra. You can address the question in the context of any language, I'm just most comfortable with Lua so I'm starting from there.
The Terra Language can be metaprogrammed with Lua and is backwards compatible with C. C code can be used inside of it and its code c... |
I am getting huge list and it has two fields as follows:
Number Designation
10 Principal
10 Teacher
10 Dean
10 Peon
Map map = new HashMap<>();
I am using Map to avoid duplicates.
{Dean, principal, teacher, peon} are in descending priority and the values can be overwritten. At first, principal... |
How can I handle customer specific implementation. So for example a custom needs a different way to show data, a different model or a different logic.
I've read about HMVC but I can't find frameworks that support it.
Should I handle the problem by creating branches specific for the customer or forking the project? Or i... |
In the understanding of GitHub Flow, as seen here, a feature, after code review, is first deployed to production, then merged into master.
If there is a second feature branched from the same commit as the first feature, and that too is deployed straight to production, then production will no longer contain the first fe... |
public class TaskA implements Runnable {
....
}
public class TaskB implements Runnable {
....
}
I have two runnable class as TaskA, TaskB. I want to have a TaskManager to run these two tasks and have possibility to add more task in the future. So I have the TaskManager as following:
public class TaskManager {
priv... |
I have a set of jobs that start by querying an external server for a payload. On receiving the payload, the internal server takes a variable amount of time to complete the job, hence the 'weight'. What I'd like to do is schedule the jobs in such a way that stress on the external server is minimized: if I ran lots of co... |
I am confused between choosing Web API or DLL reference for a project I am working on and want to understand recommendations for both the approach.
We are having a Web API which exposes an interface for the business logic(BL). We are using HTTP based service and the code is C#. We also have a Web Application which inte... |
Our organization codebase is used by various teams.
Over the years, the code has evolved and grown without much usage of interfaces.
We would like to change that, to reduce chance of breaking changes.
i.e. change accessing of common components from
Foo foo = new Foo();
to
Ifoo foo = SomeFactory.GetFoo();
My question ... |
I'm building a system that uses objects that are built using multiple Async queries to a remote server (Firebase) and queries to a local DB.
How should I design a module to generate these objects?
I was thinking of using a Builder Pattern but almost all of these variables will be received individually from separate D... |
We've come across the following case when working on REST API.
Users have the ability to expand the product deployment by installing custom JSON configurations. These configurations tend to be lengthy and are generated automatically.
We're working on implementing an API call for installing and updating such configurati... |
I have a hierarchical data model and am trying to implement their CRUD operations in my Web Application.
Currently I have code inheritance for CRUD operations of my entities (resources) as follows:
ResourceCommonProcedures as a base class and each Resource procedure inheriting the base class.
public class ResourceCommo... |
Java programmers are encouraged to store all their configurable parameters in an application.properties file from which they either load properties during runtime or they load during program start and assign them to variables in a config file.
The way I used it was to store variable values that I need to tweak betwee... |
Let's say I have a Migrator class to run DB migrations. It also has functionality to lock the db and make sure nothing else can run at the same time.
I now have another piece of functionality that also needs to lock the db.
Should I:
just make lockDb() public?
split the class into Migrator and Locker?
split the class ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.