instruction stringlengths 34 36.1k |
|---|
We cannot serialize registrations as there are millions of users registering at the same time. Parallel registrations need to happen.
Let's say the database doesn't contain username 'user1'. When two users try to register at the same moment with 'user1' it'll accept it. But it will later cause problems. This shouldn't ... |
I'm looking at building out the architecture for the following, and wanted to see what others think about it.
Assume that the system is running some non-trivial algorithm (so it's not simply a sum of something etc.) on the data collected on each user. Some users will have 10 rows of data, some will have tens of thousa... |
When I read about unittests I keep reading that I shouldn't rely on external resources, but in some cases I would like to test reading in Excel files so I can be confident this portion of my code is working.
For instance if I'm using pandas I might want to unittest that Excel files are being read with no errors.
import... |
I am trying to implement CI for one of my projects that generates a NuGet package which is published to our private NuGet repository. Obviously, for dependent applications to see the new packages as upgrades, they must have higher version numbers. To achieve this, we are letting MS Build append the build number to th... |
I was trying to understand structure padding , so i wrote a simple program as written below and i executed it .
just to make clear i made two copy of this program program1.c and program2.c and executed both together to see the member address
but something strange came up
Both program giving me same result , as like h... |
I have a process loading a UI provider via dll and another system resource that provides functionality which I forward to the UI via callbacks.
In some cases, the underlying resource faults while the (MFC) UI is showing.
I'm in a discussion with with the person in charge with the UI about the appropriate way to shut do... |
The syntactic sugar provided by extension methods can be addictive.
Take for example
public void TagNode(SiteMapNode childNode, string url, string title)
{
//do stuff
}
vs
public static void Tag(this SiteMapNode source, string url, string title)
{
//do stuff
}
and the usage:
TagNode(myNode, myUrl, myTitle);
vs
m... |
Excuse my ignorance, I come from the C family of languages but zero exposure to functional languages. I've read that pure functions only generate output based on a given input. Same input gives the same output regardless of other conditions. But something bothers me.
A simple case would be array.filter which takes in a... |
New to the field of QA, I've been asked to do SQA for a project that I'm unfamiliar with and that is close to completion. An example of a specific functional task to be tested looks like the following:
51: Rename Excluded Words at the Topic and Subtopic levels to be Not in Topic and Not in SubTopic
I could see how if... |
You can already ask a spoken question and receive a (synthesized-)voice answer. So what kind of re-design/re-factoring/whatever would be required to take a fork of that code and modify it for fact-checking?
In the current "Conversations in the Digital Age" http://www.digitalage.org/ interview with Deborah Norville rega... |
Traditional programming could be done quite readable. Like this:
FUNCTION do_HTTP_request(url) {
if(!ask_user_if_he_wants_to_connect()) return;
if(!network_is_enabled()){
enable_network();
}
var content = download(url);
// … do something with ‘content’
}
However, nowerdays frameworks are ri... |
I have a project and I follow Repository and UoW patterns. I also have a "service" layer which I also use as my BL layer.
Taking for example a Customer domain model, I might have information that I need to retrieve along with the customer, so in the customer repository class I have the following methods:
public Custom... |
I create page to import records so users can import records using a CSV file.
I am already using Sanitization to remove unexpected characters for specific field of the record, Do I have to validate each record in csv file before insert it into Database then display the errors to user or just using sanitization only cau... |
My employer still uses VisualSourceSafe6. Everything is checked-in into the main project directory in VSS. They are not using branching in VSS. Check-in's are supposed to be ready for release to QA and should not break the build (not enforced).
I want to use git as my local repository so I can track changes per feature... |
I apply comet long polling which uses usleep inside while loop until no new data returned by server like below:
PHP
while ($currentmodif <= $lastmodif)
{
usleep(10000); // sleep 10ms to unload the CPU
clearstatcache();
$currentmodif = filemtime($filename);
}
My aja... |
Most of the underlying workings of the operating system is hidden from the programmer. I believe that is also one of the purposes of an operating system. Then what are the reasons a software developer should learn about how operating systems work?
|
I have a situation where I want to call a function which requires a number of parameters. This function is not called directly, it is called indirectly and the parameters are delegated several times. Some extra parameters may be added in between the different layers, but those aren't included in the example for the sak... |
I'm the sole developer on a project that, like for any software project, may be taken by somebody else in the future.
Let's say I used the pattern X to implement feature A. After developing and finishing the feature, I realize I could implement the same feature using pattern Y, which I just learned about. But feature A... |
While trying to figure out the optimal ordering for optional parameters to a function recently, I stumbled across this blog post and accompanying GitHub repo, which provides a header for a Pythonic kwargs-like facility in C++. Though I didn't end up using it, I find myself wondering whether this is a good or not in a s... |
I have a question related to cqrs + event sourcing. I have two aggregate roots (AR1 and AR2). When AR1 received a command/event it will be recreated from previous event sourcing stream from repository (in this case it will have list of some values x,y,z) and after updating internal state to (a,b,c,x,y,z) it will emit n... |
Can anyone explain what exactly Microsoft means on the below linked page when it says:
"Do not catch an exception unless you can handle it and leave the application in a known state."
https://msdn.microsoft.com/en-us/library/ms173160.aspx
|
Every time I have used the InternalsVisibleToAttribute when developing an API, it feels a bit smelly. Like the API is not being designed in a truly encapsulated way. A lot of the times this is out of time constraints - exposing the internal functionality in an elegant, encapsulated way takes time, and a lot of times on... |
In the recursion section of K&R's ANSI C book, they demonstrate a
version of quicksort [that] is not the fastest possible, but it's one of the simplest.
--The C Programming Language (ANSI C) - pg. 87
In its entirety:
/*qsort: sort v[left]...v[right] into increasing order*/
void qsort(int v[], int left, int right){
... |
If some fields are required when inserting data, should I check if null when retrieving them (suppose I need to do something with this fields that may throw exception if null), or I shouldn't unless I changed my system and started to accept null for these fields ?
|
I had a discussion with one of our senior developers who's been in the business for 20 years. He's pretty well known in Ontario for a blog he writes.
The strange thing is what he told me: he said that there is a piece of code that is a nightmare to work with because it was written from a textbook, and doesn't account f... |
I work with monolith web application written in PHP that is being migrated step-by-step into microservices. I would like to keep the same UI with several new features that have been implemented during the migration. Currently, new elements of the app are written in Angular and they communicate with microservices' via R... |
We currently have over 300 web projects that are legacy code, that is kind of spaghetti like based on a modified version of an old framework.
Our one developer that knows these systems best is leaving and I'm the replacement, what are the best questions to ask before they leave? I want to make sure I can support all th... |
This might be a silly question... from somebody looking to make his programming more structured/less chaotic.
I would like to develop an application (web and mobile) just for fun/for myself. Before starting writing any code I would like to describe (in words) what the application is going to do and how it is going to l... |
I use Gulp to generate minified CSS from my SASS code for a project I'm working on.
I wondered whether it's considered best practice to regenerate this minified CSS when pushing live from Git...
or
To store the minified CSS files in Git so they are automatically pushed live to production without further work on the ser... |
There's an internal research and development application that has developed use cases based on our own vision for the product.
We are starting to get feedback from prospective clients from different industries to which this application could apply.
This application has working backend and frontend components. Both the ... |
I interviewed for a job at an ecommerce company a few years ago, didn't get the job, with most of the (stated) reasons being related to my having no experience working with an ecommerce company (I worked for a payment systems company at the time).
There is an interesting job with a different ecommerce company bei... |
I'm writing C# applications that store their data in MS Access databases, (I'd rather use a different type of database but currently have no other option). The applications are in use by multiple people at a time and so when there are multiple connection attempts (or someone mistakenly opens a table), some of them fail... |
I am new in DDD and my understansing of the repository pattern is that it acts like a collection of aggregate roots where you can add, delete, update,etc a certain aggregate root.
My question is, where code that performs aggregate functions (count, group by, sum, etc), should be placed, since it does not return or ope... |
My team is faced with a big challenge. We are building a greenfield app against a legacy codebase. The legacy code contains .NET controls with a certain look and feel. Our front end is ReactJS. We are tasked with reproducing the look and feel of these legacy controls. The designer is tasked with creating Mockups, ... |
I know how to parse normal JSON objects using the org.json library, but I am confused as how I would parse this one as it has no array/object names.
[
{
"value1": null,
"value2": null,
"value3": "example"
}
]
|
In the context of web development, who designs databases? Despite a whole host of information associating back-end web dev with server-side processing, data modeling, and the like, the database design aspect of the equation seems to be mysteriously absent.
I am not talking about who sets up the physical database, I'm r... |
I want to create generic response codes, for an API that I am developing. Now I know there are HTTP response codes that are usually recommended to be used, but my API will be handling multiple USSD gateway responses.
So a generalized mapping of response codes within API will highly be useful. After brief Googling I di... |
99% of software comes in different versions. And quite often developers like naming versions. Example - Android versions:
Froyo
Gingerbread
Ice Cream Sandwich
etc..
It really bothers me because it makes me remember which version is old, which one is new - I cannot tell it from the name. I know, I know: Android follow... |
Several RFCs use the term 'HTTP protocol' (example). However, the acronym 'HTTP' already includes the word 'protocol' in it. Hence, isn't it redundant (and hence incorrect) to use 'HTTP protocol', whereas the correct usage would be simply 'HTTP'?
Why do RFCs make such usage?
|
I started to work on several C projects that are building using gcc. I believe this choice was made for several reasons:
Had to cross-compile for arm very early on (I think).
Performance is the first and foremost spec.
gcc was and is still the easy first choice.
I have no reason to contest that choice and I am not in... |
We have a cart and cart has line items, now line items can be products, discount coupons, rewards and promotions. I am looking for some inputs in design consideration here. The backend is in Ruby on Rails.
for products I have already designed the URL to be
post: cart/line_items to create a line item for product
put: c... |
Accessors and modifiers (aka setters and getters) are useful for three main reasons:
They restrict access to the variables.
For example, a variable could be accessed, but not modified.
They validate the parameters.
They may cause some side effects.
Universities, online courses, tutorials, blog articles, and code e... |
I have recently left my previous student job as a part time developer for at small ERP management firm.
During my time at the firm i have developed several modules for integration with the ERP system. Furthermore i have developed an application, and a backend for said application.
I have been asked to document the co... |
I have found several documents about statement and decision/branch coverage in testing, but these terms aren't clear for me.
There are two types of this problems, that you can see below.
Code:
if(a || b)) {
test1 = true;
}
else {
if(c) {
test2 = true
}
}
}
Text:
Consider th... |
On stackoverflow I asked, what is the preferred way to expose custom STL-style iteration?. The answer seems to be to implement twelve functions: six members, six non-members (perhaps using some macros to assist).
In C#, I can do about the same with just a single function using yield return; C++ is great, but it's thin... |
There's a common interview question that will be some variety of the Parking Lot simulation- the gist of which is you have a parking lot with parking spots of varying sizes (small, medium, large) and cars of varying sizes (small, medium, large), and it's your job to simulate inserting a car into the lot, and removing a... |
What is the advantage of using pull requests instead of simply merging a branch into master without one? Particularly on a team where all developers have full access to master.
|
I am mobile developer and always have one particular fight with my web-service/backend developer which believe in designing restful api.
Issue: As per Restful design,every api should be atomic in nature,but this create alot of problems to clients especially mobile based. Since to perform any operation like opening of ... |
I am writing a function that operates slightly different depending on the data passed in. The common and unique code is mingled. I don't like what I have and am looking for a better way. Hopefully, this case demonstrates the situation. Consider that each print line below is just a proxy for one or more lines of mor... |
I am building a digital marketplace app. I would like to know what the best practice design patterns are for the backend (No SQL) object store.
The primary characteristics of the app are as follows:
The app presents users with a series of editable lists (with CRUD functionality: create, read, update, delete).
There is... |
We have one feature in our REST API which could have a reason to be shutdown temporarily, or permanently. Let's say the resource is:
www.myapp.com/api/v1/needs_shutdown
Right now, /needs_shutdown is a GET request that returns data. We want to make returning data happen only if the service is marked as active in our con... |
Nand is known as a 'universal' logic gate, because it allows you define all other boolean logic gates:
not(x) = nand(x,x)
and(x, y) = not(nand(x, y))
or(x, y) = nand(not(x), not(y))
nor(x, y) = not(or(x, y))
xor(x, y) = nand(nand(a, nand(a, b)), nand(b, nand(a, b)))
This is known as nand-logic, and is commonly used in... |
I understands that most of the recent browsers use JIT compilation to execute javascript. What I do not understand is: which part of javascript is JIT'ed - the script, or the bytecode?
Let me explain. From what I understand, V8 takes your JS and compiles it into machine language (not bytecode) with output being placed ... |
I have a Python library licensed under the BSD 2-Clause License. This library was created by another person, who, I think, basically stopped maintaining it. For this reason, I want to pick it up and put it on Github, so that I can eventually promote its maintenance.
Can software licensed under the "BSD 2-Clause" licens... |
When tracking something like pricing history, in my relational database, what is a recommended way to store pricing changes? For example I can:
keep price change events only (aka a single date indicating new price was entered). One date per one price history record. aka price_change_date
or
keep effective_price_... |
I have one simple question I don't understand: Why are transistors so widely used in microprocessors and complex in some manners(semiconductors, Fermi level, PN junction, etc.),while logical gates are used too but not in such huge number as transistors, while logical gates are far more simpler (for me) in use of zeros ... |
What is the preferred method of creating a "normal" traditional installer for a .NET WinForms application? I'm using VS 2015 which comes without a template for such a deployment project. I installed it as a separate extension and everything is actually alive more or less, building the .msi which even works fine.
But f... |
I've been given some Java code to look at, which simulates a car race, of which includes an implementation of a basic state machine. This is not a classical computer science state machine, but merely an object that can have multiple states, and can switch between its states based on a series of calculations.
To describ... |
Say for instance I develop a program that links with GPL2/3 code statically or dynamically which is installed on an embedded device such as the raspberry pi as part of a larger system, is there any language in the GPL licence which dictates how this should be handled?
The program won't be directly accessible to the end... |
If a project has 30% coverage by unit tests, 40% due to integration tests, is it fair to say the total is 70% as so moderately well covered?
Or are unit tests only ever used as the standard test type for code coverage metrics?
Coverage is tracked via a continuous integration server.
|
Here is WPF application consisting from 3 UserControls:
UserControl3 is a part of UserControl2 content. I keep MVVM during developing and using Prism.
I need to invoke custom class method (which is model in terms of MVVM) in UserControl3 from view-model of UserControl1. The restriction that service in UserControl3 can... |
It is (was?) considered best practices when it come to web programming to let the database do the 'heavy lifting', when possible. For example, I have a contact list, and it consists of many emails addresses and name. Each email must be unique, so one potentially bad solution for an active record model (Eloquent) is thi... |
I am a relatively new user to the Visual Studio Team Services (VSTS) platform and I wondered if it is possible to pull a list of methods/classes/functions etc. I have created from the projects within my account.
The best answer I have found so far seems to be this:
https://writeabout.net/2016/06/17/get-a-list-of-all-re... |
I have been asked to implement refreshing a token. A token ID is the same as a session ID. I have considered resetting the session's idle time to 0 and continue using the same session ID for the session.
Does this violate security best practice? Is it security best practice to return a new token ID in this case to prev... |
A team member and I are having a disagreement on the usage of the <article> tag. By the definition in MDN, to me, it sounds like it should be used when presenting the user with content of some kind. He is saying we should be using it in a data entry page (no blocks of content are presented to the user). Pages like crea... |
Say I have a User resource which must always be attached to another type of resource, a Business.
When creating a new User, is it OK to have the POST endpoint use a query parameter to specify the Business to use?
For example:
POST /users?business=123
{"firstName": "John", "lastName": "Smith"}
|
I have two sites and an API that sends data back and forth between the two. The API is only used on the back end, and the user will not interact with it at all. What I would like to do is ensure that any requests made to this API (on either site) came from the other site and no where else.
Right now I have an API key s... |
If we have a 2d grid (e.g. points at every (x,y) such that x and y are integers) and a closed path on this grid, such that a point on the path (x,y) could only be followed by a point in [(x+1,y), (x-1,y), (x,y+1), (x,y-1)], what is the most efficient way to find the squares enclosed by this path?
Edit: this isn't a hom... |
From the Agile Manifesto:
We follow these principles:
Welcome changing requirements, even late in
development. Agile processes harness change for
the customer's competitive advantage.
I have a requirement where we are doing cross database joins with multiple partner teams in many different data sources. Some are trad... |
I do system integration for critical and time sensitive systems. We have two standard ways we can build these system integrations. One is a simple (and cheap) email ingestion tool built into our platform and the other is a very customized (expensive) standalone HTTPS Restful API integration.
How do I nicely explain to... |
After reading this question Reasons NOT to use email for system integration
I want to ask the opposite question.
What is email ingestion?
When it is OK to use it for process or system integration?
|
I have an API which allows me to communication with a device.
The communication protocol is stored in a JSON file. It list the events that the device can raise, the functions, the frames format, etc.
But this JSON file changes often, and i need to keep my API backward compatible with all the JSON files.
I imagined som... |
We have a system that publishes requests for processing into a database table. We also have a scheduled task that runs every minute and looks for pending requests in that table. If a request is found, the task processes it, marks it as complete, then picks up the next pending request, if any, and so on. If there are no... |
A simple question as to whether or not this would be a proper way to combine logical statements for readability and organization purposes.
The 'standard' way I was taught to write code:
txtbox_vendor.Visible = false;
txtbox_vendor.Enabled = false;
txtbox_vendorCity.Visible = false;
txtbox_vendorCity.Enabled = false;
tx... |
I have several tables: product, category, addon in various relational relationships.
I structured it this way because: I have many products that belong to their own specific category. For each category there are specific addons.
Price Table
What I want to do is to add a pricing table that I will be able to query to... |
Im in my first week of college majoring in computer science. Can java source code be directly executed by JVM?
|
I'm doing SQA work for several Kendo-based sites that have many tables (some are hand-made by our devs). These tables have a lot of rows, columns, pages, and data filled in them- so I'm basically doing SQA on very dynamic content.
I'm trying to make automated scripts to make sure features like add a row or edit a row... |
I have read some of the related questions regarding how we can refactor a code based on if/else if statements to follow closely the OOP principles but I have difficulties to apply this to a concrete use-case.
I have the following base class:
public class Human
{
public bool IsMother { get; set; }
... |
We have been hearing the concept of 'vertical slicing' a lot lately. I think we have been doing a better job of creating smaller, more well-defined stories. When I was searching for info on vertical slicing, no one has been defining how large their systems were. For example, I saw one where Adobe contracted with mou... |
I want my mobile app to connect to my website to get/post data from and to the database, respectively.
I was looking up RESTful APIs (which I don't really understand how the file writing and retrieving gets data from the database), but another method I was thinking was to do the following. Make my app use normal HTTP R... |
Let's say I have 2 micro-services. One is identity and another is support.
I understand when user is created inside identity ms, event will be published and support micro-service will subscribe to that event and copy portion of data which is needed for support context.
Now let's assume the opposite scenario. We are cre... |
I have recently caught the 'Toy Language' bug, and have been experimenting with various simple tokenizer configurations. The most recent one, makes use of the boost.regex library to identify and get the value of tokens. It seems to me that regex would be the preferred way to go, when creating a tokenizer. My research ... |
I'm currently being asked to look at a project that has finished core development five months ago, but still has a high level of defects. What transpires is for around every 10 defects fixed, we raise at least 4 and in some cases 8 defects.
I believe coding practice at the vendor is poor and there is general agreement ... |
Is having user-type per micro-service good approach?
Example:
Users in identity management context can have one of predefined user_types:
affiliate_user
b2b_user
accomodation_owner
agent
admin
But looking from the perspective of support bounded context, it cares only about agents (people who are answering tickets), a... |
Most examples I find of creating an arithmetic expression parser with ANTLR have them put almost everything in the grammar file.
I however need to parse the expression without putting everything in the .g4 file.
grammar Mau;
program
: statement*
;
statement
:( moduleDeclaration
| whileStatement
... |
I am thinking about putting some files into a larger git respository but I have a feeling that git isn't going to be suitable.
This is what I would put into the repo:
Various scripts on servers.
Some larger projects in var/www.
Some larger projects elsewhere.
All of these programs at some point talk to each other and... |
What we have
A complex tree model stored across multiple XML files
Java model classes which represent the XML model
All classes as POJOs
All classes annotated with jaxb
jaxb to read the XML files
A tree of handler classes
each handler is responsible for handling a layer inside the model tree or specific elements
... |
Please have a look at this code snippet:
template<int N> class Foo {
public:
int f() { return N; }
int g() { return 0; }
};
Foo<3> a;
Foo<4> b;
I think it's compiler dependent, but, in general, will two different instances of g() be generated for a and for b or will the compiler recognize that it does not dep... |
I have a hybrid web app for android. The webpage or website the app shows is in asp.net. The javascript for the webpage running in the webview of the app is sending out an ajax request every 10 seconds to an asp.net page which queries a database server for refreshed data and returns the needed values as a result of the... |
I am reading about socket programming and got to know that ip is assigned to socket with bind() call before connection to server.Is my thinking of binding address means to bind any ip address correct.
|
Let's say I have two web applications that are independent of each other.
App1 is written in Python and
App2 is written in Java.
After some logic is done in App1 by normal user, App1 needs to create a realm which can only be done by admin in App2.
curl -H "Content-Type: application/json" \
-H "Token: admintokenbla... |
I'm building a Web API that interfaces SharePoint (an external web service). To get at connection to the external service I need to create instances of ClientContext with some kind of token.
For this I have created an interface called IClientContextFactory:
interface IClientContextFactory
{
Create ClientContext(str... |
The C/C++ language family apparently has multithreaded compiler implementations that work on file level parallelism, but the Microsoft C# compiler (csc.exe) is single-threaded only. MSBuild supports multithreaded building, but only at the project level, and obviously dependency projects have to be compiled before the ... |
Below is some Java code that I am having a problem with:
import java.util.HashMap;
import java.util.ArrayList;
public class MyTestClass {
public static void main(String[] args) {
HashMap<String, ArrayList<String>> myHashMap = new HashMap<String, ArrayList<String>>();
ArrayList<String> catList = new ArrayLis... |
It seems that the standard practice is to immediately alias MailboxProcessor<'T> to Agent<'T>. So why the name in the first place anyways? Why don't they just call it Agent<'T>, if there's no name conflict to begin with? It sounds like something to do with receiving emails to be honest. I couldn't find any information ... |
I've had several tasks where I'm to do functional testing (and to be writing automated test scripts) on features that are not actually complete.
For example, CRUD testing on a project to make sure the user can create, read, update, and delete items. As I begin the create process, I type in all of the fields and hit a ... |
The company I work at uses stored procedures (and a home-grown ORM) exclusively for all database interaction, selects, updates, deletes.
We have numerous procs that will insert and/or update and/or delete from tables.
When it's required to "transactionalize" an entire proc, then we obviously needed to have our commit a... |
In Visual Studio Color Theme Editor extension if you change some colors, some other related colors will change accordingly. They can become equal to the changed color or be more lighter/darker for example.
I wondered how can this behavior be implemented as generalized as possible. So, I came up with this crazy solutio... |
I've been researching this topic for days, but can't really find any solid reference surrounding this topic..
The idea is providing social login for mobile client apps. That's it. Sharing, accessing user's data, and other social features are not required.
Personally, I'd imagine (especially for cross platform games) th... |
I am a beginner programming in Java. And when confronted with a new task I wonder whether I should code the function or search for it.
For example, if I want to calculate 10!, or cos A, I reckon that there will be a math function somewhere, and I am better off searching for it instead of trying to code the function.
B... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.