instruction stringlengths 34 36.1k |
|---|
As I try to deal with the possibility of failure when I invoke RESTful endpoints or in general any HTTP endpoint I've been wondering if there is any standard or pattern in the HTTP specification or in the industry to deal with the problem of determining when an exception is transient and when it is not particularly for... |
Our organization is looking to standardize the way we use const T& and T const& and while we initially looked at clang-format to solve the job, it doesn't reorder tokens so there is no way to swap const and T.
Does anyone have an idea as to how I can reorder these systematically?
|
I'm trying to consume an API (tumblr) in an asp.net-mvc application and I feel like there should be a better and cleaner way to handle the response data.
I have these models:
public class TumblrEnvelope
{
[JsonProperty("meta")]
public TumblrMeta Meta { get; set; }
[JsonProperty("response")]
public dyna... |
I am currently writing a Java bridge to a eyetracking library written in C. The whole thing works very well, but building an actual application with it is hard, since eyetracking is done by polling for new data.
Polling becomes a problem as soon as you have a graphical user interface, as a poll-loop blocks the main eve... |
I have a backup application written in Delphi. Now I want to add Delta capability by using RDiff.exe + cygwin1.dll.
cygwin1.dll is covered under the GNU GPL License . Does this imply that I have to give my entire Delphi application as Open Source ?
|
Suppose I have a REST API backend and it is used by a mobile app. Authentication is based on tokens (JWT) with expiration time. Mobile app user does not want to enter credentials so often, even for weeks. In other side I think token must not have expiration time more than 24 hours or so. If I do not include token inval... |
I have a short question for you: let's imagine that we have a class similar to this one.
public class StreamTradeDataProvider : ITradeDataProvider
{
public StreamTradeDataProvider(Stream stream)
{
this.stream = stream;
}
public IEnumerable<string> GetTradeData()
{
var tradeData = ne... |
How would i design a stack which in addition to push() and pop() ,also has a function min which returns the minimums element ? min() must operate in big O(1) time
|
So I'm building a card game where each card has cost, damage, and durability, as well as name and description. Obviously one would think of creating a Card class:
class Card {
int cost
int damage
int durability
string name
string decription
}
werewolf = Card(5, 10, 120, 'Werewolf', 'Deal double dam... |
I have a finished Chinese-English dictionary website as a personal project and it works pretty great. I'm using node/Express with node-dirty, which is a barebones file-based JSON database that loads everything into memory on start-up. As I keep adding more features though, I have to continuously update my database gene... |
Much has been told about the advantages of agile development and Scrum in particular, however, most of these assessments assume that an organisation comes from a very rigid methodology of Waterfall. But what if a company is organised less strictly than advised by Scrum, not more?
The organisation I work for is a former... |
I'm building a native app which currently has zero backend infrastructure.
With services like Firebase's Authentication, database and notifications means that all interactions are handled client-side within an Ionic app and consumed via Firebase javascript API.
I would like to start sending triggered emails and communi... |
I've been struggling to figure out a clean way to validate things when objects have complex relationships and the validation requires expensive operations (e.g., making DB queries or other RPCs).
Looking around, I couldn't quite find something that answers this question, so here goes. I've read a bit about domain drive... |
A lot of my code seems to be going through the following evolution -
Iteration 1
interface IAccountManager {
void Import(string importData);
}
class SalesAccountManager : IAccountManager {
private int GetAccountId(string data) {
//Some data conversions, database references, calculations etc
ret... |
I am working at a robotics startup on a path coverage team and after submitting a pull request, my code gets reviewed.
My teammate, who has been on the team for more than a year, has made some comments to my code that suggest I do a lot more work than I believe to be necessary. No, I am not a lazy developer. I love el... |
Why does the 1st map method below treat element #2 as undefined but the 2nd map method does not?
const a = [undefined,,42]; // Note the two consecutive commas.
console.log(a.map(x=>x)); // -> [undefined, undefined, 42]
console.log(a.map(x=>x===undefined)); // -> [true, undefined, false]
I expand on this wi... |
Code 1:
private static int myCompare(String a, String b) {
/* my version of the compareTo method from the String Java class */
int len1 = a.length();
int len2 = b.length();
if (len1 == len2) {
for (int i = 0; i < a.length(); i++) {
int intValueOfStringA = (int) a.charAt(i);
... |
I'm trying to create a Html file input field which can add multiple files to the form, instead of replacing existing chosen files.
This is the basic file input element for uploading multiple files:
<input type="file" id="fileupload" multiple>
But it replaces previously chosen files :(
I can't believe that html doesn't... |
I am working on a web api c# project using onion architecture and repository pattern and entity framework among other things. Doing some research I discovered a technique called side-loading
https://developer.zendesk.com/rest_api/docs/core/side_loading
that basically helps client load additional information in a singl... |
In the old days we used to create a single .gif file for the entire application to avoid too many trips from the browser to the server. Similarly, we used to combine different types of information in a single response to avoid unnecessary HTTP traffic.
Did all this change with the microservice paradigm? Is it better t... |
I built a post processor for creating CNC machine files to which I'd like to provide a web interface.
Currently the program takes a file path as input and then spits out the results into another file. I'd now like to be able to turn the program into a server that receives JSON data.
It's trivial to open a Unix Domain ... |
I'll start by explaining what I mean in particular.
Background
In Javascript, arrays do it all (more or less a Lispy trait). Not only can you initialize, push, and pop, but you can also iterate, filter, reduce, transmute, and so on. You can also check includes (contains), and with the overloading provided by huge libs ... |
I will host a blog using Github Pages, is it possible to add a secondary license in the assets folder so if people fork the project they would have to provide their own assets and not use the defaults one that came with the project?
I was thinking of a Creative Common Type of License for the assets folder in specific.
|
I just read this question and the answer claims:
"Lets assume db connection object is singleton in my application"
This is a must not. Your database connection MUST NEVER BE (yes, bolded and
with capitals to make sure you and every reader never make this
mistake) a singleton object. Your Connection con MUST NOT be par... |
When considering the value or ROI that we reap from our efforts in implementing and using BDD it is realitively straight forward to measure your savings for the test automation element. You can compare the old manual test design and execution times against the new automated design and execution times over a time perio... |
I've been developing a C++ library for multiple precision computations (integers/fixed point), assume positive numbers.
The class is something like:
class Integer {
public:
//constructor
//destructor
//set
//overload operators
private;
uint32_t *mem;
int n_bits_stored;
};
Specifically the //overload ... |
Right Now I design Time & Attendance System.
If I have the following entities :
Shift (Id,Name,start_time,end_time, ...etc)
EX :1,Morning,08:00,16:00
WorkSchedule (Id,Name,Type,...etc)
EX :1,General,1
Where the Type may be(Traditional,Daily Flexible Hours ,Weekly Flexible Hours)
And WorkSchedule has detail using Sh... |
Our team is experiencing some growing pains with regards to source control. We use Team Foundation since it integrates so easily with our existing infrastructure, but are definitely open to other options. We deliver a software service to 15+ very different clients that require constant code updates. Right now, we have ... |
I have a template wrapper class around the container std::priority_queue that supports multithreading. The short version of it is below. In this class I employ the function IsReady() that checks whether the element is ready to be popped or not. Implementation of IsReady() depends on the type T.
At first I made IsReady(... |
This question is in the context of a server application - an API that feeds data to its clients.
Here is the obvious: if I have some data, I can search and filter on that data however I please. Let's say I have some data with the following basic structure:
[
{
name: 'Paul';
location: [51.6689134, -0.15818313]... |
I'm working on software to play back log files. We have different types of logs from different providers.
I've created an interface that different classes will implement to play different logs. For example, ClassA will hande "somelog.txt" from ProviderA, ClassB will handle "another.log" from ProviderB, etc.
public inte... |
I am developing an API that has one call that accepts a big JSON object.
Based on this object, there are 10 possible parsing scenarios, i.e. if field xxxx.xxx is present, go with scenario 5.
We currently have around 10 if statements in a controller function of over 200 lines, which decides which scenario to choose. The... |
Our company uses a 3rd party platform to manage a pretty large portion of our business, but the platform is built on top of JSP and MySQL. However, our own products are written in C#/.Net. We're currently researching methods of being able to implement an SSO between these two services without too much overhead. The SSO... |
On a SCRUM meeting the product team was debating about a feature on an API that will be consumed by mobile app.
We had a mock up that showed how the screen should look like and what key elements it should contain (a "layout").
Based on this and the discussion I had with the product owner I created a prototype for an A... |
In our company we have to development teams.
The Product Team and the Delivery Team.
I am working in the Product Team and the Delivery Team is consuming the framework, libraries, and services we are delivering to them.
They use them to create their own version of the Software, driven by their customers, and end-users.
... |
I have very little experience of using a version control system and my work colleagues have no experience though I would like to introduce one into our team as the current workflow (non-existent workflow) with shared directories, multiple file versions, reliance on me to make changes and no review process is eventually... |
Please help brainstorm/dream about an important problem (I believe this is a valid question, if you think it's not a valid question, please give me concrete critique so I can work on it).
Almost every language used is text- and file-based. This has drawbacks, e.g. refactoring, renaming symbols is often painful (renami... |
As an agile team member, when do you sign-up/self-assign a task/Jira ticket?
Does this happen before the iteration, during the iteration, during the daily stand-up meeting or it can happen anytime during the iteration?Is this observed as a practice during retrospectives?
Quoting any example would be highly appreciated!... |
I'm working on a web application project which uses Tornado as the web frontend. Currently, I'm in the process of writing up docs and adding docstrings to the code base with Pydoc.
As a web API framework, Tornado applications are structured with each API endpoint having a handler class, and with each handler class havi... |
How can I design a good REST API for actions, like in the following cases?
lifecycle
start a device
stop a device
...
conversions
convert a file from one format to another
In both cases I would always use the abstraction of ActionRequest, something like:
url: api/device/1/start
method: GET or POST
body: StartRe... |
I have always been taught that in order to in-keep with encapsulation objects should be responsible for performing calculations on their own data.
So in this case here is this breaking rules of encapsulation and considered bad practice?
#include <iostream>
using namespace std;
const int SIZE = 10;
class safearay {
pr... |
As a beginner in both java8 and functional programming, I think I'm missing something when reading about function composition since I cannot find a reason why there are two methods that do this, andThen and compose.
Since f.andThen(g) is exactly the same as g.compose(f), why are both needed, in which cases would using... |
I have couple of files in my folder, some of them can be checked for integrity. I have a xml file which describes which files can be checked for integrity and their checksum.
In OOP, let's assume I have a class called File.
Then, I have a class called FileWithIntegrity which extends File.
I could create a class called ... |
I am currently trying out Gradle for my embedded development project. The existing tool is GNU Make. Across the internet I have read a lot of articles where people say that their build logic becomes "too complex" and they would like to reduce "complexity". This I believe is basically a developer's or build author's per... |
I'm at a bit of a crossroads with some API design for a client (JS in a browser) to talk to a server. We use HTTP 409 Conflict to represent the failing of an action because of a safety lock in effect. The satefy lock prevents devs from accidentally making changes in our customers' production systems. I've been tasked w... |
I have the following scenario:
Joe is working on the feature-xx branch.
Richard is working in another feature-yy branch.
Their company has a qa.myapp.com environment where testers work.
Joe pushes code to Github repo. Build passes. qa.myapp.com is updated with the new Joe's branch, so testers can test his work.
Richar... |
In our company, we have a relatively big data structure, with terabytes of historic information stored, and there are lots of different views, editors, and reports for all the data. With the years, there have been several "hands" involved in the underlying code for data retrieval and storage, which we've found out that... |
I have a large data structure that is about to be persisted to the database. Before that can happen I have to validate it and then update a bunch of it's properties based on various specific conditions.
Which style is more readable, having a bunch of if/else statements which determine which functions will execute ... |
I am developing an AngularJS app, and the server side PHP, step by step, implementing features and then polishing them.
I currently periodically request data from the server, of the order of a few thousand records of 5 or 6 items each. As the next step, I had planned to send a CRC with the request and have the server r... |
I am looking to replace a framework from the ground up. It works as it is, but I've been tasked with understanding it, so I want to know if anyone else recognizes any glaring design issues that I could address in a re-write. Currently, the system works as follows:
Server/producer very quickly inserts data into shared ... |
In our internal architecture, we have several Tomcat servers which distribute the workload and isolate the different processes of our business. We are planning to move into an approach where several tasks (mostly BD related) will be handled by a Tomcat endpoint (load balanced for availability and performance), but we a... |
I'm currently working on introducing React in the company I work for. As the only one having done courses on the topic, who can I ask for a review to make sure the code is following 'best practices' and is implemented correctly?
|
I have read several questions here, and searched over the internet, but didnt find an answer to my question, thats why I ask, with Agile Unified Process, I have to build all the UML diagrams that I have to build with Rational Unified Process(RUP)?
I want to know it because, i want to use an agile methodology for a thes... |
We're designing a system to define user groups. The groups will be used to run queries, to target promotions at relevant users. For example, to send a "$5 Free if you come back this week" offer to users who haven't shopped at a particular merchant in a while.
A group is defined by a set of filters, of which there are... |
I've been building a monitoring system that checks whether a device is alarmed or not, and if so, sends notifications to relevant users based on how long a device is in a particular state. Here's an example of the criteria I'm building around:
1.) If a device has previously operated in a non-alarmed state for more than... |
Although the Java docs specify, that Weak references are primarily for canonicalizing mappings, you will find many, many, many people on the internet stating, that the WeakHashMap is perfect for storing object metadata during its lifetime. However, nobody bothers to make a comprehensible AND appropriate example.
Using ... |
In one of the products I work with we have an aggregation root with a lot of domain logic, and now I have a requirement to make one small piece of behavior configurable.
To give an example, let's say I have an entity and this entity has many schedules, these schedules tells me if they are on time or not and they have d... |
Assume following domain model:
An [Order] consists of a number of properties, as well as a list of [OrderLine]s.
For our purpose, an order is fairly crud-like with very little business logic.
Consider the following user story: a user retrieves an order. He then deletes one order line and adds 2 more. Finally, he saves... |
Our frontend web software contains, inside a file called url.js a variable used as URL root for REST webservices.
var url = "https://devappserver:8080";
During development on developer PC, for testing purpose, the variable is often changed to
var url = "https://localhost:8080";
The problem is that often developers c... |
I'm working for a company that will be renting smtp server capacity similarly to MySMTP. Our end users use a 3rd party email marketing frontend application configured with the details of our SMTP gateway to send emails. These frontend applications do not support custom HTTP APIs and only work over direct SMTP protocol.... |
I'm going to explain my question with a concrete example where this question has cropped up:
I'm working on a large-ish Django project with a few people. Django automatically creates migration plans and saves them to separate files when the database model is changed. Edits to the model may be applied on different branc... |
My company wants to do microservices and has created an outline of their plan (see below) (focused on dealing with files). I am not sure this is really microservices since I thought each microservice would have an individual data store? Also, they seem like one-offs that have no dependency on each other so in the end i... |
Whilst designing Java applications, I have come across a common pattern where I am writing an application that receives orders from a user and saves them in storage. When an order is stored, it can also be retrieved via its ID, and also some action done to it, e.g. have its cancelled flag set to true.
The common issue ... |
I have a repository for a project that contains both an executable and a library.
My repo
|->src
|->my-exe
|->my-lib
I am now working with a company that wants to use my library in their project as well. They want to vendor (i.e., make a one-time copy of) a subset of my repository in their repository.
Their rep... |
For the sake of personal use and for the educational reasons I wanna make a Java wrapper around a certain service's web API. That is, no additional software is required to use it on a client machine - just my code.
I also want to make that wrapper reusable and possibly utilized by other people who might want to access ... |
I'm getting in a heated debate about the Single Responsibility Principle and some code that I wrote. I feel strongly that I am right and would like some unbiased feedback.
Basically, we have decided to log a certain way in our api methods. Since this code is exactly the same across all api methods I wrote some code to ... |
I'm new to programming and I've discovered something that causes me confusion and frustration: Translating business logic into actual code. I'm trying to develop a set of questions I can ask myself that will help me get to the level of detail I'm going to need to meet the logic requirement.
Do programmers have a set ... |
I work in a manufacturing plant that has tasked IT with creating a shop floor scheduling program (that is very badly needed). Based on others experience, would it be better to take less time and build out a basic framework that is usable and then build upon that by adding features or start out by creating a fully imple... |
I am currently reading a chapter in a textbook on Processor Architecture and saw the following statement:
The less precision there is, the less space is occupied by a program variable in memory. Further, there is often a time advantage, both in ferrying the operands back and forth between the processor and memory, and... |
Does this algorithm have a name? I've listed three examples of it below. I'm wanting to document some code that uses this algorithm, and I don't know what to call it. My version is way more complicated but it is fundamentally this.
Example 1:
var maxValue = Int32.MinValue;
foreach (var value in new [] {2, 3, 4, 4, -3, ... |
I have seen a very nice effect in many applications which i don't how how it is achieved.
There is, usually, a list (eg. with emails) and the app populates it gradually with the emails putting them in order. They usually have a sliding effect to place the emails in the right line in the list.
Now, what I would like to ... |
I have a problem with design a few simple classes. I want a four classes: one recursively delete directory, another copy one dir to another same way. Another two does same as first two but they add observable behaviour: calculates few parameters like estimated time or percents of doing operation and fire up observers.
... |
I am currently working on a solution that involves showing millions (a hundred, maybe more) of records from a database, but only a small subset per page (maybe 20-30 records a page)
The site has been created as a WebForms application
Database is Intersystems Cache, (luckily the SQL side only, no globals)
Intersyste... |
I am writing an application that I've split into multiple jars including re-usable infrastructure libraries, each has their own versions (BOM managed) and git repositories. I'm doing this for a number of reasons.
some of these would be reusable if I decided to start writing a completely different application, and I m... |
I am looking into the logic behind applications like Unity3d, that allow you to write code with JS, C# or Boo, and then compile in a common language (I believe it is plain C++), making the editor independent from a specific language. Allowing users to write code in either language (or all of them at once, in different ... |
I work for a software company that makes business information systems for a large enterprise. We do systems for invoicing, payment, planning, etc. The enterprise uses SAP for their core system, and our systems use SQL Server with PHP as the application layer.
So far we've always used XML files to communicate between SQ... |
I'm constantly trying to acquaint myself with different programming concepts, and I recently looked deeper into ranges.
In Haskell a range is basically a literal that expand to some kind of array.
In Ruby (and Python I guess) it is a completely different type.
My question: What are use cases for ranges except iterating... |
We are developing a Rest API for eCommerce website which will be consumed by mobile apps.
In the home page of an app we need to call multiple resources like Sliders, Top Brands, Best Selling Products, Trending Products etc.
Two options to make API calls:
Single Call:
www.example.com/api/GetAllInHome
Multiple Calls:
ww... |
I'm collaborating with a friend to, as a challenge, create a bot that can beat the best human players at a browser-based card / board game called Duelyst. It looks like this:
It was my original plan to build very basic machine learning from the ground up but he suggested we look into options in this list of JavaScript... |
Suppose, my application consists of many components, where users need to fill theirs information, something like this:
-Select city
`-Select library
`-Select book
`-... a lot of components like above
So, application has determined data flow, first user need to select city, then library, then book, etc.
The data f... |
In the simplest form, our (near future) project consists of a end user program, that directly connects to databases and apis.
This is obviously bad as then the end user program consists of sensitive data such as usernames and passwords.
How do I avoid this properly?
searching on the web seems to point to Remote Method ... |
When I want to design architecture of system in diagram, I usually take some architecture patterns and give them the system identity.
For example, a simple system for school management with Layer Pattern can be:
But MVC as architecture pattern dose not easily gets the system identity in diagrams.
I don't know how to ... |
A popular high level architecture choice in modern program is a REST-based microservices system. This has several advantages such as loose coupling, easy re-use, limited restriction on technologies that can be used, high scalability, etc.
But one of the problems I foresee in such an architecture is poor visibility int... |
I'm new to programming and I'm trying to develop a template of questions I can apply to business rules that will help me extract what's needed to begin coding.
Do programmers have a set of questions they ask themselves or any kind of template they use to assist in this process?
Example rule:
Business Rule 2:
There m... |
I've noticed that some languages like C, C++, Java, Perl, and .NET Visual Basic have "block" scoping which means that a variable will only be defined within the specific code block it was declared in.
For example (C++):
if (true) {
int x = 1;
}
std::cout << x << std::endl;
This code will fail to compile since x is... |
I have a model, the model has 2 strings; foo and bar.
foo is what it is, it will be one of x amount of possible values (it's not an enum, though).
bar is entered by the user, so I want to validate it. But I want the validation to be driven by foo, and I want to use Remote validation (to do it remotely).
My suggestion:
... |
I am working a project which involves back-end Restful API and single-page front-end app. I am wondering if the back-end API has to implement all sort of data validation logic , which is also to be implemented in the front end input forms?
|
Imagine the following git repository:
/
/ProductA/product_a_main.py
/ProductB/product_b_main.py
/SharedLibrary/shared_library.py
SharedLibrary is used by both ProductA and ProductB.
ProductA and ProductB have different release schedules.
Any advice on how to handle branching in this scenario? I imagine one model wou... |
Our colleague promotes writing unit tests as actually helping us to refine our design and refactor things, but I do not see how. If I am loading a CSV file and parse it, how is unit test (validating the values in the fields) gonna help me to verify my design? He mentioned coupling and modularity etc. but to me it does ... |
I need to write a service that reads data (a row) from a database, sends out AWS SQS messages, and finally deletes the data from the DB.
Let me explain using an example.
I have a database table D, the service S, and SQS queue Q.
Every minute, the service S, reads one row (R1) from D, parses it, and sends a SQS message ... |
I'm working on a library that can represent LED strips virtually. My main class, LEDStrip, is abstract and has a couple abstract methods, like getLength() and setColor(int index, Color c). This lets whoever implements the class focus on just a few simple methods and let the parent class do all of the processing (such a... |
Take for example, a simple web server in C's loop:
while(1)
{
/*accept connection that comes into server_socket and assign
its handle to client_socket*/
client_socket = accept(server_socket, NULL, NULL);
/*send data to the client thru the client_socket*/
send(client_socket, http_header, sizeof(ht... |
Recently I got interested in scheduling problems or rather dynamic scheduling problem. The problem is that I want to develop some kind of layer in my application which will be polling circa about 50-100 e-mail boxes on regular basis. I do not have any control on IMAP/POP3 servers, I cannot customize or modify them in a... |
I'm looking at the rewrite of an ASP.NET application, from website / dataset techology to MVC / EF. This question is about a particular function that I need to research. I'm so new to EF that I don't know where to start. This question is about where to start.
The current application acts on complex data objects which... |
I'm referring to the two types of react components - presentation component and container component. In a more platform-agnostic description, is the container component just an adapter for a presentation component and the rest of the system? Or is it an instance of some other pattern?
|
There is considerable cost (and pain) for developers to debug external libraries due to the fact that many libraries are distributed in two editions: one with debug information, other without. The developer has to search and download debug files, and point the debugging environment to their location. This is often a p... |
Using Three.js Revision 51 (Yes I know the latest is 84) I am getting a screen tear at random times on the load of my page. It seems like it's 50% whether it's a hard refresh or a fresh load of the page, it seems like it will have a 50% change to have this gaping black jagged shape in the middle of the object. But othe... |
I have a method that I need to test that has multiple cases that need to be tested, and each case requires a few lines of code to test. Before long the test function is 50 lines long and it is a bit difficult to find the failures. (No, this function is not able to be reasonably split into reasonably small and easily te... |
Node, Express, and MongoDB are really connected so I can understand why they are frequently used together. For a web app of medium complexity, can I get away with only using HTML/CSS and EJS for the front end? I don't really understand how AngularJS fits into the MEAN stack. Can someone elaborate?
|
I have many django projects witch looks the same: there are some Config models and some models user actions Results.
The task is to make a one point of Config models contol, keep the history of changes and have authorization (let's call this project Control UI). And I think django admin will be good for it and django-r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.