instruction stringlengths 34 19.9k |
|---|
I am working on a large asp.net app as a single developer. I will often work on a number of change requests concurrently. For example, a change required to the Finance component and a change required to the sales component.
I sometimes create a separate project to hold the changes and then reference the main applicat... |
Just out of curiosity. There are many open standards for data exchange, as well as standards for exchanging code (jsonp, for example).
But are there any standards for exchanging formulas/rules, for them to be executed on different platforms?
|
I am trying to reduce my problem to a max flow problem so I can run the max flow algorithm on this problem. But there are some things that I am missing while transforming my problem.
My problem is:
there are classes with a maximum capacity
there are students and their wish-list that includes 5 classes that they want ... |
I am looking for an I/O model, in any programming language, that is generic and type safe.
By genericity, I mean there should not be separate functions for performing the same operations on different devices (read_file, read_socket, read_terminal). Instead, a single read operation works on all read-able devices, a sing... |
I wonder if object initializing have some performance gain in ASP.NET website. I have an office mate that told me that object initialization is much readable and faster than constructor. But one of my office mate disagree with that and said that it always depends.
For example I am doing this:
using (var dataAccess = ... |
How can I make 1 class (base, generic or something else) from these two classes?
class A
{
A Link { get; set; }
}
class B
{
B Link { get; set; }
}
UPD: This is what I have now:
class BSTree
{
public BSTNode Root { get; set; }
}
class AVLTree
{
public AVLNode Root { get; set; }
}
class BSTNode
{
public BST... |
In recent years I've developed a habit of formatting SQL SELECT queries like so:
SELECT
fieldNames
FROM
sources
JOIN tableSource ON col1 = col2
JOIN (
SELECT
fieldNames
FROM
otherSources
) AS subQuery ON subQuery.foo = col2
WHERE
someField = somePredicate... |
I'm working on an old codebase which is... not perfect, in an environment which isn't either. It's not the worst codebase I've seen in my life, but there are still lots of issues: zero unit tests; methods with thousand+ lines of code; misunderstanding of basic object oriented principles; etc.
It hurts to maintain the c... |
We've all had this experience. You go to someone who you know has the answer to a question, ask that person the question and they answer with the typical response: "why?" You explain why you need to know, and they attempt to solve your problem.
It takes time, arm twisting and patience to steer the conversation back to ... |
I was studying Mediator Pattern and I noticed that to use this pattern you should register the Colleagues into Mediator from the Colleague concrete classes. for that we have to make an instance of Mediator inside Colleague concrete classes which violates IoC and you can not inject the Colleagues into Mediator (as far ... |
I am currently learning about TDD and trying to put it into practice in my personal projects. I have also used version control extensively on many of these projects. I am interested in the interplay of these two tools in a typical work flow, especially when it comes to the maxim to keep commits small. Here are some exa... |
I'm writing a game that has a lot of time based aspects. I use time to help estimate player positions when the network stalls and packets aren't going through (and the time between packet's being received and not). It's a pacman type game in the sense that a player picks a direction and can't stop moving, so that syste... |
I'm trying to put together an algorithm that will display the node degree for every node in a breadth first tree graph (assume BFS was called). Assume it's an undirected graph. I'm not sure how to get the node degree of a node when going through the graph. I was thinking about adding up every occurrence of the node ... |
About duck typing:
Duck typing is aided by habitually not testing for the type of arguments in method and function bodies, relying on documentation, clear code and testing to ensure correct use.
About argument validation (EAFP: Easier to ask for forgiveness than permission). An adapted example from here:
...it is co... |
I just had a doubt in my mind. The following subroutine(to search an element, in a list, for example) has a return statement at the end:
list *search_list(list *l, item_type x) {
if (l == NULL) return(NULL);
if (l->item == x)
return(l);
else
return( search_list(l->next, x) );
}
I cannot get the significa... |
I've heard ProGuard's Jar shrinker affects the performance of you application. Is this true? And if so just how much slower does the Jar go shrinked compared to unshrinked?
|
I am a bit puzzled on whenever or not to include break after the last case, often default.
switch (type) {
case 'product':
// Do behavior
break;
default:
// Do default behavior
break; // Is it considered to be needed?
}
breaks sole purpose is in my understanding to stop the ... |
I need to generate a hyperexponential distribution for my project. I have already implemented a poisson generating algorithm given by Donald Knuth, but I couldn't find an algorithm for generating a hyper exponential random variable.
I am provided with the mean and variance required of the distribution and I need an alg... |
I'm currently working as an intern at a very large, non-software development company. The position I applied for wasn't specifically a development position, but the team that hired me wanted a CS major to help try to develop some internal projects for them. I've been here for four weeks and the initial bewilderment i... |
I am trying to prepare my first software design document. I am self-taught and have no formal training in CS. Having done a wee bit of reading up on it beforehand, I have created a list of Requirements, Qualities and Non-Qualities for the system, which provide an overview from a managerial viewpoint on what the project... |
I have to solve a problem in the field of operations research. I want to gather some general approaches to evaluate them to pick the most promising to design a problem-related program.
Problem definition
Company ACME that sells customized collages and has a production that adheres to mass customization principles.
Pro... |
Most of my programming experience is in OOP where I have fully embraced the concepts thereof including encapsulation. Now I'm back to structured programming where I have a tendency to logicaly seperate my code using subprocedures. For example, if I have a large switch case (30 cases or more), I'll put that in it's ow... |
I have been teaching myself Python as a first language for 2 years now. So far I have done some online courses (NLP, Design of a Computer Program etc.) and solved some puzzles but never worked with big applications.
Yet right now I have the opportunity to do some real work with Python on a project at my university. It'... |
I have a product that lets game developers create games. Inside of their games they are required to give all the elements of their games GUIDs. I've told them that they need to generate their guids using a specific mechanism, but they seem to think that it won't cause any issues. What I'm concerned about is GUID collis... |
I often use static "factory" methods to create objects from database.
class Job {
protected $objDb;
public function __construct($objDb) {
$this->objDb = $objDb;
}
public static function LoadArrayByProjectId($intProjectId, $objDd) {
//some code that loads the jobs
$objJob = new Job($objDb);
$arr[] = ... |
I'm building a contest where you can win prizes by opening boxes. Whatever the box is open, i just send a request to the server to test if the user won something. Since this contest is not a "Register and we'll draw a winner after some time" type of contest, i'm a bit puzzled at what algorithm i should be taking to cal... |
Most issue trackers are targeted towards developers. But when working in a small team that includes business people: does it makes sense for them to put non-dev issues inside the tracker?
I must say I have never heard of that combination. In my full-time job the business things are done somewhere else. But in a star... |
In the project I'm working on, I'm using Guice and trying to do as much as possible with Dependency Injection. However, there's one little snag; many of my objects rely on an object Context. This is an immutable object but has some information which most of the other objects need to function properly. It never changes ... |
As a programmer, and taking into account the overall "funness" of the process, I'm tempted to start a project in Sinatra where the back end's sole concern is the logic, and returning a Json API, and then writing a javascript application that would interact with that API for rendering the actual content to the user.
I'm... |
I derived an open-sourced work, Service-Nucleus, based on Netflix's Karyon (Apache License) and Google's AngularJS (MIT License).
I want to make sure proper licensing and copyrights are in place, and I am not sure how to honor those projects and move forward legitimately at the same time.
I've researched this to some l... |
I'd like to state first that I'm a 19 year old programmer living in Portugal, and have recently started my first REAL programming job.
I say "REAL" because at my previous jobs, I was normally the sole developer just working on creating and updating a sole website and further developing ideas for the company. (I've work... |
Imagine this scenario:
You've created a multiplayer game app for a mobile platform such as Android. You successfully set it up with one server, you figured out how to do that. It works quite well.
To your surprise, the game TAKES OFF. Server demands explode. You need to scale, but you have hardly any experience with ru... |
I know there have been countless discussions about this but I think this question is slightly different and may perhaps prompt a heated discussion (lets keep it friendly).
The scene:
I am developing a system as a means for me to learn various concepts and I came across a predicament which my brain is conflicting with. ... |
We are looking into enabling Sql Server Change Data Capture for a new subsystem we are building.
It's not really because we need it, but we are being pushed for having a complete history traceability, and CDC would nicely solve this requirement with minimum effort on our parts.
We are following an agile development pro... |
Relating to this question, I have another question regarding unit testing functions in the utility classes:
Assume you have function signatures like this:
public function void doSomething(InternalClass obj, InternalElement element)
where InternalClass and InternalElement are both Classes which source code are not avai... |
I often see model classes with properties like this:
public IList<Note> Notes { get; set; }
public bool HasNotes { get; set; }
Where the list is initialized lazy, but the boolean property is loaded directly.
This has the benefit, that only the count is loaded, when the collection is not needed, but the caveat is that ... |
I'm making an open source C# library (http://github.com/eteeselink/fakethat if you must). Like is fashionable these days, I plan to spread it via NuGet.
My library depends on another library (Castle.Core). Before the NuGet days, I'd use a tool such as ILMerge to merge my library and Castle.Core into a single assembly, ... |
Similar: How was programming done 20 years ago?
OOP is quite fashionable nowadays, having its roots in Simula 67 in the 1960s, and later made popular by Smalltalk and C++. We have DRY, SOLID, many books about design patterns in the object-oriented world.
But what were the main principles in programming prior to the OO... |
I read that a computer is made up of the CPU and the memory. I also read that the CPU itself contains a cache which is memory. So if the CPU itself contains the memory, isn't the CPU a computer?
Please clarify, thanks.
EDIT: I read here: http://www.dwightsilverman.com/future.htm it says:
A processor is, itself, a co... |
In C/C++, there is a keyword that allows you to enter assembly language directly into a method.
Example
int Main()
{
__asm // notify the compiler that this block is assembly language.
{
push ax;
xor ax, ax;
int 33h;
mov ax, 1;
int 33h;
pop ax;
retf;
}
... |
I have heard of the term "short-circuiting" being used in C, C++, C#, Java, and many others. What does this mean and in what scenario would it be used?
|
My problem is the following:
I have an interface that requires its implementations to implement a static method, namely void load(). However, until Java 8, it seems we won't get static methods in interfaces. I trust my users to still implement it correctly, but my problem is how to write a proper doc.
There are up to 5... |
Is there a db which maps the words from the english dictionary to the UNSPSC codes?(http://www.unspsc.org/)
My problem is the following:
I am building a search system. And the customer searches for 'pencil' and 'pencil sharpeners' are also returned. Each of the returned item has a UNSPSC code associated with it.
So one... |
I'm in the process of writing an app that will ultimately display analytics to the user. I've written a service that collects data from an API. This data will then be processed, stored, then when the user requests the data, pulls it from the store and displays it. Fairly straightforward. We plan on using MongoDB for th... |
I am a new to storing dates based on time zones.
Need to know the standard way to store the date in the datastore.
My requirements are
Easy to query the date based on the date range.
show the date with the client appropriate time zone selected by him(I am having a table maintained for the timezone separately)
Able t... |
I came across the following article which presents the problem:
A group of people walk into a restaurant and want to spend exactly
$15.05 on appetizers. They also want them as fast as possible. This
leaves waiter with an NP-hard problem to solve, a variation of
knapsack problem.
The article goes on to create so... |
I do not understand this sentence from the Wikipedia article on the Dangling Else problem:
[The Dangling Else problem] is a problem that often comes up in compiler construction, especially scannerless parsing.
Can someone explain to me how scannerless parsing techniques might exacerbate this problem? It seems to me ... |
I'm trying to help the Rebol project re-engineer its web presence now that it is open source as Apache 2 — after nearly two decades of proprietary license!
The language's creator currently has registrar control of the rebol.com/.org/.net sites. He wishes to keep control of the rebol.com domain as a holding for his Reb... |
I'm looking to release an open-source iOS software project but I'm very new to the licensing side of the things. While I'm aware that the majority of answers here will not lawyers, I'd appreciate it if anyone could steer me in the right direction.
With the exception of the following requirements I'm happy for developer... |
I'm currently working on an internal web application for my company in node.js
We want to have certain configuration settings be changeable by management. For example, we pre-print some labels automatically during receiving if the quantity is less than 5 so the user doesn't have to stop to confirm a print dialog. Wha... |
Say I have something like this:
public class BaseClass
{
public BaseClass(string someString)
{
if(someString == null)
throw new ArgumentException();
}
}
public class ChildClass : BaseClass
{
public ChildClass(string someString)
: base(someString)
{
// Should I do... |
How do you opt into one software license and not the other when the distributor gives the consumer more than one choice?
For example I would like to use the DataTables JavaScript library in my web application. According to their web site, "DataTables is dual licensed under the GPL v2 license or a BSD (3-point) license.... |
An SRS is a staple of any serious contract work, and it can be incredibly dull for those who've never had the misfortune of needing to read one through in one go.
I'm writing a series of document classes with LaTeX (markup language for profession-quality documents; see these questions and this answer on TeX.SE) and, in... |
I've started learning my first language recently, Python, and I became interested in how it differed from the myriad of other programming languages.
I've been able to find most of it out with some searching:
There is interpreted, compiled and assembly language. Then there is numerical machine code (which as I understa... |
I've got a bunch of Note-Models with properties like pitchand duration. In music notation, these notes must now be placed into a certain bar on a certain line on a certain page, and so on. Many more factors influence the positioning of these notes like the notes that are placed in the same bar before them.
Also, style-... |
I mistakenly posted this to stackoverflow and now posting here based on a suggestion in on that site ...
This is a very high level conceptual question. Say in a software application I have 4 different actions, for example: Upload, Share, Comment, and like
And I want to give achievement badges to users like:
Rookie - U... |
I'm reading through a programming book and am having trouble understanding a few parts of this code. The program draws a checkerboard, and colors the odd squares black.
import acm.graphics.*;
import acm.program.*;
public class CheckerBoard extends GraphicsProgram {
public void run() {
double squareSize = (dou... |
Is it acceptable form to take Linux kernel source from any version, change it, claim it is mine, and then distribute it for monetary gain? In such a case open-source software is entitled to a sort of "grab, change, sell" mechanism in which anyone can just tinker with something to look different from the original source... |
When writing an interpreter, how should the type inference algorithm change the parsed AST? Should it? Or parsing and inference are done necessarily simultaneously?
I have implemented a strongly typed functional language interpreter, in which each function can be declared only one time (i.e., with no signature variants... |
How is it possible that written a programming language like CoffeeScript in itself like CoffeeScript? Firstly CoffeeScript doesn't exist that read CoffeeScript scripts and interpret them?
|
In the book The Pragmatic Programmer, the writers mention the "programming by coincidence" concept. It explains what it is, why it is caused, what are the dangers you may encounter and it compares with a landmine field in a war.
Do you ever watch old black-and-white war movies? The weary soldier advances cautiously ou... |
I have been messing with code in The Unix Archive and have found that most of the code references a (non existent) license, however, this is in the root of the mirrors and apparently covers all of the code (typed from a PDF, so excuse the typos): (source pdf is here
The following copyright notice applies to the source... |
From what I understand,
HTML is a mark-up language, so is the content of XAML, XIB and
whatever Android uses and other native UI development frameworks.
JavaScript is a programming language used along with it to handle
client side scripting which will include things like event handling,
client side validations and any... |
I am referring to the state pattern as described in this link.
In the example class diagram, a context has numerous states. However, it does not show how does a state communicates with a context (perhaps an input in a state has impact on a setting in the context).
The two examples on the page shows either passing the ... |
So I've been reading about namespace on w3schools and I understand they are to uniquely identify an element. But what is the point of having namespaces if you have to have prefixes along side them. Are you always required to have prefixes with namespaces? If not are you always required to have namespaces with prefixes?... |
I'm designing an OO graph library and at the moment I'm trying to figure out the design for a GraphEdge class. I've added setters and getters for it's nodes, direction and weight. This seemes perfectly reasonable.
Then I've started working on the Graph class and I've come to the need of knowing if the particular edge i... |
I'm learning NodeJS and just wanted to clarify something. In several introductory tutorials and books so far, very early on they've described Node's "non-blocking" architecture - or rather that it's possible (and recommended, the entire point) to code in a non-blocking manner.
So for example, this example was given in... |
I have a method which constructs dependencies using Unity. Currently, all of the calls do pretty much the same thing: Registers 2 repository object and 2 'App Part' objects. My issue is, there's a lot of them and the method has become massive. I've generalised the calls but here's an example:
container.RegisterType<IRe... |
I am reading a Binary file, it has several blocks, each block has different names/data. Some of this data is string value, date, datetime, time but most of them are integer value.
Previously I code a struct for each Block and create public member to hold each property of that block, and then I make a Wrapper class this... |
I recently had a phone interview with a company. After that phone interview, I was told to complete a short programming assignment (a small program; shouldn't take more than three hours). I'm only directly instructed to complete the assignment and turn in the code. I was given complete freedom to use any language I wis... |
I am learning design patterns. I read this article. Point no. 3 is not clear to me. The writer said that strategy lets you change the guts of an object. But this is a violation of the open-close principle. Am I wrong? If I am wrong, then help me to understand what writer wanted to describe.
Strategy is like Template M... |
I'm fan of onion architecture but looking for some relaxing solutions in some areas.
First of all I was thinking about communicating directly from UI (from controller in mvc) to data on the read side. As everyone can see UI should not be referenced to any assembly except Core.
When I want to display list of countries ... |
Been poking around the web because I was curious as to why they called it that but haven't found anything yet. Anyone know?
(I checked the FAQ and it wasn't clear if questions on history/origins were OK to put here or not, but I figured it wouldn't be good on StackOverflow, feel free to start closing it if it is out of... |
I take a good deal of criticism from other programmers due to my use of full proper casing for all my variables. For example, your typical programmer will use employeeCount for a variable name, but I use EmployeeCount. I use full proper casing for everything, be it a void method, return method, variable, property, or... |
I came across a question that (eventually) landed me wondering about array arithmetic. I'm thinking specifically in Ruby, but I think the concepts are language independent.
So, addition and subtraction are defined, in Ruby, as such:
[1,6,8,3,6] + [5,6,7] == [1,6,8,3,6,5,6,7] # All the elements of the first, then all th... |
Are there any benefits to removing unused using statements in a VS project (such as can be done using Resharper), or will VS automatically take care of that when building/deploying?
|
a) To my knowledge Domain Objects should for the most part be oblivious to technical aspects of a design. Since I view class inheritance as being a technical solution, wouldn't introducing a Layer Supertype pattern into our domain corrupt it?
b) If you disagree, please elaborate why
Thanks
|
VS Web sites/projects come loaded with several .js files, most of which I don't use (e.g., I use a CDN for newer versions of jQuery and jQuery-UI). I know it's safe to remove these unneeded .js files from my projects, but is there any benefit from doing so? Are they deployed to the web server if left alone?
|
1. According to Fowler's definition this pattern is implemented by having all classes in a layer inherit from a superclass. But after some googling it appears all of the following are considered as implementations of a Layer Supertype pattern:
a - all classes in a layer inheriting from the same superclass
b - having o... |
I have been doing web-based Javascript (vanilla JS, jQuery, Backbone, etc.) for a few years now, and recently I've been doing some work with Node.js. It took me a while to get the hang of "non-blocking" programming, but I've now gotten used to using callbacks for IO operations and whatnot.
I understand that Javascript ... |
I want to add a project which in this case is created in Netbeans but this question is general for most IDE's. It's simply, what should I include in my repository. For example Netbeans creates a nbproject folder, eclipse creates a .settings folder etc. should I include these in my repository, what are the advantages/di... |
How can I refactor this code?
class Node
{
public Node Parent { get; set; }
}
class AVLNode
{
public AVLNode Parent { get; set; }
}
I tried to use inheritance, but then I have to use type casting:
class AVLNode : Node
{
}
class Program
{
void Main()
{
AVLNode a = new AVLNode();
AVLNode b = a.... |
I have a very large c++ project and I'm trying to decrease build times. I've been religious about forward declaring and only including files which are used. However I have many preprocessor defines which are setup in the project files (ie not in cpp or header files) so that I can keep them all in a central location for... |
Is there a more general concept or name for what WPF calls "dependency properties"? I imagine this is not a WPF-ism and in fact other libraries or frameworks have employed a similar approach? If so, what are these other instances and what are the similarities and differences compared to Microsoft's dependency propertie... |
I would like to sell the compiled binary of my android application in the Google Play Store when it reaches production.
Which license can I use to prevent people from downloading my source code from the open-source page and selling an exact copy of my work on the play store?
I want the code to be free and open for ge... |
After embracing the whole SOA thing, I've found that I'm gradually drowning in a sea of web.config and app.config files.
As an example, one system has 2 services that it interacts with. Each service has 3 config files - one for dev, one for staging and one for production. That's 6 config files. Then each application (... |
Folks, this seems like it should be straightforward, but I'm drawing a blank here.
As a simplified example, consider an abstract class called Number with an abstract method add(). I want to create two concrete subclasses, Integer and Float, with method signatures Integer.add(Integer other) and Float.add(Float other). ... |
I've been practicing behaviour driven development (BDD). I understand that you have to write tests that test the behaviour of the code, and this will allow the design of your code to evolve and take shape.
When doing BDD and I find I need to refactor my code into a better design, and that refactor happens to involve e... |
I am wondering what is the purpose of Chrome using multiple processes for each tabs? I asked this to C++ chat room and one responded it is a product of laziness. I personally believe this is an example of "Distributed processing" like in Erlang programming language. What exactly is it?
|
I'm working on a website and was hit with the thought of "do I need to give credit for the languages I'm using to build my website with?" I wasn't able to find any sort of licenses for HTML, CSS, or JavaScript and I'm a bit confused on the wording of PHP's license.
My question is: Do I need to specify somewhere on my w... |
I'm trying to find a way to design backend that will be handling customized web forms creation on the fly. Once created those forms will be injected to part of the existing web pages.
I've created dynamic forms successfully but I'm unable to figure out how I can integrate these newly created forms or custom fields into... |
Despite many years in IT, I still struggle with OO design. One particular problem I seem to keep ending up with is large classes, often containing many hundreds of lines of code.
The OO world talks a lot about SRP, and I could argue that these large classes I end up with are each handling a single responsibility. The c... |
I am building an web site which will allow users to aggregate the information stored in their online profiles ("data feeds") in one place.
I am wondering - what is the accepted (from a secureness point of view) way to store user name / password information in a my database?
Normally I would derive a salted-hash value... |
Question 1
What's the computational complexity of the Groovy unique() method?
Question 2
How could I have figured it out by myself? The unique() method is defined in the class DefaultGroovyMethods. The source code can be found here: org.codehaus.groovy.runtime.DefaultGroovyMethods. Can you point me to the piece of code... |
I have a custom View Controller that is a subclass of UIViewController that requires a data object to be set up properly. Without this object, showing the VC doesn't make any sense.
So I created a custom initialiser that requires this object to be passed as an parameter/argument.
There is also no "default" data object,... |
I have searched and could not find any information about it. What is the best approach to storing revisions?
I have a website where the user can write a document which can be fairly long (200-300 lines). How do you determine when to make a revision?
Is it not a scalable solution to make a new one whenever the save, be... |
I'm wondering how responsive design plays along with the Separations of Concern principle, in respect of how we're allowing a single implementation behave for multiple presentation devices (mobile, tablet, browser sizes etc.). Is it breaking the principle?
If I make changes to a web page that I know is behaving respons... |
Is there a methodology to debug websites without a browser?
Normally I use a web browser to view a results page. The slow debugging process confuses me a little. To correct an error I need to switch to a code window (which takes some time). Then I correct the error and return to a browser window, press F5, and wait for... |
the other day I was discussing with a colleague and he came out saying that using user's session in a web application is just wrong. I replied that it could be wrong depending by the information you are storing, otherwise why should a web session service even being provided by Microsoft (we were talking about ASP.NET).... |
I'm struggling to find pragmatic real-world advice on function naming conventions for a medium sized C library project. My library project is separated into a few modules and submodules with their own headers, and loosely follows an OO style (all functions take a certain struct as first argument, no globals etc). It's ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.