instruction stringlengths 34 36.1k |
|---|
RFC 2606 standard reserves the domain names example.org, example.net and example.com for the purpose of being used as examples in documentation.
What is an equivalent for a phone number (including country code) that can be used as an example, e.g. for giving users an example in what format to input phone numbers?
In th... |
I have a graph service where I use if/then/else statements.
class GraphService
{
function getGraphData(array $products)
{
foreach ($products as $products)
{
$gotPumpGraph = false;
$model = $product['model'];
$item = $product['model'];
if ($model ... |
We're building a search engine at a client's place. To evaluate the results, the client is comparing top N results of our search engine to top N results of a competitor. And they want me to get at least some "X" percent common results with competitor. And that's the only metric they're using to decide success of the pr... |
For example, suppose I have a ZipCode class:
public class ZipCode{
public value String value;
public boolean validateFormat(){
...
}
public otherMethod1(){
...
}
}
I found many classes uses ZipCode instances, but validateFormat() is used in one place only : register page:
public ... |
I have a business, selling online.
Now I'm updating my software portal.
My developer suggests using stripe instead of a bank account.
He knows it is better but he cannot explain why.
Some more details on my situation
My situation is - as always, when I sell stuff on internet I need to make clipping and pay my agents. ... |
I came across this Enum and Struct declarations in a project supposedly done by an expert.
The declarations / definitions are little different than what im used to so far.
enum EnumKeys {
KEY_MENU ,
KEY_EXIT ,
KEY_DOWN ,
KEY_UP ,
KEY_RIGHT ,
.
.
.
};
But nowhere in the code the actual Enum had been defined... |
I want to create an app where a user will go through a series of steps every day. All the subsequent step will depend on the previous ones, that is, 2 users can have different experiences depending on the choices they make every day in my app.
Something like
if .... then .... =>
..... if ... then =>
... |
I'm currently learning about TDD techniques, one of the suggestion is to test only public methods and skip the private ones. I have also been reading about Mocking. If I want to mock a certain method, then it needs to come from an interface or be marked as virtual. When I start developing my application I don't know wh... |
We have one microservice that will be deployed on two different environments(A and B). There are some common fields and also some are specific to the environment.
Example:
SomeEntity for environment A have only name and age and their validation.
SomeEntity for environment B have only dept and experience and their valid... |
My main goal is described here.
How can Microsoft Word or Wordpad or other word editing software render fonts when these fonts seems to not follow the same rules?
How do they render characters glyph based on adjacent(or sometimes even further neighboring) characters?
For example look at this font(it is free). opening ... |
I am trying to extract some core functionality out of my main application code, that doesn't change very often (e.g. logging, utils etc.).
Our current Situation:
A dev branch with all code in it.
A lot of release branches, that were branched from the dev branch
So what I though about:
Create a new Core-branch for m... |
Today we are using SQL server with multiple indexed views. Whenever we update the source tables for the view there is too long delay.
I have no experience with Spark, so the question is:
Can we input the data from the source tables, create the "data view" in spark and then only select the data we need from it? but stil... |
I'm migrating from Java to JS and I would like to know what is the best way to do it in the field of JS ecosystem.
After reading all the You Don't Know JS series by Kyle Simpson, I would like to learn: npm, grunt,gulp,lint, transpilers (babel), webpack and so on.
I don't have any experience in any of them and to be tr... |
I work for a company that is building a web application with ASP.NET & MVC, which was last worked on a few months ago. I am part of the team working on the project and have encountered values (such as place names) being hard-coded in the project's web.config file.
In my opinion this is bad practice as multiple develope... |
I am studying Onion Architeture but i got some doubts:
All the samples (github) I found over internet are too simple, or are implemented under DDD (which I have not studied at the moment) so I can not get a clear concept.
About Domain.Services I have some doubts:
It has to define implementations? For all Services int... |
I have a personal photo album application where I upload my photos. However, I'd now like to extend it with videos as well, and I'm unsure how to properly perform this extension.
The current design consists of 2 tables - Albums table that contains info about the albums (name, dateCreated, etc.) and Photos table, where ... |
lets say we have a "door api" and I want to create a resource to close the door.
I could do this in 3 ways:
traditional way using PUT with payload {id: XX, color: YY, closed: true}
advantages: simple and follows standard
disadvantages: client needs to edit the door instance by editing closed property and send the va... |
I have been working with Jira within an Agile scrum like methodology for a while now. What happens quite often is a ticket is estimated and started on. By the end of the sprint 95% of the work is done. What usually ends up happening is that this ticket is dragged over to the next release iteration to complete the 5%.
M... |
The scenario is:
client makes request to server A
Server A makes potentially multiple requests to server B. Edit to clarify, server A makes the requests concurrently using Futures.
Server A blocks until all results return
Server A collates responses into single response and returns to client
So currently the approa... |
Say i have a Rest API that has a POST and GET method.
If i want to overwrite a resource in the API i can call the GET method to get the original item and then call the POST method to replace that resource after i am done modifying it.
Should i add the update functionality to the client class like in the first approach ... |
I am part of a team that has recently moved from an SVN repository to a Git repository, and have started using GitFlow.
As I understand it, this means that in a perfect world, the minimum number of Git branches can be as few as two: master and develop. In practice, there'll be more, accounting for release and topic bra... |
I do understand this is a wild question and totally open-ended but just wanted to know that I am barking up the right tree.
I've inherited a large code base of many solutions and services, and whilst I'm learning to program in C#, ASP MVC and javascript have noticed a load of issues with the existing code.
I'm being e... |
I return to this question every couple of years, so now i decided to solve it once and for all, by asking here.
So, the sequence:
I'm writing a simple application that parses Json file (configuration to 3rd party app, further named as config) and allows user to do some editing with it. I've picked a platform, made som... |
To learn Javascript I am building a simple Single-Page Application. It is a basic slideshow app that needs only to process some basic settings and execute some behaviors. The basic structure of my code is thus:
var settings = { ... };
function initStartPage() { ... };
function initSlideshow() { ... };
function setting... |
I have a web app whose server creates a Client for each websocket connection. A Client acts as an intermediary between the websocket connection and a single instance of a Hub. The Hub maintains a set of registered clients and broadcasts messages to the clients. This works pretty well but the problem is that a client mi... |
I'm working on a C compiler for Linux for the purpose of personal curiosity/fun. How can I test the generated assembly before the compiler is complete enough to do anything useful?
For example, if I have the following program:
int a = 1;
and it compiles to
a:
.long 1
How can I be sure that this output is actually... |
I'm wondering if there is a name for the pattern of defining a generic class with one type argument where the type inherits the defining class.
For example
public class A<T> where T : A<T>
{
}
I'm not sure if there even is a name for this. Any help would be much appreciated, thanks.
|
I am doing a collaborative note editing app which uses a NoSQL database (Firebase) in server side. Each user can sign up using their phone number or email. Currently, the user object has only four values: user_id, user_name, user_email, user_phone.
Any user can create a note by including people from his contacts even i... |
I have a scraper service that looks for media online. For every source type,
there are two tables. A common source table and a source_type_media table that are related by source.id to source_type_media.source_id, this service will store raw information.
The scraper service will scrape at some frequency via a cron job... |
I am writing a driver for an IMU sensor using test driven development approach. Communication protocol of choice is SPI. Using CubeMX and STM32F415 processor, SPI interface is implemented in stm32f4xx_hal_spi.h file, which contains many and more function declarations. Note this SPI interface is processor-specific and I... |
I am trying to resolve a circular dependency between two components in my system. The Messenger component is responsible for sending and receiving messages on a web socket. The Controller component requires use of the Messenger component to be able to send messages to connected clients because the Messenger component k... |
We are developing an angular 5 application that must run in different environments (dev, qa, int, uat, prod), and connect to different APIs depending on the environment. We have traditionally have only 4 environments and we have a environment file for each with environment variables.
But now with the introduction of t... |
Let's say you have two microservices (contrived example):
Customers service
Dashboard service
In the customers service, you manage all aspects related to customers (address, preferences, whatever). In the dashboard application, there's a map you want to display showing all of the names of customers and their location... |
For example, it is common to see games with game loop and states:
stateChanged(){
switch(state){
STATE.PLAYER_SELECT_CHARACTER:
this.currentController=new PlayerSelectCharacterController();
break;
STATE.CHARACTER_MOVE:
this.currentController=new CharacterMoveController();
break;
}
... |
Refactoring an old API into a new one, because of several tools using it (admin and some mainteinance scripts) and compatibility with older versions reasons the database structure must remain the same.
I have a table user and another table user_optionals related 1:1. The user_optionals are just a bunch of fields with s... |
Our system was initially created around the client's ordering logic which is received by an API. This was allowed by the previous I.T. dept.
However over time (after growth) many different clients with differing systems send their order's to our API which have to be cleaned and changed into our working version, example... |
Or simply asked WHY ?
It simply does not seems logical ...
if ( null.asInstanceOf[String] == null ) println
("null.asIstanceOf[String] is null")
println ("BUT !!!")
if ( null.asInstanceOf[Double] == 0.0 ) println (
"null.AsInstanceOf[Double] is 0 !!" )
|
Some years ago, the w3c documented a proposal for a method called QUERY, where query information may be passed in as the request body rather than on the request line in query parameters. You can see this here: https://www.w3.org/2012/ldp/wiki/Proposal_for_HTTP_QUERY_Verb
My Question
I realize you can send any made up v... |
This is the most popular way (it seems to me) of checking if a value is in an array:
for (int x : array)
{
if (x == value)
return true;
}
return false;
However, in a book I’ve read many years ago by, probably, Wirth or Dijkstra, it was said that this style is better (when compared to a while-loop w... |
I took over 5 hours in sprint planning for a week long sprint. That seems like too much.
We discuss things in detail in sprint planning, as most of team members are not senior. If we don't it will lead to mistakes during implementation and redesign during sprint.
How do we deal with this?
How much detail should I discu... |
I am currently using Postman, Newman and Jenkins to automate the process of testing API end points.
The API is being written in Node.js and Express.js.
Currently the tests I write with Postman are being saved to a git repo, being fetched by Jenkins and run with Newman.
I now want to stream-line the process of creatin... |
I'm currently working on a project/product which consists of ~60 REST APIs and one client (Web app)
I find many downsides on this design, and not so many benefits, and I'd like to know if this is clearly a bad practice from an architectural standpoint or just bad execution. (And if it can be improved without changing t... |
Let's say we've got 3 entities here, User, Tag, Track and a single associative entity called Tagged.
I need to count a tag frequency of a track and the common way is to count the record of tagged, but what if I just store the tag's frequency as an integer attribute on Tag entity, and maintain the value every time ther... |
I have two screens:
A screen with a list of items, where every item in the list has "Show Details" and "Update buttons"
An item details screen. The "Show Details" button navigates to item details screen.
When clicking the "Update" button, it needs to take a decision based on item state and then navigate to either t... |
We know about using service workers in modern web sites.
Consider a scenario back-end as node.js and SQL Server.
Data is loaded from central database to local customer web app (DB is about 700 MB) and maybe each days update about 2 MB.
Can this situation handle via Service Worker or Browser Cache?
Which is the best... |
right now application is storing a file data in database and we are considering instead to store a link (http, ftp, etc) to the file and its checksum. We will only provide a service and the service consumer is supposed to provide the URI and its checksum.
As we do not want to store the file, we won't be able to calcula... |
Where exactly to put business logic. While everyone said put it in the aggregate.
Yes, But what if business logic need datas of multiples aggregate?
Or if business logic need to update multiple aggregates.
Does it acceptable to be in command handlers or need to be in saga? And Why?
My first approach
Room
ID
Capacity... |
I am working on an Android app, and trying to figure out which version I should target.
The current version is 28, so I figure that targeting any version of that minus 3 (ie >= 25) seems reasonable, but I'm wondering if there is any industry accepted guideline on this.
When the most recent version of Android is X, shou... |
In multi threaded java program, I initiate four concurrent threads with below details
1. Thread 1 writing file F1
2. Thread 2 writing file F2
3. Thread 3 reading file F3
4. Thread 4 reading file F4
Its an octa core processor, My question can four threads parallely read or write on hard disk or it will be sequent... |
I'm developing a node.js web server which will have built source code of server and client part at once. I mean, my web server is on the isomorphic level. this means editing source code of client part eventually give some effects on server-side code.
so when I've finished to develop (fixing bugs, etc.) my web server ap... |
Number of times this question comes to my and my team mind, should we persist or cache the data. I understand some time there is functional
requirement that we need to persist in DB. But in my case there is not any.
But here I mainly talking in context of scalability/performancewhich design is better. Lets take an exam... |
I use C++ on ESP-32. When registering a timer I have to do this:
timer_args.callback = reinterpret_cast<esp_timer_cb_t>(&SoundMixer::soundCallback);
timer_args.arg = this;
Here the timer calls soundCallback.
And the same thing when registering a task:
xTaskCreate(reinterpret_cast<TaskFunction_t>(&SoundProviderTask::ta... |
I have a windows service and a remote IIS server that need to communicate without any user interaction. As I can’t guarantee the two machines will be on the same network; the service will connect to the server’s public facing IP over the internet (so security is critical) and transmit encrypted binary back and forth. I... |
I have been a staunch advocate of never blocking on async code. I felt it was always better to use a synchronous API than to run the less efficient state machine generated by the compiler even if there is no chance of deadlock.
But in the specific case of System.Net.HttpClient with code that cannot go async all the way... |
I'm designing a system in which a key component acts like a "journal", in the sense that it stores a list of sequential events that can change the state of the entire system. Upon request, any other component in the system can ask this component for the full list of events that happened since event XXX.
One can think ... |
I'm currently working on a script (in PHP, but I'm not sure if that's relevant here) which allows users to set up a simple file-sharing system on their server. I'm stuck when trying to figure out how to deal with file downloads.
I see two possible approaches here:
1. Direct link to files on the server
Such as https://... |
My understanding of Micro-frontends is that the key problem they solve is in helping enterprises have multiple, possible disparate teams, work on individual components/small-apps that will be used to compose a large web application.
Here the key problem being solved is the ability of multiple teams to work independentl... |
The security of a TLS connection relies on trusting the CA's certificate, which in turn, is usually actually a proof of DNS entry ownership. Even though the server operator may request a certificate on its behalf, when server operator and domain owner distrust each other, domain owner wins.
SSL and TLS are usually asso... |
Good day everybody,
My capstone project partners are stumped with a logic question that has to do with JWT, MVC & web services.
We have already built a web app with a signup/signin feature using a MVC framework, but for our capstone we need to securely access data from a web service (we have not builded yet). We consid... |
Let's say you want to center the text here:
<div class="wrapper">
<div class="content">
<p class="body">
GUCCI GANG, GUCCI GANG, GUCCI GANG, GUCCI GANG, GUCCI GANG, GUCCI GANG
</p>
</div>
</div>
It doesn't make a difference whether you put text-align: center; on wrapper, content, or... |
In my workplace I am seeing an issue which I feel is wrong, but I am open to the idea that maybe the way I do it is wrong.
A minor example would be a class accepting configuration
//pull config from config file, then pass in to class
public class SomeClass()
{
public SomeClass(string connectionString, string someOth... |
Say I have a following class:
public class A {
public void execute() {
if (something)
ThirdPartyApi.method();
}
}
Now, I would like to test in particular the execute() method. I want to assure that all paths are covered and work as expected. However, the issue I would run into here, is not being abl... |
I need to build a few (2-3) different systems (frontends), they will have different uses and users, however the data for all those systems is in 1 DB.
example:
1st system is a customer facing site
2nd system is a customer facing mobile app (android and ios) (similar to the site but can have different views/data)
3rd s... |
Our software has two services - one which provides rest api used by client and one for computations. The computation is quite expansive and can take few hours or days in some cases.
There is only one instance of rest-api service and one instance of computation service. Rest-api service communicates directly with comput... |
We want to figured out, whats are the pros and cons, when you use a REST api vs querying directly to a database, if you have different client platforms (Web-Application, Android, iOS).
Edit:
I know that this question is very general and every developer has different opinions, but we only wan't to here some pros and co... |
Our frontend JavaScript / Vue code makes uses of a number of "internal" REST endpoints, which are implemented in Java using Jersey/jax-rs.
We have an "informal" specification that lists the different REST operations, and describes the "beans" that are passed in/out. On the java side, we have different bean classes, an... |
I'm looking at putting up a fan site for an author using code released under the AGPL. Under the AGPL, as I understand it, I would need to publish my code modifications. This is entirely fine.
However, the website is in django. I will probably be deploying with Docker, and forking the project to do so. If I want to aut... |
I'm working in a OOP language called Fantom, similar to Java, to create a workflow engine. My code sends emails to users, and it awaits for users to click a button within the email. In my current working code, I send the email, then I suspend the thread with something like Thread.sleep(1000), and check every few second... |
I am reviewing best practice with if statements. Below in example A I include the entire code to be run and ensure it remains within the if statement. While for example B the code to be executed resides outside the if statement.
From my understanding of Best practice on if/return, example A appears to be best practice.... |
In my understanding, a singleton design pattern is where we have only one instance of an object in a system.
I am not sure on this part of the definition, but I believe in an OS there is only one running kernel at the supervisor mode.
Thus, is it correct to say that an OS kernel is an example of a singleton?
|
My service has long running processes.
For example - user can signup, but if email not verified after 7 days, we send a reminder email.
I need my system test to cover this scenario as well.
Currently, I manipulate the data in the DB so the system thinks the user signed up a week ago.
But this makes my tests tightly... |
Please note that this is about a thread-safe LRU cache (not simply a LRU cache as specified in https://leetcode.com/problems/lru-cache/description/). It isn't a duplicate of LRU cache design question as there are some tricky aspects of Locking Hashtable/Linkedlist(LL) that aren't addressed in other multithreaded LRU de... |
I have a system in which user creates an entity. Now this entity has attributes which are dependent on many external systems. We have all those pipelines in backend which updates these entities when there is any change coming from external systems.
Now I want to inform user about these updates even when they are not l... |
I have some user defined custom fields corresponding to a ticket (A ticket is an entity which has subject, status and custom fields). I need to search tickets based on its custom field values.
A field can be a Decimal, String, Date or Boolean.
Example -
A ticket has subject, status and custom fields - product... |
Currently we have an application that, upon certain events, will send notifications to users. We use SQS to handle the actual delivery of the notifications.
As an example, when a user registers an account we will create a new push notification task (put onto an SQS queue) that will send them a push notification using O... |
How exactly should AddSomething methods in aggregate roots look like? Should I construct the objects in a call to the method, or should they be constructed inside the method?:
For example:
public void AddOrderItem(int productId, string productName, decimal unitPrice, decimal discount, string pictureUrl, int units = 1) ... |
So i heard that in modern operating systems and device drivers, some parts of them are still written in assembly for better memory optimisation and speed
but do developers actually write it in assembly or they just use a tool to convert their high level code into assembly?
considering that compilers even have code opt... |
Consider this an "academic" question. I have been wondering about about avoiding NULLs from time to time and this is an example where I can't come up with a satisfactory solution.
Let's assume I store measurements where on occasions the measurement is known to be impossible (or missing). I would like to store that "em... |
I have a mobile app and an API. The mobile app is set up to expect back a DTO from the API but has no information if an request was unsuccessful.
This needs to be updated so that better messaging is displayed to the user. I need to update the API and Mobile App so that I can send back a
DTO on a successful request or a... |
Suppose a SaaS product charges per project, whereby the first project you own is free. Ideally, users would open up a project and invite a few members to work on it. If more projects are needed, the same user within a team would open up another project which then is charged for.
With above restrictions, nothing would ... |
I am currently researching the benefits and disadvantages of SPA (Single-Page Applications) vs MPA (Multi-Page Applications).
Having established that MPA is more suitable for my project, I proceeded to discuss Server-Side Rendering vs Client-Side Rendering.
But as I was doing that, I noticed that a lot of benefits, arg... |
I am building an app that uses a client and a project entity.
The clients can extend their profile over various screens in their account, like status, settings, etc. These data sets are saved in seperate database tables by a WordPress plugin.
Now I need a way to display these user related data sets in the frontend.
So ... |
I have read several post about how to give credit in open source projects, but none that target my question.
I have been working on an open source project for about a year now, and one of my latest editions has something that hasn't been implemented fully in any language (to my knowledge...). An author from a very popu... |
In what seems like a deliberate design decision, C++ does not have a null value for objects and references. This makes using objects and references very elegant since we don't have to perform null checks. It also means constructors must always return an object:
void main () {
// o is guaranteed to be non-null by c+... |
All,
Question: Should I have a common data access API between various cross platform applications or keep the data access specific to the UI even though it would result in duplication?
Background: I’ve been developing various applications many with sub applications to interact with various pieces of our internal servi... |
In our automated Java tests, we sometimes encounter issues, such as:
Test A creates a custom file A.sh, that is then added on classpath
Automated testsuite cleanup does not know about random file A.sh, and does not clean it
Test Z fails because it so happens that A.sh has no influence on all other tests but causes fa... |
I work for an ecommerce site and we are looking to expose much of our core functionality via a set of APIs. We plan on re-writing some of our own public facing websites (e.g. the main shop website) to call these new APIs also. Currently a lot of the core code is found directly in the main web app (making it difficult t... |
Can you do everything that CSS Grid or Flex box does with properties such as display, float, margin, position, overflow, etc ?
Edit: See my comment with @PeeyushKushwaha
|
I would like to express a task as either itself or a container for other tasks (recursively). The problem is that each task has to be one of two fundamental types: a goal or a routine. And, children tasks must be of their parent's type. So, each root level task has a type, but no child has a type (it uses its topmost p... |
I have a method that inserts into the Android Calendar an event. You can see a simplified snippet in two steps: 1)declare the variables 2) I put them into a kind of array that in the end will insert it into the calendar, and it works flawlessy:
private void InsertCalendarEvent() {
//1)here I declare the var... |
I have a multi-seller ecommerce platform, derived out of Opencart 2.3. We changed quite a bit of the core code of the Opencart to add our own customizations, including features such as Seller Dashboard (where a seller can check orders, generated invoices for them, etc etc). Repetition of code and lack of basic OOPs pri... |
I have a quick question.
Imagine this scenario:
There is a webapp in server X. There is also another component (file) in server Y.
In the webapp, starting, it does:
<script src="component from server Y">
Should I place the component from server Y in the server Y, or inside the WebApp component, in the Deployment diagr... |
Lets have an application that has real-time chat feature.
The chat requires websockets in order to function real-time.
Now imagine we have "balancer" and 3 application servers. Instance of application run on every server.
The balancer delegates request to 1 of these 3 servers, for example based on traffic.
My question ... |
When working within a single project that contains multiple namespaces, should these namespaces be treated as boundaries? Or is it acceptable that any namespace can access any other namespace?
For example, say I have the following namespaces in a project called Physics
Physics.Models
Physics.Math
Say in this case tha... |
I am developing an asp.net mvc solution, which contains the three layers:
Data Access Layer
Business Layer
Entity Layer
Each layer is a project.
I have developed the controllers and views, but no Models. Instead of using Model, I am using the Entity layer as Model.
My question is: Is this still an MVC project?
I atta... |
I have been tasked with designing a class library that I am loathe to actually build. It is basically a huge backdoor to our software security. The idea was that it would only be accessible from one terminal on a closed system. I plan to lock my code with a password, but is there a way to make sure that my library bina... |
At work, we have an application that is run directly on dev machines, but deployed in Docker swarms (a QA swarm and production swarm). The code and CI/CD pipelines are all in GitLab CE.
It uses several private, internal NPM packages. We refer to these packages in the package.json like so:
"@project/utils": "git@gitlab.... |
Context: design with correlated polymorphic classes
For example, let's consider the following class definitions for representing messages that we would get from some remote service:
class ImageMessage : IMediaMessage
class VideoMessage : IMediaMessage
class DocumentMessage : IMediaMessage
The messages would arrive in ... |
Often software sites would offer signatures and checksum for integrity check after software download. How crucial is checksum(e.g md5) verification process and what other sort of security does or can these process offer?
|
I'm new in development & just developing an e-commerce platform. I'm just confuse about the flow of payment. Suppose I have a checkout page where after logged in user has to press the payment button and it will take him to Instamojo payment processor's page and the after successfully making the payment they will be re... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.