instruction
stringlengths
34
19.9k
I'm building a ASP.NET Web Api 2 solution for learning purposes, and I've hit a snag. I was wondering if anyone could tell me what exactly it is that I'm missing. My Web Api solution has 4 Layers: Data, which contains the Data Models ( POCOs ), Fluent API Mappings, EF Context, Migrations and Seeding Repository, which ...
I'm trying to determine the technical details of why software produced using programming languages for certain operating systems only work with them. It is my understanding that binaries are specific to certain processors due to the processor specific machine language they understand and the differing instruction sets ...
During grooming, we usually have work items which get approved based upon the team understanding that what needs to be done? The product owner does not discuss the details of how it will be done and stops the discussion if team tries so. This applies to all work items (new UI, new API or changes to existing UI/API). Pr...
Having looked at some languages for functional programming, I always wondered why some fp-languages use one or more whitespace characters for function application (and definition), whereas most (all?) imperative/object-oriented languages are using parentheses, which seems to be the more mathematical way. I also think t...
In most popular programming languages like Java and C# there is a way to define enums, which are essentially datatypes with a fixed set of values, e.g. DayOfWeek. The problem is, given a value, e.g. DayOfWeek.Monday, how do I get the next value of the enum, in this particular case DayOfWeek.Tuesday? I realize that not ...
Can the single responsibility principle be applied to databases? relational databases I mean. I'm asking this because a typical database will have several tables and we may find something like that between them: Tables handle ACL and permissions. Tables handle user authentication. Tables relating to cron jobs and sche...
I've been struggling with timezones online for a few years now. Because I've had enough of it, I want to develop a Chrome extension that leverages moment.js so I can paste in a representation of a time and it will return the time in the user's current timezone. So this is basically a GUI front-end for moment.js. I wou...
Hi I want to implement a search on a website which includes imperfect search results. Meaning, if the search term is misspelled or slightly different from a 100% match, the function should still return results which are sorted by similarity in terms of the search keyword. I already have implemented algorithms like Smit...
We have a C++ application, with C++ interfaces changing regularly during development. We also have a C API which is designed to be stable in spite of such changes; the C API is tighly focused on operations which client code might want to do. Now, we want to add a Python API to make it easy for outside clients (or our o...
I am currently reading a book titled "Numerical Recipes in C". In this book, the author details how certain algorithms inherently work better if we had indices starting with 1 (I don't entirely follow his argument and that isn't the point of this post), but C always indexes its arrays starting with 0. In order to get a...
I am writing a game in C++ which has different enemy types. I have defined a base Enemy class and I also have derived classes enemy1, enemy2 etc. Now for updating these enemies in each iteration of the game, I want to have an array: EnemyArray with its elements pointing to the existing enemies so that I can make sure t...
In the past, I've worked in a variety of environments. Desktop apps, games, embedded stuff, web services, command line jobs, web sites, database reporting, and so on. All of these environments shared the same trait: no matter their complexity, no matter their size, I could always have a subset or slice of the applicati...
I'm working on a web application for our business with my brother. Our application is pretty simple, and will be developed with php and mysql. Clients and providers ABMs Articles Inventory (we do not manage stock, because we resell from our providers) Purchases Account balance for our clients and providers I'm stuck...
I'm writing a method and depending on a config field I need to change where I get my data from. What this results in me having to write code that looks like this: List<string> result = new List<string>(); if (configField) { result.Add(fieldA); } else { result.Add(...BusinessLogic...); } I'll have to write that...
I've seen around the Internet and Github, implementations for the design pattern Repository that knows about database table and column names. I was think, if I want to work with the database as a plugin, that I can unplug and plug another respecting Open/Closed for the rest of my code, my repository should not know abo...
Maybe a little tongue-in-cheek, but as I can't find this answer anywhere through Google, so to ensure Software Engineering has the answer: What is a helper? I have seen the name being used everywhere (module names, class names, method names), as if the semantics were deep and meaningful, but in the context of Computer ...
With all the noise about EC6, one thing that I realized I haven't heard about is expanding Javascript's standard library. Javascript has a fairly sparse standard library. You need a 3rd party library to do many basic things like date manipulation. I'd rather have more built into the browser via a standard library then ...
I am mainly a C programmer. In my world, writing likeThis or like_this is just a matter of style. In Haskell however, it seems that camelCase is the definite choice. Personally, I find the later much more readable. Think pthread_mutexattr_init vs PthreadMutexAttrInit. What's more, I have configured vim to swap the numb...
I need to know where in the MVC should I apply the business rule. Imagine the situation: I have a school and I need to generate a calendar of classes for teachers. Each teacher has a school subject and is only available certain times. I need to generate this calendar in such a way that teachers can performing without t...
I am working on an application that reads a log file, looks for a specific string, sends alert emails and saves data from the file into a database. The reading functionality is working well, but I am coming across an issue when I stop and restart my program. Basically, it always starts from the beginning of the log fil...
Excuse my ignorance but we've got an application that we'd like to sample out on a mobile app The app is a C#/asp.net application connected to our sql server database. If we are going to write an android application for this app how exactly does one connect to the sql server instance? I've tried to find many articles...
I am relatively familiar with Go, having written a number of small programs in it. Rust, of course, I am less familiar with but keeping an eye on. Having recently read http://yager.io/programming/go.html, I thought I'd personally examine the two ways Generics are handled because the article seemed to unfairly criticize...
I'm developing an application where: Models keep data as a multi-dimensional array, which are saved as-is to a MongoDB database. The model is used to provide methods to manipulate the data, and outside of those methods, the data properties are read-only. The model factory instantiates each object in a standardized wa...
Perhaps it is my scripting background, but my perspective is that the purpose of an object should be to contain data. Classes are necessary in that they provide templates and standard ways to classify and construct objects with particular data attributes. Standard protocol in object oriented design seems to be to inclu...
Consider these polygons: For reasons of simplicity I only consider triangles or polygons with 4 vertices. These shapes are specified by the vertices, the output of the program should be modified vertices. I am trying to find an algorithm to create a space between the polygons, the colored area depicts the space: I ha...
What are your preferences for referencing official documentation (like a white paper) for an algorithm from comments in the code that implements it? I'm trying to decide between two methods, as illustrated by the examples below, but am open to other suggestions. RFC 1321, for instance, describes the MD5 hash algorithm....
When designing an application where scalability is going to be important, it would be useful if the application could be designed to "scale out" on cheap commodity servers. However, there are many scale up applications (see my previous question). Is it always possible to design an application to scale out, or do some r...
I have a database that collects and process large volumes of records However due to the legacy nature of the system im working with (and the powers that be) i need to transfer (processed) records to a different database instance (with some small field modifications along the way) The options i have identified are as fo...
Let's say you have class Car with Car->tune() and Car->drive() class CarDriver class CarMechanic Each CarDriver and CarMechanic object has a reference/pointer to a Car object. The CarDriver object will call $this->car->drive(), the CarMechanic object will call $this->car->tune(). The question is, how can I prevent a...
I've recently started studying Domain Driven Design and so far it looks like it will help tremendously with my team's current project. I'm running into a bit of a problem though actually determining what the domains are in our project. After my inital pass, I ended up with something like this: I have three domains: A,...
I'm trying to better understand performance in PHP. One issue I'm thinking about is the n+1 problem. By n+1 I mean something like this: $posts = Posts::getPosts(); foreach($posts as $post) { $comments = Comments::getComments(array('post_id' => $post->id)); // do something with comments.. } It's quite inefficient...
We have two in-house projects, A and B, developed by different teams with B dependent on A. Since source code for both projects is stored in git, I've included project A as a submodule into project B and configured the build system to build both in right order. An alternative solution would be to consume A via a binary...
Fact that now a days everyone is moving to cloud due to ease in scalability, configuration and maintenance. But my question is should we develop all web application scalable event if it is not required? If an application is low budget with no such special requirements then why we should add efforts to make it support ...
I have some methods that perform some data changing in a database (insert, update, and delete). The ORM I'm using return row-affected int values for those type of method. What should I return for "my method", in order to indicate the success/failure state of the operation? Consider the code that is returning an int: A....
I develop quite often scripts that are primary used as a console application but later they are used in other scripts, webservices and other things where it is very convenient, to just import the script and call methods directly rather than using a Process and parsing stdout. The question is now, what is a good design ...
In C++, we have the option to pass by reference or pass by value. The client code does not need to know which one a parent function uses; that is, int func(int param) and int func(int &param) are called in exactly the same manner from the client code. Isn't this dangerous? If I'm writing code on the client side, I don'...
When upgrading Visual Studio to a newer version, a new directory is created e.g. "Visual Studio 2013". I understand that that makes sense as we want to differentiate between code targeting different versions of .net. But since some projects use other projects as their dll's for some repeated code - this raises a questi...
Imagine I have the following code: class A: pass class B(A): pass class C(A): def __init__(self): self.b = B() Is the above code correct in terms of correct inheritance? I mean is it a good practice to reference another subclass in a subclass?
I have a website where I'm going to be partnering with another website. They want to view one specific page of mine, in their [WordPress] website. They aren't developers, so I looked into how to do this. At first glance, it appears as though the WordPress iFrame plugin is the easiest route. My next thought is, they'll ...
I stumbled across a need to create a thin I/O Layer interface to abstract away a class from the need to know about I/O public interface IFileIOProvider { Task WriteFileAsync(String contents, String path); Task<String> ReadFileAsync(String path); } Is it a good idea to test a default implementation that only fa...
I've created a PHP-based document management system and hosted it on my Raspberry Pi. I created a "backup" function that zips together all the documents, but it takes too long due to the hardware constraints of the Pi, as well as the fact that compression cannot be disabled when creating zip files in PHP. This has led ...
I have a colleague who has come up with a way of 'genericizing' information from a database so that all his web application's drop-down lists can share the same object in his MVC.NET C# code and Views, which can contain different data depending on what tables it is being used against. We work for a government agency, ...
I don't have compilable code, because the code in question depends on a large function that's irrelevant to the question, but say I have the following scenario: savePath = "C:\\..." changePath1, changePath2 :: String -> String changePath1 passedPath = 'Do something with passedPath' changePath2 = 'Do somethin...
What type of exception should I throw? I have a console class which describes rectangle of cells which a user can index by passing in a coordinate: width, height = 80, 25 console = Console.new(width, height) x, y = 2, 5 point_on_screen = Point.new(x, y) console[point_on_screen] = 'a' I am now wondering what types of ...
I am developing a Windows Runtime Component (C#) to be used in an HTML/JS frontend for a Windows Store App. Now, one of the requests is to have a database on the local system to store metadata about files that will be downloaded. After looking everywhere I have started using SQLite combined with the sqlite-net wrapper ...
I'm aware there are a lot of topics about MVC design but it's hard to find good explanations: what I should do, what are the consequences of the different possibilities... So I'm working on an ASP .NET MVC application with a HTML/Javascript front-end. Currently there is a view which allows the end-user to edit some obj...
In reading about various sorting algorithms I've seen it mentioned that some are "stable" and some are not. What does that mean, and what tradeoffs are involved on that basis when selecting an algorithm?
I'm trying to figure out the right way to handle permissions in a single page app that talks directly to several RESTful APIs, that implement HATEOAS. As an example: "As a user of my application I can view, start and pause jobs but not stop them." The underlying rest API has the following resource: /jobs/{id} Which a...
I would like to complete a pharmacy software proof concept. But I have a few questions I do not know. Physician information In order to refill or dispense a new RX the software needs to have access to a database of current doctors, is there a downloadable database or a service I can interact with to get a list of curre...
There are three versions of Neo4j apparently, called Community, Advanced, and Enterprise. Neo4j's Licensing Guide says that Community is GPL3 (which I confirmed from the LICENSE file in the tarball) and the Advanced/Enterprise seems to be dual licensed under AGPL3 and a proprietary license. What exactly does statemen...
I'm trying to automate a task and I lack the right vocabulary to look up the correct algorithm. It really feels like a common problem that has likely been solved many times before. All I'm looking for is for someone to point me in the right direction or help me with the right search terms to look up a solution / algori...
I've run into a problem where I have a set of inputs, as well as a couple known input-output pairs. I am interested in the output, but in order to get that, I need to figure out how the input is used to generate the output. So for example, I might have the following input strings along with a few known output strings c...
We are working with some screens whose in the production process change their state from a transparent state to a colored state. This colored state is achieved to block light transmittance. In this process where the screen gets tinted, this tint must be applied homogeneously. This is a very important point of the proce...
so this is C# but it could apply to any OO language where different sets of objects exist across different layers of an application. We have been trying to come up with a convention within the team for where to put the code when mapping objects in one layer to objects in another layer. For example; mapping a Data Trans...
I am writing automatic assignment of tasks to the users. Every user has a weight (integer) and tasks should be distributed to the users according to their weights. For example I have 10 tasks and User A with weight 5, User B with weight 3 and User C with weight 2. Mapping function should assign User A with 5 task, B wi...
I've got a table with the following structure : Col1 | Col2 | Col3 A | B | C A | C | B E | D | C The primary key is (Col1,Col2,Col3). I get the data in another project and display it in view with a grid. When the user edit a row in the grid, for example : A,B,C -> A,B,E, I get (A,B,E) and try ...
I have one huge file.asp with all my reports. I have modularized the page using querystring, so this creates a lot of "virtual pages" with Report #1, Report #2, and so on. I have some blocks of code I use more than once in the page. Actually I am repeating the code, but I already started to use Function to, for example...
I have following class model that I'm quite happy with: A Whole has a special mandatory Part. Furthermore it has a collection of parts, that contains at least the mandatory part, but may contain many more. In the OO model parts don't need to know where they belong. So now I came up with this RDB model: Whole: id - ...
I start a new project this summer, consisting in developing a web version of a proprietary desktop ERP. The main goal of my company is to be able to propose a web version of its ERP, with all advantages it involves (mobility, possibility of selling SaaS versions, modern look and components ...), without losing any bus...
I was stumbling through Wikipedia when I came across the entry for FLOPS, specifically the table in this section. The first entry is for a computer from 1961, the comment on the right reads The 1620's multiplication operation takes 17.7 ms.[46] What is this operation? I assume it means it can do multiplication in 17....
I'm looking for some pointers on class design for a global application. Let's say I have to make a class structure to manage products, and the products are sold in different countries. Some of the fields for the product will have the same value across all countries (eg. product code, ERP Description) I will call thes...
This is some sort of follow up to an older question of me. So I put the GPLv3 license into the project which contains my script and also added the copyright notice and copying permission statement to the top of my script. Now, apart from the script, the package also contains files which are helpful for using the script...
Assume that you have a hierarchy of organizational units: - Company -- Branches --- Departments ---- Teams Lets say I have some settings (for simplicity assume that they have the same properties) for each level of hierarchy: Max nr of documents Min something else Can do X Can do Y many other properties So, the sub-u...
I want to allow consumers of a web services layer (web services are written in Java) to create automated integration tests to validate that the version of the web services layer that the consumers will use will still work for the consumer (i.e. the web services are on a different release lifecycle than the consumers an...
Let me preface this by saying this is not my code nor my coworkers' code. Years ago when our company was smaller, we had some projects we needed done that we did not have the capacity for, so they were outsourced. Now, I have nothing against outsourcing or contractors in general, but the codebase they produced is a mas...
I wrote a C# class that is used to start a list of EXEs (not one of mine - third party EXEs I have to run) and keep them running (will check occasionally to make sure it is still running, and start them if not). I am able to test the basic logic of adding, removing, etc fine. How do I Unit Test that the actual work of...
I can't understand the last line of this GPL license. Copyright (C) 2011 Some Name This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later...
I have had a hard time learning logic programming thus far, and my request for outside resources on this site was met with some opprobrium, so perhaps this question better addresses both my needs and the requirements of this community: Is there a step-by-step approach to writing a problem in Prolog or related logic lan...
When using reusable business objects, what is considered best practice when building view models? We use an object we call Builder to build our view models. One builder for each logical unit of views (orders, users etc), where each unit can contain a number of different view models (orders contains summary, order lines...
Many things in LINQ can be accomplished without the library. But for some scenarios, LINQ is most appropriate. Examples are: SELECT - https://stackoverflow.com/questions/11883262/wrapping-list-items-inside-div-in-a-repeater SelectMany, Contains - https://stackoverflow.com/questions/11778979/better-code-pattern-for-c...
I have an object hierarchy with a number of leaf nodes that will contribute to summary values for the parent object (specifically: project cost and square footage). What's the most efficient way to tally up those values while the project is being designed? Additional details Parent ListOne NodeA NodeA.1...
I'd like to find a way to call Javascript functions from C. Are there any language bindings available for this purpose? I'm trying to make a library of Javascript functions accessible from C. (Something like a C -> Javascript foreign function interface would be suitable for this purpose, but I haven't been able to find...
I've been working on a kind of CRM for the sales guys in our office - not as a job role but as a spare time task type of thing - I don't claim to be a developer or anything like that, but I would definitely like to pursue a career as a web developer down the line, I just think I need a much stronger understanding of OO...
I am new to databases and trying to understand the basic concepts. I have learned how to delete data in a database. But one of my friends told me that you should never delete data in a database. Rather, when its no longer needed, it's better to simply mark it or flag it as 'not in use'. Is that true? If so, how would...
I recently converted an old application that was using XML files as the data store to use SQL instead. To avoid a lot of changes I basically created ActiveRecord style classes that inherited from the original business objects. For example SomeClassRecord :SomeClass //ID Property //Save method I then used this new clas...
I was reading a text. It said, "Information presentation must be compatible with the response time needs of systems. The response time should be short enough that the information does not lose its freshness and value but it should be long enough to reduce volume (and costs) and reveal important trends that signal t...
I was curious to know, if juggling between 2-3 projects at a time is a good or a common practice or not. When I say, 2-3 projects I mean: 1. 1 primary project, 2. 1 project with minor improvements/changes and 3. 1 project which comes at times for bug fixes So essentially, I find my self generally working on 2 project...
I've been thinking about how to architect an infrastructure for one of our business applications with the following requirement: Data written by some user can only be read by that user and his superior and a 3rd person yet to be defined I'm thinking in using some sort of asymmetric algorithm, such as RSA for data enc...
I'm asked to perform or sit in during many technical interviews. We ask logic questions and simple programming problems that the interviewee is expected to be able to solve on paper. (I would rather they have access to a keyboard, but that is a problem for another time.) Sometimes I sense that people do know how to app...
I have been looking into how to document software projects more formally, and I have learned about IEEE 830-1998: Recommended Practice for Software Requirements Specifications. However, as you can see from that link, it has been superseded. I know that 830-1998, and probably even 830-1993, are probably just fine for ...
I am trying to setup my application's structure in VS and I want to "try" and future proof it to a reasonable level. This application will be a WPF re-write of an old Winform app that had followed no conventions. No Layers, Tiers, Acronyms, etc... It is a fairly largish Enterprise Application. I planned to use Linq ...
My company is attempting to set up a pub/sub connection using RabbitMQ and sockjs, on Windows servers. I have two questions: My supervisor is calling this setup a comet solution, I was wondering if that is the right terminology? Is there a better solution stack for having a data server asynchronously ship data to a cl...
When cleaning out old data from a set of database tables, is it safer to have the logic in the application or in a database trigger? I am upgrading an application that I wrote a while back (and in a hurried fashion) and one of the things I want to clean up first is ensuring that data which is no longer being used is pr...
To begin with, this isn't a question about which language one should choose :) We're considering a language switch as our general direction is changing from content-driven web sites to data/action-driven web applications. What sort of factors should one think about in order to successfully evaluate the various language...
Suppose we have a model of a human muscular system containing the following muscles each within a specific muscle group: Arms Biceps Triceps Forearms Torso Front Abs Chest Shoulders Torso Back Trapezius Lats Rear Shoulders Lower Back Lower Body Quads Hams Hip & Butt Calves Now, given a list of selected muscle...
The internet is full of references on how to get prepared for an interview. Many websites are loaded with questions and answers. But I can't find any useful information about what exactly an interviewer should do to evaluate a candidate. What I mean is not just collecting good questions to be asked. I am asking about ...
A reoccurring theme on SE I've noticed in many questions is the ongoing argument that C++ is faster and/or more efficient than higher level languages like Java. The counter-argument is that modern JVM or CLR can be just as efficient thanks to JIT and so on for a growing number of tasks and that C++ is only ever more ef...
We're designing a data service that will store a large number of statistics about stocks, including historical data. The client will be a web application, which will need to pull various bits of data to show in different places on the site. Since the different places need to show different sets of statistics, it's not ...
We're using JIRA with Greenhopper, and currently our business analyst has tasks for their analysis which will eventually lead to new stories placed in the backlog, running alongside the stories for the current sprint, and it feels kind of messy - especially because they don't overlap the workflow for the development st...
I'm working on an application which requires user credentials and so on. So a database is required on the backend. What is the best practice to connect to a database without hardcoding your password into it? The program could be reverse engineered and one might get the password which is something we obviously don't wan...
As the question states. What is an 'advice'? More importantly, what does it even mean (semantics)? What's the etymology of 'advice' in the Spring context?
I have for a long time been working on an ODS as well as Data Warehouse. Both are integrating a wide variety of data sources from stove pipe applications. One of the uses of the ODS is to provide data to other stove pipe applications. Imagine one app maintains a database of personnel, and another app manages tracki...
If one would to write auto-suggest for an IDE/code editor (like IntelliSense), does one generally need to write a parser for any language that should be supported, or do compilers/runtimes provide these things? Neither the PHP or Python binaries seem to support just parsing files and generating some kind of raw output....
I think mine is "there's no such thing as a five minute job" - that programmers tend to be overly optimistic about development and that we should really think through a the implications before promising a quick solution to a problem and then diving in to code
I have a need to make a somewhat custom change request system (very high auditing requirements). Instead of completely reinventing the wheel I was wondering if there's an open-source change request system, considered decent that I could write a custom module for? I've done some searching but the ones I have found don't...
We have a web service that takes in input different types of messages. The function of the webservice is to merely write in a database the content of the messages. There is about one table (with foreign keys to others) for every kind of message. We have been asked to transform the webservice in a configurable product b...
Are there any serious studies on how well an experienced programmer who knows language X can understand code written by a competent programmer using language Y, for a good range of widely used languages as X and Y? Of course the real world isn't so simple as a programmers knows just one language. What we'd like to kno...
What exactly does the "Model" part mean? Is it the same as the domain model? I've read that it's a map, but I'm having a hard time understanding the concept.
I am asking this from a purely hypothetical standpoint. According to the Sprint Planning Meeting section in the Scrum Guide: "The number of items selected from the Product Backlog for the Sprint is solely up to the Development Team. Only the Development Team can assess what it can accomplish over the upcoming Sprint."...
I recently upgraded versions of pylint, a popular Python style-checker. It has gone ballistic throughout my code, pointing out places where I import modules in the same package, without specifying the full package path. The new error message is W0403. W0403: Relative import %r, should be %r Used when an import rela...