instruction stringlengths 34 19.9k |
|---|
Main excuse from the developer for not having a good unit testing is "Code is not designed in a unit testable fashion." I am trying to understand what type of design and code that can't be unit tested.
|
I need to create an information service on trains to deliver live information. I am looking for some ways to go about this.
There are already existing LCD monitors in many of the train wagons. They are powered from the battery. When the train is moving, I would like the screens to display the following information:
... |
I was having a think tonight while pondering over some application I need to change and it got me thinking. Entity Framework Entities are POCO (Plain old CLR Objects) and models used in ASP.NET MVC are usually also POCO. This basically means just properties, no methods.
Now OO programming normally allows an object to e... |
I've been working through this article to organize my front-end code. It references articles on BEM / SMACSS, which in turn reference other articles.
I'm really trying to understand what the best practices are ... I have a few days to lay down this "standard", and then have to burn through a high-priority / high-visib... |
Premise: I know that such a game would be better solved by MCTS, however, from a theoretical point of view, would it be possible to apply minimax to a bayesian multiplayer game where the order of playing is determined by result of the previous turn?
Game description:
Players: {A,B,C,D} (A and C are the maximizing team... |
We concatenate CSS and JavaScript files to reduce the number of HTTP requests, which improves performance. The result is HTML like this:
<link rel="stylesheet" href="all-my-css-0fn392nf.min.css">
<!-- later... -->
<script src="all-my-js-0fn392nf.min.js"></script>
If we've got server-side/build logic to do all this for... |
My office department logs in to the ISP Server through a keep-alive-browser login page. This, for better performance, is encapsulated in to a small python script.
This is what it does (Pseudo code)
1.CheckForActiveInternet
2.if not active
Login
KeepAlive
3.else
report
In step 1, a host like "www.google.... |
I am doing a restful web api with asp.net Web API 2
I do not want to use any form of cookies or basic authentication (send user/pass in cleartext thus SSL needed)
I do not use/need claims stuff.
I have not decided yet about asp.net self hosting or IIS.
I just want to send an encrypted token between client server via SS... |
In my search for a practical non-turing complete programming language, I've been paying attention to lambda-calculus with disallowed self-application - that is, x x forbidden. After taking that language and augmenting it with lists and the foldl and range operations, pretty much any algorithm I've tried so far is imple... |
I am interested in developing a program that generates an endgame table-base for the chess.
I have gone through the technical papers of the greats like Shannon and Ken Thompson. I have found that retrograde analysis is used for the generation.
How can I generate all positions in a KBBK chess endgame which are mates in ... |
I am confuse about scrum .it is methodology or Framework?.
I want to use scrum for development but i want to develop scrum tool but i am confuse scrum is methodology or framework?
|
I am new to c++ and have been making the good old Calculator. I have gone forward from a 2 value calculator to a 3 value calculator and wondered.. How is it possible to make a 10 digit calculator (purely using +,-,*,/) that doesn't forever to code.. I have a if statement which returns what happens if the operators are ... |
Consider the following program:
#include <stdlib.h>
#include <stdio.h>
typedef struct S_s {
const int _a;
} S_t;
S_t *
create_S(void) {
return calloc(sizeof(S_t), 1);
}
void
destroy_S(S_t *s) {
free(s);
}
const int
get_S_a(const S_t *s) {
return s->_a;
}
void
set_S_a(S_t *s, const int a) {
int ... |
I need to design an online exam server for an exam like GRE in which question difficulty increases if you answer correctly and decreases if you answer wrong.
Questions are multiple choice questions
Difficulty scale of question is 1-10, 1 being the easiest and 10 being
the hardest.
If two continuous questions are ans... |
I need to design an online exam server for an exam like GRE in which question difficulty increases if you answer correctly and decreases if you answer wrong.
Questions are multiple choice questions
Difficulty scale of question is 1-10, 1 being the easiest and 10 being
the hardest.
If two continuous questions are ans... |
I was once told to read the books titled 'The Pragmatic Programmer' and 'The Mythical Man Month'. I have very little experience programming (basic HTML, CSS and JS).
If I were to purchase these books, read through them, would it be beneficial to me with such a limited understanding or would I benefit from them?
I ask b... |
I need to track permissions and access requests to a file server in a database. I'm given the full path of the folder and am considering parsing the path (splitting on the "/" character) and creating a self-referential link to the table... in addition to a column intended to store the full file path.
What is the ideal... |
Let's say I have the following classes: person, widget, foo_bars.
A person can have multiple widgets and foo_bars.
When an admin deletes a person, I want my code to do a cascading delete... and remove all related records in the database for this person
In my widget class, I have a delete method... and the same is tr... |
I'm writing a card/ board game in Java. Since the game has lots of cards that interact in different ways, my Player class has become sort of bloated with all these different fields used for keeping track of data that specific cards need. However, not every card is used in every game, so many of these fields are not u... |
I'v developed an internal singe-page web-app (unix, apache & postgresql) protected by a simple login page. Currently, the users have their own login role with a password.
This is starting to get cumbersome for a couple reasons:
Users have multiple passwords (for my web-app and Active Directory, the company-network is ... |
A lot of issue trackers support something called "milestones". I've never found a use for them. It seems that milestones are only useful when you do big, scheduled pushes, but not if you roll out new features and bug fixes as they're completed.
When/how would you use milestones to organize agile development?
|
This is more of a conceptual question.
I have learned about Neural Nets, and I have some clue as to how Support Vector Machines work. I read somewhere however that given the appropriate kernel (is that right?), the SVM is identical to the Neural Net. Could someone who understands this please enlighten me as to how that... |
Which one is considered better:
having a directive that interacts with services directly
or
having a directive that exposes certain hooks to which controller may bind behaviour (involving services)?
|
I would like to know arguments for/against this concept.
Technologies in use from the bottom up:
MSSQL 2012 DB (exclusively accessed via sprocs)
Entity Framework
WCF Web Service
ASP.NET Webforms
Someone on my team would like to use Entity Framework to map the sprocs to ComplexTypes, and then use those ComplexTypes... |
Aren't both just a set of instructions that get executed by some interpreter? (contrary to a full-fledged program, which runs (gets executed) at some computer system?
|
This claim by Aleks Bromfield states:
Almost every language with a static type system also has a dynamic type system. Aside from C, I can't think of an exception
Is this a valid claim? I understand that with Reflection or Loading classes at runtime Java gets a bit like this - but can this idea of 'gradual typing' be ... |
On this blog post aphyr (who is a brilliant programmer) states:
Clojure macros come with some important restrictions. Because they’re expanded prior to evaluation, macros are invisible to functions. They can’t be composed functionally–you can’t (map or ...), for instance.
The classic example of this is:
(reduce and [... |
All programs I have seen organize their data memory into one or more call stacks (usually fixed size, but sometimes not), the heap, and static memory. Lately thread-local static storage has been added to this as well.
Have there been any attempts to organize data memory layout in a radically different way, e.g. withou... |
This is an open-ended question which I am analysing while doing some fun projects in leisure. Websites like Google, Facebook do store user activities and perhaps sell them or use them for advertisements. But I believe anonymity is maintained. For instance, I need to expose that there are 5 people between age 45-50 who ... |
I am a bit new to DDD and bear with me if my understanding seems way off.
My question is about Udi's solution to domain events, particularly the class DomainEvents (see code below)
An excerpt from Udi's code. It lives domain model as a static class.
public static class DomainEvents
{
[ThreadStatic] //so that each ... |
I am creating a program (mostly just for fun) that displays live prices for horse racing markets and the prices that several models predict they should be. I am very interested in the optimal way to structure this kind of data.
I need a Dictionary<int, (something)> to store <raceId, data> where the key (raceId) is a nu... |
I have a class with a validId($id) method that is called by the constructor and by public function load($id). The method queries the database to see if the id exists and returns true/false.
The constructor optionally takes an $id (if no $id, then the object will be empty).
The constructor checks the $id with validId($i... |
I have been learning python from no long time ago. But nearly at the beginning I stumbled on simple question:
how to set a restriction (limitation) on object value or object's properties without making a difficult class description. There is no problem with python's unstrict typification. I search for the methods to co... |
I am trying to make a program in Java which measure the complexity of a specific program with respect to its run time. Let's take a problem and code that problem in all possible ways with respect to time complexity, let's say we can write code for a specific problem in O(n), O(log(n)), O(n log(n)) and O(n^2).
I will re... |
I'm a little bit confused about code coverage criteria; especially condition and edge coverage.
As stated in this book, edge coverage does not subsume condition coverage; BUT my lecture material defines condition coverage in the following way:
Edge Coverage Criterion: Select a test set T such that, by executing a progr... |
It seems to me that this is often encountered in practice and I was wondering if there is a design pattern for the following:
Suppose I have a class that represents a card:
public class Hand {
private static Random rng;
private Rank rank;
private Suit suit;
public Hand() {
if (prng == null)
... |
I have an admin controller that is just used for its index action which renders a view with the most recent updates to certain resources:
class AdminController < ApplicationController
before_action :authenticate_user!
layout "admin"
def index
@events = Event.last(3)
@foos = Foo.last(3)
... |
I don't know how to word this easily but basically the software I am writing has a ton of actions and I want to assign hotkeys to every one of them so power users can work super fast.
First off they are not actions related to the application itself, i.e. Quit, Maximize Window, About, Preferences, etc. But rather actual... |
I've worked on a large financial transaction system for a bank that looked after Pensions and Investments. After 15 years of feature changes, the manual regression test cost had climbed to $200K per release. (10M LOC, $10M transacted per day). This system also interfaces with 19 other systems around the company moving ... |
All of the below relates to a ASP.NET c# app.
I have a Singleton Settings MemoryCache that reads values from database on first access and caches these, then invalidates them using SQL Service Broker message and re-reads as required.
For the purposes of standard controllers, i create my Db Context in a request scope.
Ho... |
I would like to hear some improvement suggestions for mobile development (Android/iOS) project architectures.
I would like to go for a "safe" design, modular and that can be easily maintained in time.
As far as I know Android and also iOS platforms are built on MVC, at least have the Activities and UIViewControllers th... |
While writing in C, I have always wondered about when is the best time to use an external variable. I generally prefer to pass a pointer into a method. Is there a correct time to use an external variable and a correct time to use pointers?
|
So imagine the following the happens (and that we're all using SourceTree):
We're all working off origin/develop.
I go on holiday for a week.
My coworker has been working locally for the past several days without merging origin/develop back in to his local develop branch.
He tries to do a push, gets told he has to me... |
I have inherited of an application and need to reorganize and I hope I will be able to modularize the tons of Javascript that is everywhere.
It is a multi-page webapp. Each page has a script tag in the header, which currently contains a DomReady handler which initializes all user event handlers for that specific page, ... |
The commentator here offers the following criticism of green threads:
I was initially sold on the N:M model as a means of having event driven programming without the callback hell. You can write code that looks like pain old procedural code but underneath there's magic that uses userspace task switching whenever somet... |
The C99 standard says in 6.5.16:2:
An assignment operator shall have a modifiable lvalue as its left
operand.
and in 6.3.2.1:1:
A modifiable lvalue is an lvalue that does not have array type, does
not have an incomplete type, does not have a const-qualified type, and
if it is a structure or union, does not hav... |
I'm interested in creating an chess endgame solving engine.
The endgames in chess are usually solved using the endgame table-bases generated by retrograde algorithm.
I have found that Artificial Intelligence and Genetic Algorithms have been applied to the chess programming.
However, before starting the implementation ... |
I distinguish three organisation levels while programming: the library level, the component level and the application level. A library defines functions to solve a range of related problems or preform related operations in tools and no policies manner. An application lets several libraries interact and defines policie... |
I'm currently working with a company that uses Java / Tomcat / Spring for the back end of our web applications. As a front-end developer, I'm feeling more and more strongly that the back end should be a separate project from the front end, for a few reasons:
1) Building the project - many modern projects build with gr... |
How should I go about evaluating the performance or execution time of C++ with CLR versus native C++?
My personal bias is that I believe C++ with CLR to be slower since it has to run on a virtual machine. I will also admit that I have never really been a fan of Visual C++ due to the syntax that has been added, so I wa... |
I am making a WPF application following MVVM model. I have seen some approaches for applying MVVM. I am concerned about my MainWindow.xaml. In some tutorials I have seen that MainWindow is only hosting a ContentControl, and in some first main page of the application.
I am making a wizard type application. There are mul... |
In the evaluator of a custom language, I would like to replace our own sort routines with std::sort or other routines, possibly tbb::parallel_sort. The problem is that we allow users of the language to supply their own comparison routine, and in the implementations I have tried, std::sort does not take kindly to routin... |
Is it ever really acceptable to reassign the model for a view in MVC? (Or MV* where applicable.) In other words, for a single view instance, is it ever ok to reassign the view's model? That is, as opposed to using setters (mutators) on the model so that it does not have to be reassigned. Under what conditions (if any) ... |
Kind of a best practices question: is it better to merge directly from the source to other branches or is it OK to merge from a merge?
Using Subversion for source control.
Scenario:
Branch A has changes made and committed.
Branch B and the Trunk both need updates.
Case 1
Merge from A to B and again from A to Trunk.
o... |
While working with asp.net, I came to an approach that uses asp.net services for the data/business logic layer and html/javascript/jquery for the UI layer, because I could not reach the needed level of customization of the user interface with asp.net web controls.
While I've seen plenty of books describing usage of asp... |
Here is my Solution and projects:
BookStore (solution)
BookStore.Coupler (project)
Bootstrapper.cs
BookStore.Domain (project)
CreateBookCommandValidator.cs
CompositeValidator.cs
IValidate.cs
IValidator.cs
ICommandHandler.cs
BookStore.Infrastructure (project)
CreateBookCommandHandler.cs
ValidationCommandHandler... |
I'm having trouble formulating this problem as an algorithm:
I have a set of conditionals (combined with &&) and operations, for example:
if (A && B)
execute C
else if (D && A)
execute E
I want an algorithm to find the optimal "if-else" tree that minimizes the amount of duplicate code. The optimal branching fo... |
A new requirement has surfaced on an old codebase, that basically enables direct (internal) communication between two formerly not-directly related classes of users (stored in different tables with completely different schema and, sadly, the code is barely OO-aware, much less designed, so there's no parent class). Sin... |
As a beginner to J2EE, I have recently started developing my own project from scratch using the Core of J2EE : Servlets & Jsps.
I could not evaluate whether my project folder structure is right or not.
Here is my project folder structure.
Before asking question, I admit that I could not answer or neither justify if so... |
My MVC (.NET) has some constant values through out the site, such as the phone number, physical address, email address etc.
I'd like to store this value once, so future updates are easier for when they change their details.
To make my question simpler, I've only focused on phone number.
My question is where and how to... |
Why does DrRacket (kind of Scheme) IDE highlights some of the identifiers as "keywords" (for example define, lambda, send*), and the others as "symbols" (user defined identifiers, +, -, abs, send, send+, etc.)?
I am particularly confused by the difference between send* and send+. For reference, here are the beginnings... |
Forgive me for my poor English, me and my friend were doing school homework, suddenly he asked me to read this line of code ptr = &array[1][1][1] (ptr is a pointer to an integer).
He said
ptr is pointing to the address of the second element of the second
column of the second row of an array.
I think he will be ri... |
I'm starting work on a new personal project and I'm looking to get advice in regards to setting up my classes.
My base class is a User. The User class will have the following general properties
User ID
User Name
Password
Address (this will be a complex/value type)
I will then have a Subscriber class which is a User w... |
I have a main application that can load modules (or plugins). Each modules can define one or more links (or items) that will be displayed in a side menu defined in the main application.
Right now, my main application execute a list of ItemProviders which are loaded from the modules. These ItemProviders return a list of... |
I have a bunch of classes that look something like this:
public class MyGame()
{
private Graphics graphics;
private Player player;
public MyGame()
{
graphics = new Graphics();
//...
}
protected void Initialize()
{
player = new Player();
//...
}
pro... |
Is there an algorithm that, given a sorted array, swaps all the first unique elements to the beginning of the array and the duplicates to the end, while remaining stable for both the unique subarray and the duplicate subarray, and that runs in O(n) swaps (and preferably one pass)? It should return the length of the uni... |
I am using Microsoft ASP.NET Web API 2 and one of my end points has to internally invoke a legacy non-Microsoft web service (not asmx or svc) .
Which layer should I invoke this in?
I currently have :
Repository layer: where all the CRUD calls to DB are done now.
Domain Manager: where respective manager classes invoke t... |
The question is fairly self-explainatory.
Is it worth using VCS (Version Control Softwares) for hobbystic/small/personal projects?
|
After reading lots of pages on various sites, I came to the conclusion that abstract data-type (ADT) helps to separate the use of a data-structure from its implementation. We can easily map the data into a data-structure by using an already available abstraction. And this abstraction is called ADT. Please tell me if I ... |
Lisp and Fortran were the trunks of two separate evolutionary trees,
one rooted in math and one rooted in machine architecture.
I see this in Hackers and Painters: Big Ideas from the Computer Age.
And someone said that Lisp are Human oriented and Fortran are Machine oriented.
Here human oriented means that the w... |
I have gone through many Google App Engine tutorials, and I became quite familiar with how to do basic stuff like implementing a webapp2.RequestHandler, and using ndb.Models to manage your data.
Now, I kind of reached a wall with a few small concepts that were either missing from the resources I went over, or I simply ... |
I'm having quite some doubts here... If I have a table related to username/password login how can I assure there won't be any more matches of the same username and password in the same table using sql? For example:
>username: username
>password: password
^this user just signed up. So the following conditions apply:
1... |
I have been asked this question and even after a lot of research, I cannot find the answer.
When I design a database using Entity relationship (ER) and then re-draw it as UML class model (extended with Data modeling profile for UML), what are the differences and how both models can be (in their way) useful for db devel... |
When you read C, C#, Java, Python, PHP and many other programming languages all the syntax is written in English.
Simple code like this
if (X+1 > 4) {
}
while (A == true) {
}
Is written in English even if the programmer's native language is something else.
Would it not be more effective to allow the programmer to use ... |
I'm trying to teach myself some design patterns using a book that I was recommended, Head First Design Patterns. I came to the chapter on the Decorator Pattern, and although I understand the purpose of it, I'm a bit fuzzy on it's layout.
Here is their basic UML of the Decorator pattern:
Imgur
(Sorry for the link, but S... |
My research-based company's name is already taken on github (mailed the owner without any luck), what is the most recognized naming conventions for company github accounts besides the name directly?
the only ones I found was ibm-dojo and ibm-research
|
Why do need namespaces when we have nested classes. What can be done through namespaces, can also achieved through nested classes.
so I don't understand the reasoning of having namespaces ?
|
I have seen many frameworks and modules and their standard they follow is like this
UserInterface which have some predefined methods
AbstractUserClass which implements userInterface
Then GenericUserClass which extends from AbstractuserClass
Then other classes extending from that generic
Now I have seen that abstract ... |
I was looking into an open-source game framework project written in Java. It has several classes that:
Have public instance variables.
Have getter/setters for such variables.
Generally, I write getters/setters when I want to encapsulate some behavior that occurs when a property is modified.
However, looking at the co... |
We are trying to start a web base project that need to develop based on MS technologies such as C#,.net, IIS etc. This is a web application suppose to sell as a product with a single installer.
Now we are discussing which kid of database we are going to use.
Some says non-embedded database (Ms Sql) Some of them idea i... |
I just stumbled upon Clojure reducers library.
It looks a lot like loop fusion. However the term is not mentioned anywhere on the page. Is there a difference between the two?
|
Foreword:
In this post, I will make the common confusion between O(n) and Theta(n) as complexity notations.
I will write pseudo-code to talk about algorithms, using whatever notation I find to my liking.
I know, yet another question about nested loops and complexity.
I recently wrote a nested algorithm, that would w... |
I am writing a client server application. I wanted to fully separate the server logic, from the view. The first thing I wanted to to, is to make a sort of a message log.
The server itself should not know if the messages will be shown at a GUI, or on the console.
What I was thinking, would be to have a handler method, t... |
I am using a LGPL v3 library and have made upgrades to it. Before using these upgrades, I understand I have to publish them. That's al-right.
Is it legal if I perform upgrades that use a commercial library of
my own (upgrades will be published, but not my commercial library)? Note: usually, questions are the other sid... |
I am working on a list comparator to assist sorting an unordered list of search results per very specific requirements from our client. The requirements call for a ranked relevance algorithm with the following rules in order of importance:
Exact match on name
All words of search query in name or a synonym of the resu... |
I'm designing a multiplayer game server where the players are in rooms. Right now I have classes to take care of the client, networking, etc. I'm struggling however to find a design for this Room class. For example, when I want to change a client's room, should I call client.changeRoom(newRoom) or newRoom.addClient(cli... |
I'm trying to find a way to collect data from different servers around the world.
Here are the details:
There is only one single PowerShell script on servers that encrypts data (simple csv file) and sends with preferred method (HTTP/HTTPS Post could be)
There is no more control on that servers. Can't install any servic... |
In Android, final strings are stored in a strings.xml file, which makes it easy to update text, reuse strings and to translate an app to a different locale -- because everything is in one place.
However, in all the examples that I have seen of desktop applications all the strings have been hardcoded into each class.
I... |
Use case:
For an administration UI, I want an interactive table widget with a number of behaviors:
Collapse / expand (yes, this means the rows are a hierarchy)
Update of data in a child cell based on a parent cell.
Hiding or revealing of a row or an entire sub-tree based on a value update.
Two or more form elements in... |
ok, am just looking for a win loss code example. This can be for any language, just wanting the outline. Fairly new to programming, so dummy it up for me :)
I can do (win-loss/total of win loss). Guessing that is a good standard win loss ratio, but I don't want a new person that has 1-0 to be ranked higher than someone... |
I'm developing a small open-source javascript library, and I was wondering about the proper method for compiling the source into one javascript file.
It's easier to develop if the code is split into multiple files, but libraries are included as one large file when used in another application. My current "compilation" ... |
In alloc.h of djbdns-1.05 there's the following code:
extern /*@null@*//*@out@*/char *alloc();
My question is about the goofy-looking /*@null@*//*@out* “decorator.” I assume this is “just a comment” with some significance to djbdns's build system. But I can't find anything referencing it in other files.
Anybody know ... |
Often you can see answers like “Avoid using C libraries in your C++ code“ or “This can be rewritten using STD/Boost in pure C++“.
I understand C++ produces more maintainable code and has many advantages, but is it actually bad using C libraries when performance is a priority? I mean writing in what is sometimes called... |
If java/C#/etc one might do something like create a constructor with a parameter, the parameter being the thing the rest of the object may act upon. How is this done in JavaScript? I'm trying to figure out what the best practice is with JavaScript to do something similar to this C#/Java Object.
public class Blagh{
... |
Is it a bad idea to add a new method (that implements a new algorithm) to a class library for its new version and expose a version option the consumers can select?
It is just for backward compatibility where an old application might need a constant sequence of random numbers for a certain seed number.
The following co... |
The book C++ Templates: The Complete Guide, (c) 2002, looks very appealing to me, but as it's 12 years old, I'm concerned it may be out of date. There are some highly favorable Amazon reviews dated as recently as a year ago, and I don't see any other very recent titles on C++ templates. Does anyone know whether a boo... |
Is it really necessary to mention the same impediment (blocking issue) in every daily standup, if the whole Scrum team already know about it because it's been mentioned at previous daily standups?
|
I have read several posts which discuss coding standard for naming the unit test methods for improving readability.
I follow this NameOfMethod_ExpectedBehavior_WhenSomeScenario, but now I am confused as to how should I continue with this in the face of overloaded methods. There can be several methods with same name but... |
At choosealicense.com/licenses I am reading the Apache licensing, and see that under Permitted there stands Commercial Use:
This software and derivatives may be used for commercial purposes.
Meaning, they can use (and modify) my app, in a commercial environment (e.g. Microsoft, Apple). Or, they can commercialize my a... |
There seem to be quite a few ways of communicating between directives. Say you have nested directives, where the inner directives must communicate something to the outer (e.g. it's been chosen by the user).
<outer>
<inner></inner>
<inner></inner>
</outer>
So far I have 5 ways of doing this
require: parent directiv... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.