instruction
stringlengths
34
19.9k
In quality engineering there are 3 phases: 1.quality assurance 2.quality control 3.quality measurement Quality Engineering is defined as “the branch of engineering which deals with the principles and practice of product and service quality assurance and quality control”. Quality assurance is a way of preventing mista...
I'm trying to find an efficient algorithm for the following algorithm. I have a sequence consisting of lists of indices denoting indices to be removed. The semantics are such that each sequence must be performed in order. I want to take these sequences and flatten them into one sequence of absolute indices to be remove...
I have been doing some research on accessing a DB from mobile devices. There are so many different ways of doing it. There are also multiple ways to make it secure. What is a good way to access a database from a mobile device securely? Also considering my specific case, where I have an existing WCF service which does ...
Still learning .net and OOP and have a basic question I hope. This is an asp.net mvc app. Looking at the code below, I am most concerned with the line in CheckShippingVendor that says ValidateDelivery(shipmentItem). Is it okay to pass in an object as a parameter and have the private static method update that item. Wh...
I was wondering the correct way to format a situation such as this, where I have a def, a foreach and an if clause all nested, requiring braces. Currently I find it hard to read, and there is no obvious place to put the 'x =>' bit. Thank you. def getAnswer(): String = { var sum = 0 (0 until 1000).foreach { ...
Having worked on several different web application code bases, I've seen some divergence in how back-ends serving JSON to front-ends structure that data. In particular, when a backend wants to return a number of objects of the same structure. Do you just wrap up all of the objects in an array? What about the "key" of t...
This is a front end project that is using socket.io for all communication with the server. This allows for push which is good, but recently we have been asked to provide a pause button. The pause button is intended on stopping the data from changing out on the ui if the user does not wish it to do so automatically. We...
In this slideshow on slide 26 it mentions ORM as an example of message coupling. How is that so? With an ORM, certain code will call the ORM via an API, but that sounds like "control coupling". Also the ORM's api will take parameters to specify what you want, but that sounds like data coupling. How is ORM an example of...
Problem I am building a PHP application which has a main menu, which in turn contains various "sections" or "subheadings" with various links. There are several user types such as SuperAdmin, Admin, Teacher, Student, etc, and each type should see a potentially different menu structure. It seems that my client would like...
So... We have this fairly complex project (~10k LOC, but there's duplicated code so it's hard to tell) with hundreds of global variables. The project has more dependencies on other projects, and many other projects depend on it too. I have mostly inherited the responsibility to refactor just a part of this project by m...
I have to write a dynamic algorithm for finding lowest cost path. So I have a point that I have to visit. I can jump only between points by distance - 5 I have an array of distance from 0-point for example (1 3 5 10 15 20 21 22). Each move cost me 1. So the best path will be to move 1->5->15->20->22 (3 and 21 I can ski...
Suppose I'm setting up a website, and there are loads of images. These images won't change. But I would like that when any members of the team clone the project, they get the images so that they run the website immediately. Does this mean that I should add track the images as well? I'm just taking an example, it could ...
My understanding is that Goto statements are generally frowned upon. But the publish-subscribe pattern seems to be conceptually similar in that when a piece of code publishes a message, it performs a one-way transfer of control. The programmer may have no idea what parts of the program are subscribing to this message. ...
Procedural programming means coding the application is a series of tasks. Do A, then do B, then Do C. And often wrap these tasks in procedures or functions that can be easily called and run several times in the code. Object Oriented Programming is also often done by doing A, then doing B, then doing C. But objects are ...
It is sometime useful to write a script to perform a batch editing on several files in a source tree. Such a script is usually very specific and used only once. Such scripts can be used to rework some identifiers in code, modify file header comments, edit the path of a resource or the like. I want to stress that I am...
I understand that an interpreter could do one of the following things (and probably more): Execute programming-language source code directly. First translate the source code to some intermediate code (which is less human-readable and more efficient or easier for the interpreter to execute), and then execute this code....
Having recently returned from a Test Driven Development (TDD) course I had the following thought. While writing unit tests using Mockito we came up against of the problem of mocking static methods. It was suggested by one developer we use PowerMock, which allows mocking of static methods, and then we got into a big dis...
I am working on an academic research project whose results and some code we intend to publish. Research journals and conferences explicitly require that the authors have copyright over the work done in a paper. However, I would like to share the code with the community as it progresses using an open source license. Is ...
(define ls1 '((1 . 2) 1 . 2)) (set-car! (car ls1) 6) ls1 (define ls2 (cons '(1 . 2) '(1 . 2))) (set-car! (car ls2) 6) ls2 After set-car!ing, ls1 will be ((6 . 2) 1 . 2) and ls2 ((6 . 2) 6 . 2). It seems that ls1 and ls2 have different storage model, and what does it mean when someone says x is bound to a list? is x st...
I am designing a large application (a static code analyser) and I have a choice in how to organise the code into modules: One approach is by what I'd call by technical function. This is where you have a package for data objects, another for service functions, views, controllers, etc. Another approach is what I'd call ...
I have a number of types that all relate to each other in terms of them being 'derived' from one another. I'd need a way to do is relationships, which made me initially think of classes, but I realized that other than the is relationships, there would be no reason to use classes as each 'type' of data function the exac...
I have a desktop application where the user has tabular views on some data records. Now we got the requirement to let the user select multiple of these records at the same time and let the him edit some properties of the selected records all at once in a separate edit dialog. The idea is to change only the properties ...
I'm building a small reusable library for two systems our company manages. Something that I've been caught up on is whether I should expose a set of properties of type Action<T> for events such as Completed, Aborted, ExceptionOccured, or if I should use the Event<T> T : EventArgs methodology. In practice another intern...
In Chapter 3 of his book The Art of Unit Testing: with Examples in C#, Roy Osherove illustrates the issue of undesirable external dependencies in code under test. He shows this with a method named IsValidLogFileName which takes in a filename string as an argument, reads in a config file from the local filesystem an...
I have an instance of a class UntouchableClass of which I need to access the member variables to use in my DotLiquid template. Problem is, UntouchableClass has to inherit from Drop if I want to use it in my template, but I can't change it since it is from an existing library. I've read about the Adapter pattern, but Un...
I couldn't find a question that was not too specific to some case, so I'll try to make this very generic. We need an extractor base class to a set of documents, for example. Each document has its specific properties, but they're ultimately documents. So we want to provide common extraction operations for all of them. E...
My new boss has been working on this project for many years. I've only been here a few weeks, but I am not sure it's possible. He would like to design a system that is "100% data driven". So if we put in enough data, we can define and generate any application. I've managed to at least get him to concede some things ...
What would be the technical term for a tree that grows in both the directions, starting from the root in the middle? The central idea being that new elements can be added to the tree (Now, I am not sure if it is even okay to call it one) in both the directions. But, when used for traversal purposes, you need to follow ...
Is there a mathematical way to get the following: For the the number 777,888,999 so 777 million and etc etc getMillions(777888999) should return 777 only getThousands(777888999) should return 888 only getHundreds(777888999) should return 999 only This should be done without using regex and without text processing but s...
We work in Scrum with the caveat that we don't have a potentially shippable product at the end of each Sprint, instead requiring several hardening/stabilization Sprints before release. One of the reasons for this is that our chief UX designer prefers that we'll complete all the visual work (such as colors, fonts, exac...
Background I work on a relatively large project (~570 KLOC) in a relatively small team (formerly 5 developers, now 2). Large amounts of code can appear and then vanish in months; for example, a few years ago an investment bank launched a new stock exchange, then shut it down 7 months later—thousands of LOC were written...
I'm not sure if this is a subjective question, I hope not but I'm not proficient with LLVM so I'm just wondering: how come it's become so popular and so widespread used in the industry? Were the optimization algorithms used in gcc/icc/msvc just worse than the LLVM ones? Is it possible that a university project managed ...
It struck me recently that a virtual machine for a high level programming language is very much like an OS. It manages resources, e.g. stack, heap, etc. similar to how an operating system manages resources and if the programming language supports threads then the virtual machine also does time-sharing and context switc...
My professor made a comment today - "...They've been having trouble with filesystem performance, and since they're more graphics guys, they asked us systems guys to help out...". What exactly is "computer systems"? What does it mean to be a "systems guy"? And, what is a "systems guy" passionate about? For contrast, wha...
We currently have an interface for an asynchronous video decoder that runs on its own thread. Basically you feed it some data and it'll eventually call you back on its thread through some events, like so (not real code): interface IDecoder { void Decode(parameters); event FrameReady; event FrameDropped; ...
I am writing a full fledged p2p networking library on top of Indy's UDP server with an intention of publishing it online. The design I have implemented has a P2P manager ( TIdUDPServer ) which can act as a server or a peer. Each connected peer is represented by a separate object which contains additional features and i...
I create a lot of views in my work as part of the common MVC pattern applied in web frameworks like Code Igniter and Cake. I also adhere to the following maxim as best I can: fat models and library objects doing the logic; skinny controllers responding to user actions server side; and views presenting request results a...
I am developing an application containing a class which loads application settings from a configuration file. Settings class: public sealed class MyAppSettings : IMyAppSettings { private IMyAppSettings DefaultSettingsInstance; public MyAppSettings() { DefaultLanguage = "en"; var config = C...
The definition of interpretation (correct me if I'm wrong) is parsing code like so: 1- Translate currently parsed line to some intermediate language. 2- Run the translated line. 3- Move to the next line. 4- Translate it. 5- Run it. And so on. If so, why do people say that the JVM interprets the Java Bytecode? What it d...
In method call syntax in many object-oriented languages, the receiver object goes to the left of the method name, e.g. someObject.someMethod(). This comes in handy when using an IDE with code completion/code assist/Intellisense; when the user types a method call expression, the receiver has already been typed, so the I...
My question is related to C++ but it comes from Java actually. When I was programming Java I had multiple classes, which were derived from a base "Test" class. Their purpose was to test things - run tests (unit tests/not unit tests). In order to run a test, I had a public static void main in every class. So the matte...
Today I stumbled upon the python package called PyContracts. However, python has the assert statement which seems to allow you to do exactly those things. What advantages do contracts have over assert statements?
(I reworded my question to make it more specific). Consider a programming language, that it's programs may only be run inside a specific program that serves as an interpreter. The interpreter scans each line of the source code and executes it as it is. Would the interpreter be considered a virtual machine? Conceptually...
I was wondering what are some techniques to locate which code implemented a specific feature, on a desktop application. I am a junior developer, with only professional programming experience lying around web programming. In the Web it is easier to do that. For example, you "inspect" a button with the browser tools, and...
The Incremental approach is a method of software development where the model is designed, implemented and tested incrementally (a little more is added each time) until the product is finished. It involves both development and maintenance. The product is defined as finished when it satisfies all of its requirements The ...
Below is a pseudo declaration for a multilevel inheritance. Base class ( protected int data) derived1 : virtual public base ( protected int data1 ) derived2 : virtual public base ( protected int data2) derived3 : derived1,derived2 ( private int data3 ) Main(){ base b; derived1 d1; derived2 d2; derived3 d3; }...
I've learned about mocking and stubbing and I've seen how they can help me create great test suites that run blindingly fast and thus speed up my development process hugely. However I've also seen the downside when there is an issue that is database centred and wasn't tested for (test doubles or not). So should I have ...
After doing some research and with the help of people on this site, I finally came to an understanding of what interpretation actually is. Essentially, what interpretation means is (correct me if I'm wrong): Scan a piece of code. Come up with a piece of code in another language, with the same meaning. Execute that new...
In this question I presented an idea I have for a simple programming language. The way programs written in this language will be run, is inside an interpreter written in Java, which will interpret the source code directly and execute it. I would say that there is no doubt that this language would be considered a 'progr...
Suppose I have created interface IFolderRepository with methods like that: IEnumerable<Folder> GetAllFolders(); Folder GetFolderWithId(int id); void AddFolder(Folder newFolder); void ModifyFolder(Folder folderToModify, Folder folderAfterModification); void RemoveFolder(Folder folderToRemove); and I've implemented Data...
I really like scope-based memory management (SBMM), or RAII, as it is more commonly (confusingly?) referred to by the C++ community. As far as I know, except for C++ (and C), there's no other mainstream language in use today that makes SBMM/RAII their main memory management mechanism, and instead they prefer to use gar...
As mentioned in this question, I am moving our team towards objects (as opposed to just throwing DataTables and variables around everywhere). I have picked a suitable spot for the project that contains the object definitions, but not sure how I should go about populating some of the objects. In particular, what do I ...
An example of use case when event sourcing is applicable here whose excerpt is: Say, something went wrong in your app and as a result, a user gets blocked for abuse but that user claims to not have done anything to break rules. Now you can go back to your staging environment and play the events leading up to the...
I have to create a schedule control using WPF XAML for displaying items with duration as little as 1 seconds and potentially as large as couple of hours. First thing which seems clear is that I will need some kind of zoom capability, for drilling into the items with very short durations and zooming out to view the it...
Sometimes I run into the problem of having uncommitted code on a workstation that is not ready for a commit but needs to be completed on a different workstation or laptop. Does anyone have a solution for this problem, such as a "soft commit" or some other way of transferring the changes to another machine to work on th...
How do I unit test a function that takes a list of maps and returns an HTML table with the same data in Clojure/Hiccup?
I have been using Dependency Injection in Spring for some time now, and I understand how it works and what are some pros and cons of using it. However, when I'm creating a new class I often wonder - Should this class be managed by Spring IOC Container? And I don't want to talk about differences between @Autowired annot...
Generally, on many platforms, I'm writing my string resources to a .resx or .xml file, and then I'm getting them using some platform-dependent approach. That is, on iOS, I'm getting them via NSBundle.MainBundle, and by using Context.Resources on Android. What are the advantages of this approach, and why not having it d...
Can you recommend a nice way of checking a particular value between calls to a set of functions? E.g. something like this in Python (might not be terribly 'Pythonic'): self.error_code = 0 # this will be set by each function if an error has occurred self.function_list = [self.foo, self.bar, self.qux, self.wobble] ......
I think I have found contradictory design guidance within the Google Android documentation on fragmentation. The first statement below advises each fragment be unaware of other fragments and always communicate only to the activity and let the activity decides what needs to be done. Creating event callbacks to the acti...
I'm working on a client-server sort of protocol right now in Ruby. I've hit a snag where I'm not entirely sure how to proceed. Currently, I have a class, Remote that signifies a remote connection (for use through EventMachine). When Remote receives a message (i.e, network packet), it sends it off to the MessageDecoder,...
Our team has recently adopted agile practices and most of the team is new to agile. In our product, we use some code developed by another team and only they maintain that code. For the last 4-5 years, the previous developers have merged the code they intended to use and not all of that. Over time, the code in our branc...
I work in a small team of developers that supports several pieces of software that a large multi-site company uses. We use Spiceworks to raise issues and support requests throughout the IT department not just developers. We constantly get tickets raised with the following or similar: "Function X is broken, please fix i...
My Android app needs javax.activation and javax.mail (both GPLv2 licensed). However, I don't want to make my app GPL-licensed. What are the possibilities to not break the license requirements regarding the classpath exception? Currently, I use maven-dependency-plugin to pull those packages' source code and merge the co...
My team is currently working on a web platform and we are planning to divide the application in a set of independent services written in different languages, the problem is that these services rely on a domain model layer that will need to be duplicated across the different languages(C# and Java). The Domain layer is h...
I'm trying to find something that will allow a web application to analyze the line or microphone input from a client and transmit that data to the server. I've looked briefly at WebRTC and, although I find it to be the most compelling answer 'future-wise', it is (at the time of writing) far from being complete and/or s...
http://www.thebuzzmedia.com/designing-a-secure-rest-api-without-oauth-authentication/ I've been reading the article and I haven't really grasped it yet. When is the private key given to the client? Say I have a JavaScript client - where would I store this private key (once assigned) - a cookie? I think that this maybe ...
Lets say I have a Enemy class, and the constructor would look something like: public Enemy(String name, float width, float height, Vector2 position, float speed, int maxHp, int attackDamage, int defense... etc.){} This looks bad because the constructor has so many parameters, but when I create an Enemy i...
I have a property that is loaded lazily, any time after the ctor is called. It is possible that the binary that my property relies on is invalid. If invalid I might have to throw an exception. Should I Make the property a method, and be done with it. Leave things as is. Leave the property as-is, but add a method to v...
At my new place of employment we have a Intranet solution containing multiple web applications hosted in IIS. Outside of the development department other departments either source or create other applications / reports that deep link into these web applications. Unfortunately, I have no direct control over these potent...
I've been asked to draw out the Bounded Contexts (BC) and the possible aggregate and the roots of a School domain. The domain consists of students who study modules on a course. The submit their assignment for a module which is then marked by an external tutor. The 'Marking' firstly sticks out as a BC, but im unsure a...
Generally speaking, is it considered bad practice to allow for user created fields in a database for a webapp? For example, I am making a home inventory webapp for my wife, and she is going to want to define her own fields for different items. I was planning to allow her to create item categories, and add "features" t...
Let's assume this conceptual scenario: The database is constantly populated with "a ton" of tasks named PleaseSendAnEmail. A scheduler/listener in background is aimed to handle those tasks. Of course, rules are that a specific mail shouldn't be sent more than once and that the handling should be the fastest possible. P...
I'm developing a PHP application and I find myself doing basically the same code for, say, creating an object based on a form filled by the user. The objects are of different classes, but the process is mostly the same: take the data from the form, apply validation, save/return error. Is there a way to automatize this ...
Have a quick question on how to best structure something for my Java project: I'm a user. I can work at one or more places. At those workplaces, I have one or more roles. For each of these roles, I work a shift. I either came up with: My workplaces have shifts, my shifts have exactly 1 position (what position did I wor...
I was talking today to a colleague of mine about Python web frameworks and our impressions about them. I told him I think Flask having a global request smells badly and is an anti-pattern. The docs say about request context: In contrast, during request handling, a couple of other rules exist: while a request is activ...
Please consider the following situation: You write a closed-source application, let's call it A. A depends on a system API (i.e. provided by the OS), that is in turn configurable to use different backends. Each backend is identified by a simple string value and also selected via this identifier. The API itself is not b...
As a beginner programmer, I don't know how to conceptually think about brute-forcing. My mind can't really fathom how to write code that will try every possibility. I have a problem that I want to solve. Here is a code snippet (there are other functions, but no reason to include them here, they just do background work)...
I have a project that gets all of its data from API calls. The server that hosts this API connects with it's own database (not even sure what DB it is, etc). More or less the idea of a repository is to separate data and map it, right? I shouldn't be concerned where my data comes from. But if, at the end of the day, the...
I've got a library up on GitHub, with some of the binaries also distributed on NuGet: https://github.com/relentless/Http.fs I'd ignored licencing up until now, but somebody's asking about it so I though I should put something on. I want to keep it permissive, and having done a little research MIT seems like a good one...
I have created a DIFF implementation to compare document revisions at work. It is based on An O(ND) Difference Algorithm and Its Variations. One thing that has become important is to take the list of changes and interpret them into human readable text. While the current algorithm is very efficient, it is so much so...
I have a simple factory class (FileResources) with static factory methods providing a default implementation (DefaultFileResource). public final class FileResources { private FileResources() {} public static FileResource get(Path path) { return new DefaultFileResource(path); } } The problem with t...
We're starting to use dependency injection in a fairly large, interactive program. It's early yet, but I have a feeling that the majority of the objects being injected are going to want runtime data passed in to their constructors. Prior to this, I've only used DI in web applications where building everything at the ...
I'm a junior developer (~3 years' exp.) and at my job we're in the process of architecting a new system. My lead developer will be the principal architect, however he's challenged me to try architecting the system myself (in parallel). Over the course of a few iterations of brainstorming ideas and proposing what I saw...
I was thinking about how I can decouple a web-application completely into a server-side and a client-side component. I want to decouple the app to the extent that I can host both components on seperate servers. So, for example, I would have: Server 1 (API Server): A server-side component running on Django on something...
I'm new to testing but wholeheartedly realize how important it is. The main issue is that my company has no top-down support for testing at all. That is we don't have any unit testing and just a bit of human testing (I hope I'm using the right terminologies). I have been trying to get testing started here and have to d...
I have a package of code which is suppose to tell me where to allocate elements. When I add a new element it may require repositioning of existing elements to keep my 'tree' in a format that promises a log-n search. Ultimately when I hand it a current system and new elements to add I should get a list of where to add...
I've been reading 'Introduction to Evolutionary Algorithms'. This method is stated, but not described, and I can't find anything more specific online. p44/45 of 2nd Ed for reference. adding to the current gene value an amount drawn randomly from a Gaussian distribution with mean zero and user-specified standard deviat...
I am writing a Rest API and am wondering how best to handle supporting the different versions. By this I don't mean how to define a URI as V2 or V3, but rather how to structure the code given that it'd need to: Support multiple versions at the same time, eg. V1 & V2 & V3 URIs must be live at the same time. I would ret...
If there are two unrelated tasks, except that the changes are in the same project, and end up touching at least one of the same classes/methods, how do I manage that? Two different developers could each pick up one task. Each dev will create a new branch off of Integration, work in it, then need to Merge. When Merging...
I'm working on two separate projects now that are essentially just CMSs -- a bunch of forms for recording various bits of information. Each project is built to serve many clients, and each client seems to want to record slightly different information. In one project we've handled this either by copying and pasting all ...
I'm new to TDD and wondering about methodolody. Given: A simple project which implements functionality of, for example, a console calculator. It has the following structure: Fairly simple top-level class that takes console input, delegates it to a buisness-logic class and shows output in the console with some fancy ...
In software design, we usually take care of UML diagrams and architecture design. But in case of a data analysis software, we must pay attention to design algorithms and stuff like that. Consider the case of a face detection software which needs AI. Do we need to design AI part of the software explicitly in software de...
That doesn't seem to make sense. In local variable, we sort of know the type anyway. It's local. We're working on it. Yet in function name or global variable, the definition is very far away on other files. It seems that hungarian notations make far more sense there. For example, in objective-c I used this +(CGFloat) f...
From the OSI's OSD: Free Redistribution The license shall not restrict any party from selling or giving away the software as a component of an aggregate software distribution containing programs from several different sources. The license shall not require a royalty or other fee for such sale. and Derived Works ...
I am busy writing a bare-bones Standard C Library for my hobby OS. I am only including the functions I really need for now but the library is still referenced as 'libc' in my source and I plan to expand it to a fully featured C Library. My OS is going to be released as open-source so I would like to know what kind of c...
I see that some software have the version number included as a part of their file name, while others do not. I am more used to the latter type, and I think that is more popular, but I see the former type sometimes in javascript libraries. For example, jQuery's file name is like jquery-2.1.0.js instead of jquery.js. Whe...
The company I work for has commissioned a software company to produce a compliance software for several big companies. As part of our contract it is required of them to provide us with src code and documentation in case in the future we want to take over and further develop the project in house or have another company ...
I checked with meta and apparently this is the best place to ask! The company I work at have many environments, and as such, many Nagios/Icinga etc boxes in each environment. We currently have a dashboard, but it was created quickly many moons ago and needs replacing. It currently scrapes the HTML of every box, builds ...
We developing a web service. And need our important actions (i.e. money transfer) to be protected from accidental calling. In frontend we asking user to confirm such actions. Ok. But how to prevent accidental calling in case of developer mistake? Is it good idea, that action require some confirmation token from develop...