instruction
stringlengths
34
36.1k
I have an application that I want to be MIT and I have a roo gem in my Gemfile (roo is licensed under MIT) however it depends on spreadsheet that has GNU license. Am I allowed to use roo and have MIT licence?
I have a slight case of OCD. That means I've read multiple questions that are similar but I'm still paranoid. I'm distributing a commercial application that relies on a 3rd party library that's licensed under Apache 2.0. In order to prevent DLL HELL, I've simply re-assembled the library under a different assembly name,...
I´m looking for the best way to solve following problem: I have three lists of different objects: AppleJuice, OrangeJuice & Juice. All Juice properties exists in AppleJuice & OrangeJuice and I only need these from AppleJuice & OrangeJuice. I can´t change the AppleJuice & OrangeJuice implementations since they come fro...
I am designing an application, which will store sports statistics, show them in different diagrams and do few more operations on them. Allow user to do some mock drafts etc. I choose to build a domain first, and then create a database via code-fist approach. So I have my entities: - Player (name, teamId, list of stat...
I have a simple list in Java that I need to search using one of two methods. The first method simply returns the position in the list of the first matching element. The second filters out any elements that don't match. Here's some pseudo-ish-code: public int positionMatch(String search) { for (Element e: myList) {...
I want to build an API (Java) that heavily relies on a connection object to a data server that manages a connection to a real device. All i have is a DeviceConnection object. Currently i have a big class that presents the user with everything the device can do and manage the connection object inside that class. That wo...
I'm creating a point of sale system for a small shop. I am particularly interested in finding patters from all items purchased, which I will log in their entirety. I'm thinking of even making queries on things like temperature to sales of specific categories of products. Should I use a plain text based database such as...
I have a table with employees information: id, active, first_name, last_name, gender, id_number, address, picture, password, comment Every employee has an entrance time and an exit time for each day of the week except Saturday. It is possible that an employee has two entrance times and two exit times (when he chooses ...
I am trying to improve a brute force algorithm for letters of the English alphabet [a-z][A-Z] and numbers [0-9]. The length of the generated permutations should be 8. So far, I've built a simple brute force iteration with Ruby and later I broke down the master iteration to smaller ones of 100_000 items each. Also, I am...
We have quite a large project where and tend to apply risk based approach to stringency of unit tests and code reviews. E.g. components classified as A need to have higher coverage than components classified as B. However, it is nearly impossible without a support of static analyser - is there a way how to instruct (e....
Reading the literature of DDD I came up with the following layers: Application Outsider World (Controllers, Crons, etc) Application Services (or UseCases) - which orchestrates multiple Domain Services or Infrastructure Services. They are called from Outside World. They know what things have to be done Domain Services ...
This is more philosophical question, which address .NET platform, but maybe it is useful also for other languages. I'm doing lot of Unit Testing and especially when I'm using third-party components I often struggling with. In .NET is enormous claim to component design(er) to choice which method should be virtual or not...
I have a feature where scanned exam answer books need to be digitally annotated and marked. The scanning portion of the work is with another vendor who refuses to scan in any format other than PDF as it's more secure and unalterable. I need to develop code that can show the 20-odd pages in the PDF on screen using a web...
This question has bothered me for a few days, and it feels like several practices contradict each other. Example Iteration 1 public class FooDao : IFooDao { private IFooConnection fooConnection; private IBarConnection barConnection; public FooDao(IFooConnection fooConnection, IBarConnection barConnection) ...
I am starting to develop a REST API with Jersey to retrieve a schedule for a given sport tournament. The client sends a JSON containing a tournament with its different categories, domain, definitions and configuration. This will be unmarshalled by Jackson. And the response includes a JSON with the calculated schedule f...
I need to perform a payment and I have two payment methods: FirstPayment and TokenPayment, which both implement PaymentInterface interface PaymentInterface { public function pay(PaymentRequest $request); } According to a specific condition on PaymentRequest I need to choose whether to use FirstPayment of TokenPaym...
I am a very inexperienced programmer, so apologies if this is a stupid question to be asking. And similarly, if anyone answering could assume that I know basically nothing at all and treat me like an idiot, that'd be great... I have some code in C++ that is an interface to a physical device. Importantly, part of this i...
I often use smaller data types in structs/classes when it is needed in memory savings. I also use them in network/disk IO. My question is if intermediate code that use those objects with smaller data types, should be of the same type, or just plain types like int and cut them when storing. For example: struct Object { ...
Symfony2 is handling all its things in bundles in /app or in /vendor. This is fine if you are handling and managing all by yourself or Ops that handle all needed things. But I haven't found a good way for some kind of 'plugin system' in SF2 till now. I have tried to find an answer for several days now on the net but di...
I am developing a program that polls a device for actvity. In the past I have always used a USB device with a pure USB device driver. The upside of this was that that device was blazingly fast. The downside was that it limited me to the DLL the manufacturer distributed with it. For certain reasons beyond my control I h...
I've been considering doing some kind of application that allows users to track events in mythical settings. However, not all mythical settings allow for normal times. What if one user wants star dates, another wants BD/AD (Before Debbie/After Debbie, the heroine of an adventure?), another wants to count ticks from the...
I have been playing around with Guava Multimaps and I ran into an issue with tracking when an user is damaged (more the way it's displayed, really) Let's say I have a Multimap<User, Hit> and Hit consists of 2 fields: damager (string), and damage (double). Here is an example of what my collection might look like: dang...
I've been programming for a long time, but very rarely with anything asynchronous (and not often with anything to do with multithreading, either). Mostly for the fun of it, I'm writing a program to download song lyrics, and save them to music files (via e.g. ID3v2 tags). I have most of that in place by now: I have two ...
At my workplace we use CVS tags to the extent that nobody ever retrieves the HEAD version of the trunk. Is there any reason why that version still needs to build fully? The reason I ask is because recently there was a need to revert to older revisions of certain files, and instead of moving those versions to HEAD, we s...
I have a set of data about a family, and I want the software to find a house design that fits the data (which includes stuff like preferences and whether they want a pool. The current way I am going on about it right now is rather naive. There is a predetermined set of relationships between categories, or roles, of Roo...
I'm working on an application with about 50 or so microservices that have separate multi-tenanted databases. The problem arose of taking a tenant's data offline meaning that any requests for a certain tenant's data should be denied regardless of what service the request is being made for. Normally in a single tenant da...
#include <stdio.h> int main() { printf("Goodbye, World!"); return 0; } Why do I need #,<>, .h, and ()? What are their purposes?
I have some methods defined in a controller which most of them returns JsonResult, and some returns PartialViews. So I have two questions, 1) Is it a good practice to access those methods that return JsonResult from other controllers? 2) Is it a good practice to access those methods that return ActionResult from other ...
I have the following requirement for an application: Store large files (order of megabytes) which I will use as input for non regression test and some expected properties of the processing result Allow business users to add additional files and properties Being able to track over time which files (and properties) were...
I am reading through PHP Objects, Patterns and Practice 4th Ed and on page 41, Constant Properties chapter says: Constant properties can contain only primitive values. You cannot assign an object to a constant. But objects are also primitive values according to the official documentation, as shown here: http://php.n...
I'm just having a debate about the best (future-proof, safe, user-friendly, developer-friendly, technologically nice) approach to localization of a web-application. We are using basically processing on the server, prepare pages there and use some JS, also use Syncfusion (who offer "something" with their latest release)...
Why are most computers byte addressable instead of bit addressable? By B/b addressable I mean that processor can operate on level of single B/b. Bit addressable advantages: Booleans have size of one bit. You can directly access single bits in integers (without some dirty hacks like shifting). Byte addressable advant...
Referential Transparency is one of the corner stones of functional programming that allows us to apply equative reasoning to our code. However it does so at a cost to performance, by use of immutable objects. Some functional programming languages like Idris solve this performance problem via the use of Uniqueness Types...
Recently, two guys contacted me and asked me to build their mobile app. They have a brand new concept and want an app quickly. I told them that I need some user stories and some specifications by example in order to accurately know what they expect from the app and to be able to make an estimate of the tasks and delay...
I am developing program with asp.net MVC and I feel like I'm doing it wrong in these parts: I'm populating all process in controller, because I don't know how to put it in model (how to call it). I have read some reference and people say that we must put process in model (?) Many of my action have same process (repeti...
I have a web app that makes use of node.js in the backend and angulajs on the front end. Let's say I have a user who has the ability to login via multiple systems; I must allow multiple logins. I am making use of jsonwebtoken module to generate token for a user after he is authenticated and that is saved in the redis...
I'm trying to understand what happens with dependencies (Ninject) when a same Interface in injected in multiple classes. I am specifying InRequestScope for my bindings so as I understand there should always be a single instance of let's say my IUnitOfWork in a single HttpRequest. Is there a way I can check how many ins...
I'm not sure if this is a thing. I'm sorry about the ambiguous title--I wasn't really sure how to explain it. Basically I have a ASP.NET web page that runs two SQL queries and does some logic to produce a status page for our delivery department. It refreshes / updates every 30 seconds, therefore the database is bein...
Question I apologize if this question has already been posted. I tried searching but I couldn't find the answer. I often find myself trying to use DI and DIP where I need to open a file or a socket. Using DI comes naturally when doing TDD as it is sometimes hard and/or ugly to test that something has been written corre...
This is bugging me for quite a while and even though I decided to do it in a certain way I am still no convinced that I decided well. Here is the background to it: One of the core features of my application relies on textual data which will reference other entities in my system. Let's put it into a simple example: This...
I have a specific case for this inquiry, but hopefully it can be generalized to anything else. I'm working with an aircraft simulator and have been tasked to implement a module whose goal is to improve the performance, if you will, of the existing module. After reading up about how to write proper requirements (and the...
My question is not how to call a web page in code but rather what the correct architecture for it would be. I have an MVC web app that displays certain data from our database when the user visits a page. The data in question comes from another site, and I need to load it into our database once an hour by calling the ot...
When creating a C++ class what is best practice> Put the entire class definition and member functions in a header file Put the class definition and function declarations in the header file and put the function definitions in a separate source file Put the entire class definition and declare member functions in a sourc...
So i am creating my first larger scale application (by larger scale i mean something i see myself publishing in the app store) and i am not sure of how to handle user authorization. The client will consist of a application for android and iphone, and they make HTTP requests on a server. My data is stored in a postgreSQ...
I have spent the last few hours reading up on the use of static classes and trying to figure out if I should be using them or not but still have not come to any sort of conclusion. It seems that the argument could go either way. In my application I have created what I call "helper classes" which contains methods that w...
At our company, we maintain three products, which are quite similar, in 2 Projects. All Java, using Maven for dependencies. These three products evolved out of another project, which is now a maven dependency of the two Projects. Let's depict it like this: Project A and B are so similar, that essentially every bug f...
I was reading this question in SO, and it contains the following: A non-static nested class (sometimes incorrectly referred to as an 'inner class') (...) And it confused me. At 350+ upvotes, I assume that the answer is basically correct, and I did further research on the difference between "non-static nested class" a...
Often in modeling, data processing, and optimization; the intensive portions of the code can often reduce to solving a lot of linear equations. e.g. solve for x1 in A x1 = b1 solve for x2 in A x2 = b2 ... and so on Sometimes the matrix 'A' doesn't change between computations, and my question is how (and when) can I ta...
I am looking to take a product of a large number of transpositions, and boil it down to a smaller number of products. I have the following code, and would like some input on efficient ways to boil these products down. Before I give the code, it is important to recognize the following: Transpositions, a cyclic permutati...
We are building several applications that will eventually be one front-end application. It is split up into several projects at the moment where each project is managed by its own scrum team. The older applications were built on Angular 1, while the newer ones were built on React. The result is inconsistency in the loo...
I recently took an exam for the introductory course on Computer Science. One question was about sequence diagrams (very simple example, boiled down to its essentials): The Bank object sends a message withdraw(100) to the Account object. In the message, 100 is called a parameter. True or false? Being a Java programme...
I have a bunch of microservices whose functionality I expose through a REST API according to the API Gateway pattern. As these microservices are Spring Boot applications, I am using Spring AMQP to achieve RPC-style synchronous communication between these microservices. Things have been going smooth so far. However, the...
I have several uncommon questions related to the design of REST services hosted on a server communicating with local or remote applications. As an example, let's say that I have 2 machines ("A" and "B") located in two different countries. The machine "A" host a server that run a REST endpoint (=ip adress with an assoc...
We have just started to work with React and some of my team mates proposed to split the components in 3 types (each one in its specific folder): components: reusable components like buttons, inputs and anything that would make sense as an open source shared component screens: pages of the application blocks: component...
Basically, I have a blog where I want to add a rating system, which will allow users to rate each post on a scale from 1 to 5. I do not want the users to sign in, as that is too much hassle from my part. However, I also want to save some of the ratings. For instance, lets say X is a user who rated an article 3/5. When ...
I have heard that nesting try-catch statements can often be a code smell, so I'm wondering whether this situation is an exception. If not, what would be some good ways to refactor? My code looks like the following: try{ X x = blah; otherStuff; for (int i = 0; i < N; i++){ try{ String y =...
I have a project structure like this: My Project - Other Team's Project -Third Party Dependency My Project requires Other Team's Project to function, and both My Project and Other Team's Project require Third Party Dependency to function. We are using a dependency management system to manage these. From a desig...
Problem at hand: Finding separate subgraphs. Update on adding or removing edges. First I've been thinking about running DFS after every operation from both ends of the edge, but if I keep information about subgraph in the vertices, then adding edge is O(1); you just join subgraphs of both ends. Now, if I wanted to remo...
When designing REST endpoints idempotency is a crucial tool. Say we have a HTTP endpoint accepting PUT which we would like to be idempotent. In case a client makes the same request multiple times, should the server always return the same, or is it acceptable to return an error the second time? If the answer is yes is ...
I am writing a Java library that needs to make http GET && POST requests. There will be two types of users of this library: Those with understanding of callbacks and know how to use them. Those that....don't. So please consider the following two methods: public void methodWithCallback(ServiceCallback callback) { ...
I am a build manager and release engineer with a programming/SW dev background. I manage build scripts and makefiles for our SW team on our project to produce different versions of releases and I thoroughly enjoy my job especially the automation and optimization aspects of it, even though I do not get to write product...
So, I was thinking about writing custom exceptions today, and considered the invalid operation exception. This exception can mean many many things, and in some actions, the operations might be invalid due to multiple independent causes. Consider this example. (And yes, I know that an ArgumentException would be better h...
I am using a 3rd party API which yields JSON which has two ways of loading data - as a list of items, or as a singular item. The problem is that a given item in the list has different properties than the same item if you load it as an individual. The two load methods yield items which are similar, but different. For ...
I'm looking for some input on how to keep certain benefits of both a binary file and a SQL database in an interesting data storage problem. I have a legacy custom binary file format that is essentially several hundred multi-dimensional arrays that are serialized to a file with fwrite()'s in C. Each file is a fixed siz...
I have to design for a bunch of user control types, each of which share some common properties but some of which have special unique properties. For example, the common properties across all the controls would be title, caption, field length, etc. But for specific types like Dropdown, FileUpload, apart from common pr...
I work in the IT function at a large retailer and we have just started a project with the business to redesign a key system for our Website. The business users know they want to update the system and improve it. They have some very very high level principles around how it should work but that's about it. Management w...
We want to allocate a Int32 value for a coming new GUID, which is not exist in our system. One solution is to use auto-incremental Id in Mysql, but it's not convenient for later usages. Another method is to use a Hash function, to hash the GUID string to a Int32, but 32bit is too short to avoid high hash collision. An...
I'm facing a design problem with Spring's profile and Maven multimodule project from which i'm building a product, as a web as application that can be customized for differents clients. For this i need quite some organization of my code, this is why i'm seaking advises on how to organises my profiles around my code. At...
I'm interested in how calling Console.WriteLine() actually displays text. I've had a look at the source code from: http://referencesource.microsoft.com/#mscorlib/system/io/textwriter.cs,5f99350fdf8dae53 and can see that this method from TextWriter ends up getting called: // Writes a character to the text stream...
The .NET Framework CLR files are located in the following folders under C:\Windows\Microsoft.NET\Framework: v1.0.3705 v1.1.4322 v2.0.50727 v4.0.30319 (Yes, there's v3.0 and v3.5 as well, but they contain only additional libraries, not the CLR.) Note that the framework versions .NET 4.0, 4.5, 4.5.1, 4.5.2, 4.6 and 4.6....
I have been asked to create a filtering functionality for e-commerce application written in PHP. Since the app is using MySQL database, I made the decision to use Elasticsearch with Logstash and Kibana. Now this part is clear, using Logstash to transfer data from MySQL to Elasticsearch and then using Elasticsearch php ...
I have this small code: int* array_int = new int[10]; array_int[0] = 1; array_int[1] = 2; array_int[2] = 3; array_int[3] = 4; array_int[4] = 5; array_int[5] = 6; array_int[6] = 7; array_int[7] = 8; array_int[8] = 9; array_int[9] = 10; print(array_int); print(array_int + ...
Should Erlang systems (or anything running on the BEAM VM) be monolithic, i.e. everything running in the same distributed application, or should they be split into multiple microservices like any python/go/c++ shop would do? Since each process in Erlang has its own memory space, it seems like they behave like microser...
I am developing a RESTful API and I think it is convenient to use DAOs for my resources because although I plan on just using memory to store them, I don't want to close a door to whoever is using my library if they decided to use a database implementation for the DAO. My question is whether the DAO should be a singlet...
We inherited a large ASP.NET website built entirely in WebForms. The website has over 200 pages, spread across 60 WebForms projects inside of the website's solution. About half of the pages are static content while the other half has a varied amount of server side complexity, mainly data capture and display. There is n...
I am developing a RESTful API and I am using DAOs to serve data to the service. I am having trouble deciding where certain responsibilities should fall, whether in the service or in the DAO contract. Or not just responsibilities but just deciding what each component should do or should not do. In the scenario of the CR...
Given these example REST API / HATEOAS applications: InfoQ How to GET a Cup of Coffee example Java Spring REST API example ... where POST/PUT/PATCHING resources clearly alters the state/availability of (other) resources — for example in: (REST example API 1) PUT /order/1234 HTTP/1.1 ... <order> ... <status>prep...
I know that assembler is the one which converts to machine code. So here in 8085 instruction set LDA has opcode "3A". My question is how assembler convert mnemonics to opcode and finally to machine code. How LdA mnemonic is converted to 3A hex code If I come up with a new architecture and new instruction set. How the...
In this short article Public versus Published Interfaces from 2002, Martin Fowler distinguishes between easily changeable "public interfaces" and harder to change "published interfaces": The key difference is being able to find and change the code that uses an interface. For a published interface, this isn’t possi...
Recently I have come across this article, which claims that "low-code" development is very important in the rapidly changing world of software engineering. I got the idea that "low-code" has something to do with high-level programming and small sized code, but without a formal definition of what it actually is, the con...
We have a rather large code base that interacts with many SOAP based XML services. Each one of these services makes 1 to n service calls A typical low level web service call looks like this (simplified): public XElement ExecuteWebService(string xmlRequest) We use WCF to build the SOAP message send it and get back t...
After doing some investigation* I have learned that I could potentially have a concurrency problem. I'm currently building a Tournament Platform in ASP.NET MVC 5 with Entity Framework 6. So far, I've never had concurrency problems (Mostly because they fell into the overly-optimistic scenario). I ask money for people t...
I'm creating a 3-tier Web API application based on the Azure guide here. This has a middle tier and a data tier both in Web API. So far my application is pretty simple, the middle tier receives a request, translates it to the domain model, passes it to the data tier which performs a CRUD operation which is then passed ...
I hate referencing paywalled content, but this video shows exactly what I'm talking about. Precisely 12 minutes in Robert Martin looks at this: And says "One of my favorite things to do is getting rid of useless braces" as he turns it into this: A long time ago, in an education far far away, I was taught not to do th...
I am struggling to understand the design of an Oracle database that I have been working with for the past 9 months. The database is for our business management system and I work with it mostly for reporting and data warehousing. The database has just over 5,000 tables (not all of them are being used) and so when I star...
Would a value such as monthly cost from source data be represented as a fact? If yes, how would a date dimension table be designed around that fact?
I've been trying to design a program in Java (because I might need to create an app that does the controlling part) with GUI that can run scripts on a few local computers. It should do the following: Client: It should just listen for incoming connections, and accept them from a specific port and IP. When a connection i...
In the example below, I have a Person class and class B that holds a reference to a Person. Person has a public foo1 method that can alter its state (it's a mutable object). Suppose clients of class B want to know the salary, name and email of person object. Should I rewrite the getters from Person class in class B (wi...
I was looking at the type of map for Try[T] in Scala, which is: def map[S](f: T=>S): Try[S] From Haskell, I am used to the type of map being: map :: (a->b)->[a]->[b] This seems very logical. Map takes a function and a group of elements and applies that function over all elements of the set. However, I don't understan...
I've worked for a few companies and even developed projects on my own - these projects were based on Java Enterprise Edition. Sometimes with Spring Framework involved, sometimes it was a pure JEE. However, building Java-based applications has one major flaw for me - too many heterogenous environments. Different applic...
I'm really struggling to understand git, so here's a tighter rephrasing of a previous question I had asked. I'm going to explain a hypothetical scenario, detailing what I think happens when you download some code using git and install it on a machine, and hopefully somebody can tell me which part I am incorrect about! ...
Here is my question. class Gen<T> { T ob; Gen() { ob = new T(); // Illegal!!! } } Why is it illegal? Could you please explain it.
I was looking at this lecture, https://class.coursera.org/reactive-002/lecture/135 at 2:15. The lecturer talks about the duality of Future and Try in Scala. For his demonstration he changes the type: (Try[T] => Unit) => Unit into: Unit => (Unit => Try[T]) and he says something about duality(which I'm not familiar wit...
What i mean is something like: I have 2 array var and type, you can input the name of the variable on the var array and type of variable on the type array(type depend on language used), then i want to use the value from these array to define varriable i.e: Var[1] as type[1] Var[2] as type[2] Is it possible to do someth...
I'd like to use the MIT License for a project I'm working on. Most of the files in the repository are mine but 1 had to be copied from another open-source project (also under the MIT License). What should I do to indicate that the copyright notice in the license excludes certain files that I did not write?
I am working on a project that will scrape data from roughly about 6,000 websites. I am considering using a server/client model in which the server is responsible for scraping the data and importing them into a database while the client accesses the data. To scrape the data, I am considering using a html parser like Ht...
I'm reading a paper about the actor model and they describe how a fork-join behaviour can be implemented using it: Let us consider how a system of actors, when requested to calculate some value, can split up the load among themselves and combine the results to form the final answer. Actor F receives a request messag...
I wrote a library in Python and I want to have an EULA and agreement box to pop up upon opening the program for the first time, but I don't have a lawyer. I don't know much about terms and conditions, licensing, privacy policies, etc. I picked around on the web and I decided to use the LGPL 3.0 license (Lesser General ...
A small company without any IT skills wants to run a web application where customers can enter various bits of data and upload pdfs. The documents regard product specifications and have to be kept secure. They have one external IT guy who wants to sell them a PHP application for the task. He wants to store the document...
I am hoping for some advice on how best to perform a particular bitbucket/git maneuver which will fork a repo back to a team from which it was previously forked. Let's call it Repo R, originally in the Untitled Projects project of Team T. Some months ago, Repo R was forked to User U's personal account, who worked on i...