instruction
stringlengths
34
36.1k
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...
I'm a beginner and I'm following a course on C programming. In my book,a variable is defined as a memory space that stores a single unit of data (datum). Is a data structure considered to be a single unit of data (datum)? Ex: struct Point single_point;
I am not sure what the correct terminology is as I have not seen this topic discussed in any articles. Often to call an API one must find the number of parameters from another API/service etc. My question is from the point of view ofthe Web Service/API user, what is the chain of API/Services to be called so that when w...
The Problem A problem I keep running into again and again in C# is how to treat a class of things as the same in some contexts, but as different in different contexts. I have found some ways of handling this that I'm satisfied with for now, but this particular case I'm facing is leaving me unsatisfied. I'm sure that de...
We want a new hire to work on some features of our current project, however, since he is a new hire, we would like to do code review before he can commit into master branch. Also, we don't want his changes which is rejected by our code review and get into the history. What would be the ideal git workflow for this? (I ...
Sorry for this question seems naive. I am new to MVC model (I know I am a bit late to join the club), and I have a question regarding MVC with PHP. I think the implementation language doesn't really matter but I intended to specify it in order to make it clear that I use web applications. I am planning to use Entity cl...
I will soon install wooden parquet floor in my home. And just for fun, I am thinking of writing an algorithm for making efficient use of the wooden planks I have. Here's the problem: I have planks of different lengths enough to cover the surface. The room is rectangular (Later I would like to expand algorithm to take ...
Looking at the w3 spec for FormData there seems to be very very little there. Certainly very little compared with the MDN documentation. Of most concern, there is nothing here that defines constructor behavior beyond that it must return an instance of FormData. Am I reading this incorrectly, or is the constructor behav...
I am writing a cross platform socket library and will use the pimpl idiom so that users include'ing headers for the library will not need to worry about operating system specific issues. So, for example a file portable.hpp would be like this: // forward declare pimpl struct socketimpl; class portable { public: priva...
I follow this example on decorator patterns to implement objects who's functionality can be dynamically be coupled together. Namely: class I: is the interface class, common to both "core" class and "decorator base" class class A: is the "core functionality class" class D: is the "decorator base" class classes X,Y,Z: in...
I am attempting to implement a shunting-yard algorithm for a calculator following the rules laid out in https://en.wikipedia.org/wiki/Shunting-yard_algorithm . When programming the unary minus, however, I do not know which precedence method to follow due to the ideas raised in following question https://math.stackexcha...
To some extent, I don't have a problem with JPA which inevitably needs an implementation such as Hibernate. However, it requires configuration and ORM. I don't specifically like using Hibernate directly, based on the fact that it is a vendor specific approach. Nonetheless, I've been preferring the usage of JDBC, and I ...
I have written some small HTTP services myself and the clients that consumed them. There's a question on CodeReview in the hot questions about a wrapper for some RESTful API which made me wonder, should one ever write such wrappers "by hand"? My workflow was usually: Write server side code Test it or, to be honest, tr...
When completing online forms, many online applications will instruct users how to format their input, detect whether the input is formatted correctly, and issue error messages if it's entered "wrong" forcing the user to make corrections or (worse) start over. Examples: credit cards, "don't enter spaces"; phone numbers ...
I am putting together an web app with relatively complex but standard database relationships. I notice that anytime I use an ORM, in python/ruby/php etc, in general, a lot of queries are generated. This is stating the obvious. ORM's typically create more queries than necessary to get the job done. They aren't perfect....
Is it a good practice to declare all the variables in my program as a const variable? eg:- private int myAge = 20; private const int Age = 20; Now, from the above example, which one is a good practice for declaring variables. Is declaring const proved to be more effective in coding than just declaring a variabl...
I'm currently reading "Working Effectively with Legacy Code" by Michael Feathers. So far, a lot of techniques the book mentions, start with a problem similar to: "it's really difficult / it would take too long to get the class into a test harness..." Then the book goes on to suggest a technique to work-around this prob...
I guess the question is about PC based (Windows, Non-Macintosh) processor Architecture Design and open use. Is there a "Standard Interface" (byte-code) for PC machines, aside from processor specific optimizations, available to the public and can be used for (General) Custom Kernel Designs and Operations and OS Develop...
From what I understand first you need to find the dominant colors in the images and store them inside a database. There's a script called "color thief" that does that beautifully. But chances are all the colors will be different! The color search form can't display all of them. Google search only allows you to pick fro...
I'm a web programmer with several years of experience in RoR and node.js. I have a project idea that is quite big and I need some input in how it can be achieved. I heard of the Diaspora project, and how it is de-centralised. In a way, which I don't really get, anyone can setup an instance of the app and connect it to ...
We have three levels of code in our big and complex Web site: plain SQL (in fact Perl DBI), a primitive ORM (we wrote our own primitive ORM, because DBIx::Class appeared too slow in our environment), business objects (high level interface to the database, grouped by topics (not by tables and fields)). (well fourth, sp...
In the C programming language (and many subsequent languages that either directly interfaced with or built a facsimile of the C's Standard IO functions), there exists a function called ungetc: int ungetc(int char, FILE *stream);. It 'puts back' a char to the front of the stream that is being read. This putting back is ...
I would like to build software to help folks with their personal finances. One area I would like to tackle is trying to predict future transactions based in past transactions. For instance you might see the electric bill being paid near a certain day of the month. The algorithm would then be able to create future predi...
This is more of an OOD problem and I have no specific code to post here. Can the same class violate the SRP in one context and be SRP compliant in other without changing a single line of code? In other words, can there be a situation that within the frameworks of the former requirements the class is SRP compliant and t...
A question has surfaced on the team: would it be a good or a bad idea to have a script auto merge from master to all this release's branches on a daily basis? I'm not entirely convinced by it -- it seems that merging may yield conflicts (and in that case the script would back-off), but even if it doesn't, I can imagine...
I am planning to remodel my current application and I am not sure if this is the right approach. Currently I have a Java Enterprise server application with 3 web-applications and an ejb-application which handles the database (JPA with EJB-Facades). Everything in one single project (deployed as an ear file). The web-app...
How should I track requests for very small changes in the user interface of my Agile project? These changes will take very little time to complete and require only a few words to specify. However, they have originated with the customer, and it is therefore very important that they are not overlooked. Creating a 'User S...
What is the complexity of the following loop? for(i=1;i<n;i=2^i) sum+=i;
I have a class which is refactored in 1 main class and 2 smaller classes. The main classes use the database (like a lot of my classes do) and sends an email. So the main class has an IPersonRepository and an IEmailRepository injected which in his turn sends to the 2 smaller classes. Now I want to unit test the main cla...
Define a BST as: all left descendants <= n < all right descendants. Then is it possible to build two binary search trees with different structures but the same exact values? Duplicate values are allowed.
I am having trouble with code design for current scenario of process workflow. For example, by default it is set in the app that for some request 'A' direct manager has the authority to 'approve' that but later on, this approval authority has been moved to 'department head'. How can I accommodate these changes without ...
Kind of as the title implies - I can understand why Apps Hungarian might crop up, but Systems Hungarian seems almost entirely pointless in a strongly-typed language. Why, then, is it so apparently prevalent in the VB world? Going back to my high school programming courses (late '00s), I had a teacher who knew nearly no...
When I start a new project based on a nice starter kit like this Angular 2 one. How do you keep up with changes to a base repo like this? I know that it is a 'starter', but it would be nice to merge smart new insights from the starter kit into my own code base. What's the most commonly used Git workflow to do this? I m...
Let's say that we have a class PersonName and we throw an exception when some one try to create a instance of PersonName passing an invalid name to the constructor. Should the exception InvalidPersonName be expressed on the domain model? And if it should, how should it be represented?
I'm writing an API for a bunch of different aspects of my project. I have some code that currently looks like interface LoginCredentialRepository { Callable<LoginCredential> fetchCredentials(String username); } I had the thought to add a new interface to the mix, a FetchLoginCredentialTask that looked something l...
I'm working on a project which revolves around a database of about 750.000 entities. Let's just say these entities are musical works. Each musical work is associated with an album, one or more composers and some other entities. The business who owns this database has bought services from other providers which requires...
Background: I couldn't find a standard definition for "rich domain model". I may call it non-anemic domain model. So, it could be defined as a software domain model where the domain objects contain little or no intensive business logic (validations, calculations, business rules etc.). Anemic domain models are widely de...
I want to make a builder pattern in a DDD application, but my builder is not stateless, is not a entity and is not service. If the stateless should be use for service, how to make the builder pattern like a service stateless with sub type specific parameter and initialisation ? And how to make factory class compositi...
In a java code the Printer class has a print method. This print method, rather than performing the print itself, delegates to class RealPrinter. To the outside world it appears that the Printer class is doing the print, but the RealPrinter class is the one actually doing the work. Draw the UML class diagram showing Del...
There are many typical questions like Return random `list` item by its `weight` Imagine more advanced problem. You have N sources of pair (item_id, weight) information. Let's call them Shards. Shards contain lists of pairs (item_id, weight). And you have central node, let's call it Central. The problem is: on Central c...
I m trying to learn how to make my code better. This way, I try to learn some books and understand them. I m having some troubles dealing with Domain Objects. From the first year of my IT school, I've learnt to create some UML diagrams, and more particularly class diagrams. When I need to represent the following user s...
In the program I'm making I have a pixtureBox (.NET) that is used to show related images. I found images after searching online, and some are CC BY-SA 2.0, 3.0, 4.0, and some belong to the public domain. I read the related FAQ of Creative Commons, but its kind of vague as in it does not give me a clear enough image of ...
I've been asked to takeover an existing Android project and the developer who was previously working on this project has left many things incomplete and un-solved with some really bad code documentation. I am finding it difficult to understand the code and his coding standard and the previous developer can't be reached...
I am trying to create a partial view (re-used many times) that will prompt the user for data and return that value to the parent view. My best solution so far is to pass to the partial view the name of a hidden object (a div, for instance) in the parent view, that the partial view will then set teh value of when the us...
Currently I'm working on a new open-source project for a packet inspection. I have almost none experience with designing an architecture. Thus I would like to ask your opinion on my current architecture and what issues could I face during scaling it. I have a set of large packet capture files with network traffic. Thes...
I am trying to figure our what is the appropriate granularity for code libraries. Specifically, I want to work out if all my general code libraries should be rolled into a single DLL, or if they are better separated into separate DLLs, one for each discrete area of functionality. Background I have a a set of code libr...
I hope this isn't too subjective, but this question definitely doesn't belong on SO... I'm currently writing a large ASP.NET MVC 5 application and most views have their own javascript files as to be expected. What I'm having an issue with is determining is how to include the various javascript dependencies. Obviously...
What is the difference of Principle of least privilege and Interface segregation principle? As much as I understand ISP is just the projection of PoLP on the OOD plain.
Some languages, including C++ and Python, have "standard libraries" associated with them. What are the advantages of separating functionality out into standard libraries rather than build it directly into the language, where it would take less effort to access? Clarification: by "built in" I mean "usable out of the bo...
Today I was watching a "JUnit basics" video and the author said that when testing a given method in your program, you shouldn't use other of your own methods in the process. To be more specific, he was talking about testing some record-creation method that took a name and last name for arguments, and it used them to cr...
The GitHub API supports HATEOAS quite elegantly, so navigating it from a graphical REST client like Postman is intuitive and fast. They don't list all possible permutations of the endpoints when requesting "/", my guess is they only list the top 'root' endpoints that get you started so that you can then use the respons...
I'm looking to implement a fast, well-distributed hash table in C#. I'm having trouble choosing my hash-constraining function that takes an arbitrary hash code and "constrains" it so it can be used to index the buckets. There are two options that I see so far: On one hand, you can make sure your buckets always have a ...
I am just reading Fielding's Dissertation and have a question about Chapter 5 where he introduces REST. In 5.1.5, he writes about trade-offs that come with the decision to enforce uniform interfaces. To quote: The central feature that distinguishes the REST architectural style from other network-based styles is its em...
In answers to this question, the general consensus was that static methods are not meant to be overridden (and thus static functions in C# cannot be virtual or abstract). This is not only the case in C#, though; Java also forbids this and C++ doesn't seem to like it either. However, I can think of many examples of stat...