instruction
stringlengths
34
36.1k
In order to visualize some concepts in a Git repo for other developers, I want to put there some vector drawings. Of course they should not be binary. If minor changes occur, the file change should be minor as well. Up to this point I think about the flat XML odf format. Is this a good idea?
I am using a Java to connect to MySQL database. I want to iterate through this data and store it into a data structure. This data structure will be JSON.parse() and converted from server side to client. Can anyone recommend an appropriate data structure? The database contains 4 columns. One int, two doubles and anot...
ive had a look around and I cant seem to find an answer or how to work out this question, its a tutorial question for my operating systems course and ive looked through the notes that come with the question and i cant get an answer along with looking at the Ritche and silberschatz OS books. the question asks: Demonstra...
According to Wikipedia, the term "bootstrapping" in the context of writing compilers means this: In computer science, bootstrapping is the process of writing a compiler (or assembler) in the source programming language that it intends to compile. Applying this technique leads to a self-hosting compiler. And I can und...
Normally we link to CSS via the <link> tag. However, this leads to the browser making a network request for the stylesheet, which is slow. What if, in the build process, we took our CSS file and inserted it into the HTML using <style>? For example, suppose we have: app.css p { color: red; } index.html <html> <head...
Let's say I have a database with users, groups and messages at the groups. And I have 3 views: Profile view: Where all the details of the user is shown. Groups view: Where all the groups are shown. Group view: Where all the messages are shown. Now whenever the user goes to a view, the view connects to the database to ...
First a disclaimer: I don't really know if this question fits this website, but I still find it a relevant question not just to me but for other people which are beginners. If the question can be improved to fit here, please point out int comments. If it doesn't fit, let me know also and if possible let me know where t...
I know how to actually do the linking, but I'm not sure what the best practice is for actually getting those libraries downloaded and into my repository. Should I just straight-out include them using Git? Should I use git submodules (but what if the library in question doesn't use git)? Or should I provide a shell scri...
I am performing a function point analysis (FPA) for a project. I am completely new to this process and have started with only the login and authentication modules to validate the results I get. I think I have understood data function well and my count of internal logic files and external interface files is correct. I n...
I have a question in regards to the implementation of a program that I am trying to do. I have a MySQL database with numerous users, and each have a task executed at a certain time. For each user they have a time for the task to be executed, and a time zone for the task to be executed (each seperate colums in the MySQL...
I recently read an an article about Functional Specifications by Joel Spolsky (if his name sounds familiar, its likely because the good Mr. Spolsky is one of the StackExchange founders). In the article Joel mentions how Microsoft used Program Managers as the persons who manage the software design during development (ok...
I am trying to design a public facing website and would like to experiment with a WebAPI backend and one of the popular front end javascript frameworks. Now, this application is not going to require users to login so there is no authentication process involved. To be honest most of the rest applications I have develop...
Let's say I have a UserRepository. It has the basic CRUD methods. According to the Repository Pattern, should it contain methods like IsAdministrator(user) to check against the database if a user is an admin? If not, which pattern is relevant?
There's lots of stuff out there comparing the HTML elements SVG and Canvas, but I'm still a little confused. I'm looking for a way to draw an arbitrary shape (like, I have a description of a shape, in coordinates, or in lines and circles, etc.). I want to be able to generate the shape with Javascript (taking inputs fro...
I am trying to improve my MVC projects and I read a few articles about DI, IoC containers, Constructor Injection and Service locators. I wanted to go with Ninject to help with the dependencies, but got puzzled with some of the stuff I read. The most controversial would be the widely discussed one here http://jeffreypal...
We are having a set of selenium UI tests for our application. We are deploying the application in our test machines in our QA environment. We are using TFS 2015 for continuous integration and deployment. I am building the selenium test scripts using Maven and creating the JAR file in build definition. Now should I copy...
I've been reading quite a bit, but I can't find any articles that fit our use case (maybe I'm blind), I'm after some suggestions or articles to read. We have a couple of outsource teams who currently use SVN and I need to get them using our source control (Mercurial -Kiln) to enable use of CI/CD -AppVeyor. So there are...
I recently joined a team of developers that has been working on a software project for several years. I have been asked to create a unit testing test process to improve their output and suggest new test cases and test strategies. I have been working before as a black box tester with a programming backgrounds; I am not ...
Ever tried to sum up all numbers from 1 to 2,000,000 in your favorite programming language? The result is easy to calculate manually: 2,000,001,000,000, which some 900 times larger than the maximum value of an unsigned 32bit integer. C# prints out -1453759936 - a negative value! And I guess Java does the same. That mea...
I've been reading through Mark Seemann's book on DI, and have a specific question with regards to implementing a Local Default. The book advocates for property injection in this case, but I wanted to ask if the following is a simpler yet as versatile alternative: assigning a null default argument in the constructor par...
I am struggling with how to organize external references in a C# program in order to minimize code repetition. I have application "A1" for which I want to use Microsoft's Unity IoC/Dependency Injection system. So I use NuGet to pull down the Unity package and install it in A1. This pulls down 2 projects and 4 DLLs in...
I am the author of an iOS framework and I know for sure that an app uses it, but the app's author is not attributing it. How can I prove this in a way that also a judge would accept it?
I have seen similar questions and answers here but my situation is a bit different from those. I am building an application which gives users infinite canvas space to draw something. The canvas space is open to all users and anyone can draw anywhere. User will make drawings and whenever there is any change to any of th...
Are there any tips that can help me create clean code when I'm working with something poorly documented and completely new to me? It is easy to write a clean code when we are writing something for the second time. However usually problems we are approaching are new to us. Let's say we're working with a poorly documen...
For many IT people, including myself a few years ago, the ideal software development process would involve the creation of detailed design documents with lots of UML diagrams before a line of code gets written. (This looks like a description of the waterfall model but it's the same with agile, except that the iteration...
Suppose we have a functional language where objects don't have explicitly defined types, but where named properties can nonetheless be accessed on objects. Is it then possible for the compiler to trace throughout the program which properties could be accessed on which variables and do full type inference on the program...
GCC is the C compiler. Glibc is the C library. However, isn't it an absolute necessity for a compiler and the standard library bundled together as a C implementation? For example, the C library contains ABI and compiler specific stuff like <limits.h>, <stdint.h>, etc., which differs between compilers and APIs. And deta...
As I have recently started using ES6 in production, I was going through an ES6 style guide (having more than 350 stars on GitHub). This guide mentions at least three times that "Tabs are evil. Don't use them!" Also, another very popular JavaScript style guide by AirBnB also recommends using 2 spaces for indentation ins...
Member variables of a class are typically hidden from the outside word (i.e., the other classes), with private access control modifier. Access to the member variables are provided via public assessor methods. This follows the principle of information hiding. That is, objects communicate with each others using ...
I need to ensure high availability of my 3-tier architecture system. Currently I have the database mirrored by using MySQL Master-Master. All app boxes talk to the primary DB server In case of primary DB hardware failure then the application needs to be switched to the secondary .. and that is manual. I want to make t...
In this example, TItem.GetKeyType() is what I'd like to achieve. Base CRUD repository interface definition: ICrudRepository<TItem> where TItem : BaseItem where TKey : TItem.GetKeyType() public Tkey Id { get; set; } Base Entity definition: class BaseItem<TKey> this.GetKeyType = Tkey.GetType() Entity implementation: cl...
I am building a software where I have users who are responsible for managing contracts. Each user can only see the contracts that they are responsible for. Now, I want to implement a share functionality where a user can decide to share some of the contract details with another user, so the other user can now see in his...
Where does it make the most sense to debounce events? Consider the resize event of an internet browser. The browser can fire a myriad of resize events as a user clicks and drags to resize a browser window. However, usually, you end up debouncing handling the resize event listener callback because you usually only ca...
First project trying to use MVVM and Xamarin Forms, so please be gentle; however, I am at a lost on how to differentiate between the logic that belongs in the view model and model/service layer. I am working on a simple app that shows a list, has a detail page for the list object when selected to change one field, and ...
I am building a software which has two types of users in it: main users and admins. I am still building the class diagram for this system. For the main user's relations I have things like: user manages contracts; user has roles; contract has SLA; etc. And for the admin part, I have relations like: user created contract...
I am trying to follow the role bases access control model to restrict what users can or cannot do in my system. So far I have the following entities: users - People who will use the system. Here I have usernames and passwords. roles - Collection of roles that users can have. Stuff like manager, admin, etc. resources...
Question is: What is target-dependent code and how does it effect portability of a software? Motivation to ask this question In a CS class, I'm told that the more target-dependent code software has, the more portable it will be.But it feels wrong to me, actually I think the opposite. Justification was that target-dep...
I have to design a database in a Rails application, where I have users (who can login), companies and jobs. Each user belongs to a company, and each job belongs to a company, so when a user logs in, the application would search it's company and show him every job assigned to his company. The diagram is here: However, ...
I am building a website and in it I am trying to follow the rbac (role-based access control) model. Now, the thing is that managers need to send their contract proposals to approvers (people who will see if the company can go with the contract or not). But, because I have the rbac model where the admin can create many...
Which is the better name for a method that returns a boolean? IsSupportContentType or CanSupportContentType
I'm working in an architecture, it is going to offer a rest api for web client and mobile apps. I'm using Spring(spring mvc, spring data jpa, ...etc). The domain model is coded with JPA specification. I'm trying to apply some concepts of clean architecture (https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-arch...
Please help me to explain the concept of static vs non-static variable and method in terms of memory state diagram in Java. Or give me some books explaining this concept! Also in terms of memory, When an object in created (without static keyword), each object will have its own member variables. But how about methods, ...
So the scenario is we are going to develop a web app. It will primarily consist of: API Front End stuff (HTML/CSS/JS) I am considering two approaches: Package API separately into a *.war and deploy on the server. Write front end stuff and call those API. (This is what my previous company followed as we had API in h...
This is quite a general question. I want to design a set of classes and interfaces so I can swap between messaging systems without changing code, probably between RabbitMq and Kafka. My main concern is how to abstract the events they handle, as both systems require event handlers but, of course, event handlers on both ...
I have 2 third-party providers, both do a similar function(this could be logging, messaging, etc), and both have events that the client must subscribe to. I want to know what design patterns or methods I need so that I could swap out one with the other without changing any code. My main concern is how to abstract the e...
I am following the rbac model in my system. I want to know if I should prepopulate the resources and permissions table? I have resources like contracts, contract_drafts, SLA (service level agreement), etc. And permissions like create contract, modify contract, approve contract, etc. Now, I want to know if the system ...
We are working on a project to develop a solution with a large number of modules in which the client wants a website as well as mobile application. As a team we're working using ASP.NET MVC and Web API. So we can create a MVC website and an API for mobile applications, in Web API. In that case we can create a separate...
My web users can choose among zero, one or more services (i.e. selectable with checkboxes). The choices should default to only service1. The list of possible services is available via REST API. It could expand/change over time. In a DB, I need to store the users choices (json format). But ideally, a "null record" there...
I have a fairly straightforward multi layer c# application, with different presentation tiers in ASP.net MVC (2 different websites and a separate API) as well as a desktop application. The desktop application is installed on 20 end user machines. The data (EF), entities and service layers are shared by all of the pres...
Today's TDWTF article starts with a confession from the author: I didn’t know what the For-Case anti-pattern was until relatively recently, when there were a spate of articles condemning it as an anti-pattern. I’m sure I’ve probably used it, at some point, but I never knew it by name. It’s thought of as a textbook ant...
I work as a release manager in a company with 15 internal developers and 10 external developers. Setup Code base is a heavily modified Magento (PHP) Test suite is almost non-existent but is improving every day Development is done on each developer's laptop with Docker containers We have 3 environments preproduction ...
I am building a web application with NodeJs and Angular. Now I have a routing setup with Angular and an API with NodeJs so Angular can communicate with NodeJs. But when I set GET routes in NodeJs. They "overwrite" the routes from Angular, or they show plain data. For example: In NodeJs I have a GET /authorized which si...
I have a class called Process, which is extended by some different process types called ProcessA, ProcessB, etc. class Process{} class ProcessA extends Process{} class ProcessB extends Process{} //... class ProcessN extends Process{} There is also another class related to the data of A, but not the Process. I call it...
I have a function in C language which takes 3 matrices as arguments; It performs matrix multiplication of first 2 matrices and stores the result in the 3rd one. My question is what should I return from the function. Should I return the resultant matrix it self (rather the pointer to it) so that function calls can be ch...
I'm defining coding conventions for Progress OpenEdge in our company. In this language one can use symbols or keywords for operators, both work the same. For code quality purpose (code review, code readability, ...) it's a good idea to select one preference. I consulted code conventions from other companies. They all h...
I come from a "monolithic" SOA API mindset where, lets say, there would only be one RESTful service for persistence (persistence-app). Now that I'm developing in a microservice environment, I believe it's best to further decouple the big monolithic service into several independent microservices such as: DAO layer (eac...
Reading through a scathing article on the downsides of OOP in favour of some other paradigm I've run into an example that I can't find too much fault with. I want to be open to the author's arguments, and although I can theoretically understand their points, one example in particular I'm having a hard time trying to i...
I want an object that will spawn a daemon thread that will continue to run for the lifetime of the process. Let's say, just for the sake of the argument, that it's a thread in an embedded system, and it waits to receive and handle commands on some diagnostic port. But, it could be anything really. The main idea is t...
The domain is more or less straightforward — I have an article (or rather several types of articles) that I want to edit and publish. Published article is exposed through an API to public. The thing I have a problem with is further editing of a published article. Versioning, revisions, etc. are irrelevant at the moment...
Basically, title. This is just me trying to clarify part of the GPL for myself. Let's say I'm developing a program that compiles and runs on a non-free runtime engine. I'm perfectly willing to share and license my own source code under the GPL, but I do not have the source, nor the license/copyright to, the runtime eng...
I am trying to list the times in which it is useful to run some code in a separate process. Does the following short list cover it? Speed: the obvious one. Multiprocess/distributed parallism Worker process, vs GUI process for responsiveness of UI etc Security: No shared-memory space decreases attack vectors Part of...
If there's a large contribution to a library X licensed under Apache v2.0 from user A and user A decides to create a "friendly" fork of the contributions he/she made in library X to a new library Y licensed under MIT license. Both Apache v2.0 and MIT are commerical permissive license. But would that be legally okay? ...
I am working in a php project, and our 3rd party dependencies are managed with packagist via composer.json. Pretty standard stuff. Sometimes we run into a situation where a given plugin has some issue, such that we would like to continue to use the plugin but the issue makes it a liability or just straight up unusable....
I'm trying to implement parts of the ASME BPVC's design rules. It's a very, very old code that has been grown over a hundred years or so. As such, it covers lots of different load cases, lots of different component configurations, and has different paths depending on the presence of certain design criteria. Most things...
I have posted the same question to StackOverflow and Stackexchange and both got downvoted to oblivion as "too broad". So maybe this will be a better place for it. I am working on a rendering engine with my own C# bindings for OpenGL and I have a couple of questions when it comes to OpenGL's constructs and OOP concepts....
I need help with an abstract factory pattern design.I have and calculation engine which calculates for different channels like captive, captiveTemplate or Headquarter and in the future different channel can be added. Attached is the drawing on how I am setting up the pattern: The problem is some items are calculated ...
For example, I have managers who are responsible for contracts. These contracts belong to a department. So what I have done is this: manager(1) belongs to a department(1) department(1) contains contracts(0..*) In this situation, is it necessary to also include the following relation: manager(1) manipulates contracts(0....
What would be considered better, cleaner code from the following options? The code basically sends a file through a Socket using an OutputStream that encrypts it. The code does not look that basic when read but it does not need to be understood at a technical level, this is not the point of the question. The comments t...
I'm developing a software library that I began during my PhD and used in my thesis. I've since started a research position and, as an experiment, I wanted to try rewriting parts to see if I could simplify it. This turned out to be way more successful than I expected. I rewrote years of work in a matter of weeks, and th...
I have these two little programs: C #include <stdio.h> int main() { if (5) { printf("true\n"); } else { printf("false\n"); } return 0; } Java class type_system { public static void main(String args[]) { if (5) { System.out.println("true"); } else ...
I would like to know if there are best practices for this situation: a website with its source code in version control (e.g. git). code makes references to specific assets like images, that can't be included in version control due to their size. How to have in sync the code and images but keeping them outside the git...
I was faced with this question recently for the different types of heap memory available in Java. I couldn't find much information online. Are there different types of heap memory available in Java ?
On my first programming courses I was told I should use a set whenever I need to do things like remove duplicates of something. E.g.: to remove all duplicates from a vector, iterate through said vector and add each element to a set, then you're left with unique occurrences. However, I could also do that by adding each ...
Behavior-Driven Development (BDD) can be described as in this blog post as follows: Behaviour-driven development (BDD) takes the position that you can turn an idea for a requirement into implemented, tested, production-ready code simply and effectively, as long as the requirement is specific enough that everyone knows...
I want to draw a DFD to show data in a multi server (about 10 servers) process, how the data files are passed around between servers, including schedule. I googled and got a DFD style named "Gane and Sarson" but "datastore" in this concept does not represent servers well. ( http://dia-installer.de/shapes/Gane_and_Sarso...
I'm training the new iOS developer who will replace me. However, the majority of views in the project is created with code (using a library to make Autolayout more concise). There is no storyboard in the project and the process of starting the app is also in code (AppDelegate). This makes the handover more troublesome ...
Today I saw something like this: ... public class SomeClass { public static final int A_CONSTANT = SomeOtherClass.ANOTHER_CONSTANT; ... Does this make sense? What is it good for? I wouldn't do it but I am just wondering since I didn't find anything about it
I fail to infer the exact point of historical introduction of STL into actual C++ standard library from the wikipedia article: https://en.wikipedia.org/wiki/Standard_Template_Library It appears to me that C++11 was somehow significant for this STL, as it was becoming a part of C++ Standard Library. But I find another p...
I'd like to ask about the history of programming languages - specifically, the role of hardware in language development over the past 20-30 years. I have been reading about the history of Python, and the ABC project. It seems to me that there were lots of lessons learned about language structure, abstraction to a more ...
Given array of integers I am trying to design the fastest algorithm that swaps the elements such that at the end : all negative elements are on the left and then the positive elements, for example, final output might me [-5,-1,-3,10,11,2], Of course, direct sorting with n*lgn gives the desired answer but I am looking f...
I want to create an Android application with cloud-based functionality. It would entail a (rather simple) loyalty program for consumers and retailers; so, just managing user accounts and some associated data such as collected points. My question: is it feasible to base it on some ready-made solution such as Amazon AWS ...
When it comes to laying out tables in transact SQL databases, like SQL-Server and Sybase, the classic approach to relational modelling is well established. (The authority being Halpin's book) Establish your use cases Establish your entities Determine the attributes of the entities Determine the relationship between th...
Suppose we have a sorted array of unique elements, A[n]. I am trying to find the lower bound for finding a specific element x in the array. I suspect the lower bound to be log_2(n+1). I tried to use a decision tree to solve this, and indeed we know between 2 elements which is greater, which gives 2 for the base of loga...
When providing a "credits" page or similar licensing information page listing any libraries distributed with your project, should you include builds tools such as Babel and Webpack?
I have a portfolio website and i'm planning on allowing comments as a sort of "guestbook" feature. What are some things i should consider before starting? I don't want to get screwed over by a malicious user. Here's some of my thoughts Comment needs to be approved before appearing on the website Insert comment onto w...
Consider the following (python) code x = [1, 2, 3, 4] y = 2 + 3 z = x[0] + y Here, I can substitute the expressions for x and y verbatim in the expression for z, possibly by surrounding then in some grouping syntax: y = [1, 2, 3, 4][0] + (2 + 3) Not all languages have this feature. Consider the following equivalent ...
What should we do for user stories for technical debt in Pivotal Tracker? Should we consider these as features (giving points) or as chores (giving no points, thus lowering velocity)? I am confused what should be considered as a chore: Duplication of Code - It's clear that if we have put same code in multiple places, ...
We are beginning development of an Angular 2 application. Our back-end will be using ASP.NET Core WebAPI. Although my subject calls out authentication, this also applies to any API service that is-but-kinda-isn't required for the client-side app to function. Specifically, authentication, logging, etc. Right now we ha...
PEP-8 clearly states which parts of your code should have documentation: Write docstrings for all public modules, functions, classes, and methods. Docstrings are not necessary for non-public methods, but you should have a comment that describes what the method does. This comment should appear after the def line. (em...
Recently I've received the following requirement which is being quite hard to implement. The system is a Windows Forms financial system and the requirement is as follows: When the system is opened in the last day of the month, it should ask whether or not an admin user wants to generate the next months billets. It tu...
Suppose I have low level classes A, B, and C that are independent of each other. The functions in them take some input and does some computation and returns some output. Now suppose I want to create an executable where it read in some data and output some statistics with the flow of input->A.func1->B.func1->C.func1->o...
So I wrote a system for my job and now I want to write it from scratch so that I have my own copyrighted version in addition to what I've done for my boss, which does not belong to me of course (pay for hire). The problem is it is very hard not to follow the logic/algo flow from some parts of the code. Some methods wil...
I told my boss that for our next application, we will be creating rest services that follows the microservices architecture. The design I had was somewhat like this: all functions related to users - 1 rest service all functions related to payment - 1 rest service all functions related to audit log - 1 rest service all ...
Which structure of writing code is better and why? if (!file_exists('file.txt')) { throw new Exception(); } else { //operations } or if (!file_exists('file.txt')) { throw new Exception(); } //operations ? I did not find this in PSR documentation.
I tried to find an approach to implement form builder plugin but I still not getting any idea how to execute it. I don't get below things. How can I add dynamic controls to dynamic form with drag and drop functionality. (i.e using jquery or any web form control) How to store or manage dynamically created form.(database...
I have my multi module maven project with the following structure: + parent - pom.xml + model - persistents - dao - model stuff... - pom.xml + service - services - services stuff... - pom.xml + utils - exceptions - pom.xml In utils module I have some custom exceptions. The point is tha...
I am building a personal app to store my notes in. It is not a new concept, of course, but it is giving me a great project to learn Node.JS together with trying out a graph database: Neo4j. What I am having issues with, is coming up with a good data model for my app. Requirements: A note contains content in the form o...
C# 7 has a nice new language feature: The Deconstructor. It is possible to use it for value tuples for instance. However, I can also create my own deconstructors for my own classes. Why would I do that? My classes have properties. So individual items can be accessed anyway.
Say we have 4 services, A through D, which communicate (for the most part) through some sort of asynchronous event-driven system. When a new entity is created in A, B & C receive that event. B creates an entity of its own based on that event, and C makes a synchronous call to D to perform an action. Finally D receives ...
I am writing a repository class with entity framework. One of the method is an update method, which simply updates an entity. The controller does not need the entity. However, from a testing perspective, it may be useful to just return the entity. Than I easily have something to assert. It may be even more useful to re...