instruction stringlengths 34 19.9k |
|---|
The point of this question is not to debate the merits of this over any other sorting algorithm - certainly there are many other questions that do this. This question is about the name. Why is Quicksort called "Quicksort"? Sure, it's "quick", most of the time, but not always. The possibility of degenerating to O(N^... |
I run into this same problem quite often. First, I create a namespace and then add modules to this namespace. Then issue I always run into is how best to initialize the application? Naturally, each module has its own startup procedure so should this data(not code in some cases, just a list of items to run) stay with th... |
I have a large file of functions. Each of these functions is responsible for drawing a particular part of the application. My app has x and y parameters that I use in the setup function to move the whole app around in order to try different placements. So, naturally, I need to use these x and y values to anchor each fu... |
In a blog post on F# for fun and profit, it says:
In a functional design, it is very important to separate behavior from
data. The data types are simple and "dumb". And then separately, you
have a number of functions that act on those data types.
This is the exact opposite of an object-oriented design, where
beh... |
I have a Request class based on the same Entity in my Domain. It currently only has property definitions. I'd like to add a method for checking a duplicate Request which I'll call from my controller. Should I add a method called CheckDuplicate in the Request class? Would I be violating the SRP? The method will ne... |
While coding a large project in C I came upon a problem. If I keep on writing more code then there will be a time when it will be difficult for me to organize the code. I mean that the naming for functions and variables for different parts of the program may seem to be mixed up.
So I was thinking whether there are usef... |
Currently I have some shared class files (.cpp and .h) which I include them in around 20 Projects. Currently I have to include them in all of the projects.
So if I get some business requirements and I change some of the shared (.cpp or .h) files I have to include them in all the 20 Projects which is kind of tedious.
Is... |
Hey I an working on the product which is live at multiple portals. The product is developed in GWT, JAVA, Hibernate.
My question is : Whether there is any alternative of using property file in java.
My Requirement :
For one property key there are multiple values in live portal for each different portal.
Each time I c... |
Whenever I read a code like this:
struct node
{
int x : 2;
int p : 4;
}n;
with bit fields involved, I get really confused, as to how they are represented in memory, what is sizeof(n) etc., how does it differ with normal members of structures? I tried referring K&R and http://en.wikipedia.org... |
In many languages such as C, C++, and Java, the main method/function has a return type of void or int, but not double or String. What might be the reasons behind that?
I know a little bit that we can't do that because main is called by runtime library and it expects some syntax like int main() or int main(int,char**... |
I'm developing some cross-platform software which is intended to run on mobile devices. Both iOS and Android provide low memory warnings. I plan to make a wrapper class that will free cached resources (like textures) when low memory warnings are issued (assuming the resource is not in use). If the resource returns to u... |
Here are two options:
Option 1:
enum QuizCategory {
CATEGORY_1(new MyCollection<Question>()
.add(Question.QUESTION_A)
.add(Question.QUESTION_B)
.add...),
CATEGORY_2(new MyCollection<Question>()
.add(Question.QUESTION_B)
... |
If a company takes a permissively licensed open source application and then develops a closed source application from that by reworking extensive parts of the application, adding new features and applying bug fixes...
Ignoring any license requirements...
How does the transition happen and what can be done to prevent i... |
Is their only similarity the fact that they are not xUnit (or more precisely, not based on enumerating specific test cases), or is it deeper than that?
Property-based testing (using QuickCheck, ScalaCheck, etc) seem well-suited to a functional programming style where side-effects are avoided. On the other hand, Design ... |
From a written text by an author if a computer program analyses the text, how much can a computer program tell today about the author of some (long enough to be statistically significant) texts?
Can the computer program even tell with "certainty" whether a man or a woman wrote this text based solely on the contents of ... |
Languages that are purely functional or near-purely functional benefit from persistent data structures because they are immutable and fit well with the stateless style of functional programming.
But from time to time we see libraries of persistent data structures for (state-based, OOP) languages like Java. A claim oft... |
I'm building a distributed storage system that works with different storage sizes. For instance, my storage devices have sizes of 50GB, 70GB, 150GB, 250GB, 1000GB, 5 storage systems in one system. My application will store any files to the storage system.
Question: How can I build a distributed storage with the idea of... |
There is a remote csv file that gets updated every second or so.
I need to download it(on a Windows machine) ONCE and always sync local file with the remote one.
Obviously, downloading the whole file every time is not an option. I need to download only the changes.(something like rsync, rdiff-backup)
I searched quite ... |
Experimenting with various lisps lately (clojure especially) i have wondered if there are any s expression based representations of (subsets) of c, so you could use lisp/closure to write macros and then convert the s-expression c tree to pure c.
I am not asking for a to-c-compilers of lisp/scheme/clojure but more of u... |
I think I have a decent grasp of what Dependency Inversion principle (DIP) is, my confusion is more around dependency injection.
My understanding is the whole point of DI is to decouple parts of an application, to allow changes in one part without effecting another, assuming the interface does not change.
For examples... |
While discussing the development of a network component for our game engine, a member of our team suggested that transmitting either 500 bytes or 1k of data using UDP makes no difference from performance perspective of the system (the time it takes to transmit the data).
He actually said that as long as you don't cross... |
I've been working on a project, and have been charged with designing the projects GUI front-end. I'm coding in Java and using the Swing toolkit. Usability-wise, the GUI front-end follows all of Nielsen's heuristics. Users can easily get to where they want to go through the click of a button / JComboBox. Essentially, in... |
I have a website that allows users to search for items in various categories. Each category is a separate area (page) of my website. For example, some categories might be cars, bikes, books etc. At the moment a user has to search for an item by going to the page (for example, cars) and searching for the car they want. ... |
I'm trying to write a "standard" business website. By "standard", I mean this site runs the usual HTML5, CSS and JavaScript for the front-end, a back-end (to process stuff), and runs MySQL for the database. It's a basic CRUD site: the front-end just makes pretty whatever the database has in store; the backend writes to... |
In Head First Design Patterns it teaches the strategy pattern by using a Duck example where different subclasses of Duck can be assigned a particular behavior at runtime. From my understanding the purpose of the strategy pattern is to change a single object's behavior at runtime, yet they are using inheritance of Duck... |
For example if a move is attempted I could just loop through a list of legal moves and compare the x,y but I have to write logic to calculate those at least every time the piece is moved.
Or, I can store in an array [,] and then check if x and y are not 0 then it is a legal move and then I save the data like this
[0][1... |
I'm a new person to AI field and I have to research and compare two different architectures for a thesis I'm writing.
Before you scream (homework thread), I've been reading on these two topics only to find that I'm confusing myself more.. let me first start with stating briefly what I know so far.
Subsumption is based ... |
So, I've been tutoring my friend for 2 years. Most people learn programming on their own in 3-6 months, (sans algorithms). It's confusing 'cause he'll run anywhere I tell him to, understands how to read C and C++ honestly better than the average college student, and he'll modify and repeat anything I do... but for the ... |
Assume we have a few projects, each containing some web resources (e.g., html pages).
parent.pom
+- web (war)
+- web-plugin-1 (jar)
+- web-plugin-2 (jar)
...
Let's say web is the deployable war project which depends on the known, but selectable, set of plugins.
What is a good way to setup this using ... |
Background
I have just finished writing a compiler for a functional language compiling to the JVM as a learning project. However, since I'm just doing this to learn, I thought it might be interesting to write a native backend and a RTS for it.
As I've been planning out what this new backend will look like, the one poin... |
I am including two programs in my software. One of which requires VC10 and the other requires VC11. My question is that if program developed for VC10 will work on VC11 or I have to include both VC10 and VC11
|
abstract class Animal {
function eat() {..}
function sleep() {..}
function isSmart()
}
class Dog extends Animal {
public $blnCanBark;
function isSmart() {
return $this->blnCanBark;
}
}
class Cat extends Animal {
public $blnCanJumpHigh;
function isSmart() {
return $this->blnCanJumpHigh;
}
}
... |
I've been told that code reuse and abstraction in OOP is far more difficult to do than it is in FP, and that all the claims that have been made about Object Orientedness (for lack of a better term) being great at reusing code have been flat out lies
So I was wondering if anyone here could tell me why that is, and perha... |
I've read a little about domain driven design and the usage of a rich domain model, as described by Martin Fowler, and I've decided to put it in practice in a personal project, instead of using transaction scripts.
Everything went fine until UI implementation started. The thing is some views will use rich components th... |
We have 1 byte, which is 8 bits, which is 2^8. Now 2 bytes should be 2 * 1 byte, which is 2 * 2^8 = 2^9, but actually 2 bytes is 2^16. What am I missing here? It seems like 2 bytes isn't 2 * 1 byte, it's more like 1 byte * 1 byte, but this should give you byte^2, which doesn't make sense.
Can please someone explain to ... |
I am new to java. Here I am trying to create java package. And try to compile it from another directory . But there is an error like bash: /home/gaurav/Desktop/package2/B.java: Permission denied
Here is My first code and directory is /home/Desktop/package/A.java
package package1;
public class A
{
interface A1
{ void sh... |
Please explain the difference between the waterfall model and the object oriented model.
Since the books and web sites that I've seen didn't provide much information about it, I need someone to explain it to me.
|
I am confused to understand the structure of a 3 layer programm. Where is good place for exceptions, entity and etc.? If I use MVC, in my UI model, how to transfer entity class to model class and etc.?
I have created a project that called Ramznegar. It is web project. In this a user can register and get a account. Then... |
Generally, I'm wondering about the advantages versus disadvantages of using the built-in arithmetic functions versus rolling your own in Python.
Specifically, I'm taking in GF(2) finite field polynomials in string format, converting to base 2 values, performing arithmetic, then output back into polynomials as string ... |
Start with an array of arrays; in this case, they are different lengths in order to demonstrate the technique, but they do not have to be.
[[1,2,3,4], [5,6,7], [8,9,10], [11,12,13,14,15]]
At the other end of the transformation, you have an array of arrays where the first array contains the first element from each of t... |
Just getting started on a hobby object-detection project. My aim is to understand the underlying algorithms and to this end the overall accuracy of the results is (currently) more important than actual run-time.
I'm starting with trying to find a good image segmentation algorithm that provide a good jump-off point for ... |
I don't know if this happens to most Opensource libraries, but many of I know and use (for example OpenSSL, Webkit, ...) they all lack comments, or contain very few comments.
Not to mention their very few documents, it is hard to read their source code. We can hardly understand what a member variable means, or what thi... |
The main advantage is the use of ReSharper and other add-ons but we need to make a convincing argument for the purchase of Visual Studio 2012 Professional. We are currently using Visual Studio 2012 Express for Windows. It is quite good but is hard to switch from using the full Professional version in the past.
So far t... |
I've been looking into regex lately and figured that the ? operator makes the *,+, or ? lazy. My question is how does it do that?
Is it that *? for example is a special operator, or does the ? have an effect on the *? In other words, does regex recognize *? as one operator in itself, or does regex recognize *? as the t... |
From PHP development I know that eval is evil and I've recently read What constitutes “Proper use” of the javascript Eval feature? and Don't be eval. The only proper use of eval I've read is Ajax.
I'm currently developing a visualization tool that lets users see how polynomials can interpolate functions:
Example
Code... |
Singleton is a common pattern implemented in both native libraries of .NET and Java. You will see it as such:
C#: MyClass.Instance
Java: MyClass.getInstance()
The question is: when writing APIs, is it better to expose the singleton through a property or getter, or should I hide it as much as possible?
Here are the a... |
Here's a Ruby poject that implements the middleware pattern. From the description, I have no idea what the pattern is, what it's useful for, and why other solutions wouldn't work as well.
What is the middleware pattern, and what are its advantages and drawbacks?
|
I am trying to split my code into different layers:
GUI, reading the GUI, creating input, calculating the model, interpreting data, creating view, sending the view to the GUI.
Somebody told me about MVC and I would like to try to build my program that way. But I'm a little confused about how to exchange information bet... |
For testing, I am planning to run a continuous integration testing. There are mainly two options: hosted, or own desktop/server. I will break it into 3 options I have:
Hosted:
Economical, $10-20/month for a small app
Less setup, the CI company manage all hardware and software
Desktop:
I could just buy a simple, che... |
Does it make sense to give signoff authority to testers? Should a test team
Just test features, issues, etc, and simply report on a pass/fail basis, leaving it up to others to act on those results, or
Have authority to hold up releases themselves based on those results?
In other words, should testers be required to a... |
Following questions all refer to examples presented in Implementing DDD
In article we can see from Figure 6 that both BankingAccount and PayeeAccount represent the same underlying concept of Banking Account BA
1. On page 64 author gives an example of a publishing organization, where the life-cycle of a book goes thro... |
I was writing some test code as an example where I had a washing machine class. It has a door state that should be open or closed, and also a running state, either on or off. I want to prevent the running state from changing from 'off' to 'on' when the door is 'open', and also prevent the door from being set to 'open' ... |
(Rewritten for reopening:)
What are relative advantages of Servlets over JSP, or vice versa?
Might JSP be preferred because it is easy to put code inside JSP, or Servlets because with them code can be separated from view? Are there other considerations?
Any information regarding this will be immensely helpful.
|
I developed many applications with registered user access for my enterprise clients. In many years I have changed my way of doing it, specially because I used many programming languages and database types along time.
Some of them not very simple as view, create and/or edit permissions for each module in the application... |
I'm new to use mocking frameworks and I have a few questions on the things that I am not clear on. I'm using Rhinomocks to generate mock objects in my unit tests. I understand that mocks can be created to verify interactions between methods and they record the interactions etc and stubs allow you to setup data and enti... |
I'm developing a pipeline for processing text that will go into production. The question I keep asking myself is: should I stick to one language for the project when I'm looking for a tool to do a particular task (e.g. NLTK, PDFMiner, CLD, CRFsuite, etc.)?
Or is it OK to mix and match languages on the project? So I p... |
I have an RESTful api that allows my users to receive enquiries about their business e.g. 'I would like to book service x on date y. Is this available?'. The api saves this information as a resource to the following URI
users/{userId}/enquiries/{enquiryId}
The information shown when this resource is retrieved are the ... |
Some higher-order functions for operating on lists or arrays have been repeatedly adopted or reinvented. The functions map, fold[l|r], and filter are found together in several programming languages, such as Scheme, ML, and Python, that don't seem to have a common ancestor. I'm going with these three names to keep the... |
In WPF's XAML, we can tell an element to fill its container like this:
<Button HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
Why is it that when we set an element to Stretch, we do it via the HorizontalAlignment and VerticalAlignment properties? Why did the WPF design team decide to take this approach o... |
I am developing an SWT application (it's basically an Eclipse plugin, so I need to use SWT). Currently my design is as follows:
Model: In model, I have POJOs which represents the actual fields in views.
View: It is a dumb layer, it contains just UI and contains no logic (not even event handlers)
Controller: It acts as... |
in iOS development, I have often seen people creating a networking module to interact with their APIs.
This module generally sits on top of a networking framework like MKNetWorkKit or AFNetWorking.
In most of the cases, It's all about sending GET,POST request and parsing the response which is in most cases JSON.
What ... |
In Ruby, I'm creating a small game development framework. Just some personal project - a very small group of friends helping.
Now I am in need of handling geometric concepts. Rectangles, Circles, Polygons, Vectors, Lines, etc. So I made a class for each of these.
I'm stuck deciding whether I should package such classes... |
I'm a Python beginner. I started programming with Python 1.5 months back.
I downloaded the Python docs and read some parts of the tutorial. I have been programming on codechef.com and solving problems of projecteuler. I am thinking of reading Introduction to algorithms and following this course on MIT opencourse ware ... |
When designing and writing documentation for a project an architecture needs to be clearly defined: what are the high-level modules of the system, what are their responsibilities, how do they communicate with each other, what protocols are used etc. But in this list, should the concrete technologies be specified or thi... |
I have the following SHA256 wrapper.
public static string SHA256(string plainText)
{
StringBuilder sb = new StringBuilder();
SHA256CryptoServiceProvider provider = new SHA256CryptoServiceProvider();
var hashedBytes = provider.ComputeHash(Encoding.UTF8.GetBytes(plainText));
for ... |
I've never thought it was necessary, but a client has requested that all webpages served to logged in users be delivered over HTTPS.
Aside from the implementation standpoint, which I don't think I'm going to pursue is there any real reason for this request ?
For clarity, the login / logout process, account settings, re... |
jQuery is a Javascript library and framework, but when we are programming
with jQuery into DOM problems/solutions,
we can practice a style quite different of programming... We can read about jQuery at Wikipedia,
The set of jQuery core features — DOM element selections, traversal and manipulation —, enabled by its sele... |
As I understand it, and I may be wrong, but GAE's remote_api allows one application to access another application's datastore. I'll be blunt I don't understand how this works. I have read the article that everyone likes to point to, but I still don't understand how you can link two applications. Can someone explain it ... |
I want to achieve a database synchronisation between my server database and a client application. The server would run MySQL and the applications may run different database technologies, their implementation isn't important.
I have a MySQL database online and web accessible via an API I wrote in PHP (just a detail).
My... |
So I am working on an MVC ASP.NET web application which centers around lots of data and data manipulation.
PROBLEM OVERVIEW:
We have an advanced search with 25 different filter criteria. I am using a stored procedure for this search. The stored procedure takes in parameters, filter for specific objects, and calculates ... |
What is a good practice to name an URL if it contains repetitive letters. For example, /info/foossite
The two s looks kind of odd and if this was access point for a Web-Service, this could lead into misspelling. In most programming languages, we have Camel notation. However, as URLs are case insensitive, we don't have ... |
In some data entry contexts, I've seen data typists, type really fast and know so well the app they use, and have a mechanic quality in their work so that they can "type ahead", ie continue typing and "tab-bing" and "enter-ing" faster than the display updates, so that in many occasions they are typing in the data for t... |
We (a contractor, actually) are implementing an off the shelf system to replace a legacy homegrown system for the core domain of the company (designing widgets). Unfortunately both systems will have to run concurrently for some time, as the product just isn't ready yet. Also, the decision was made to only migrate some ... |
I'm working on a small project (not production) where I'm needing to store enough data that something like a CSV would be inefficient to process and an SQL/MySQL server would be too much. Does .Net have any way to efficiently store several entries of data with the ability to query without having to manage and connect t... |
I have heard that a desirable quality of unit tests is that they test for each scenario independently. I realised whilst writing tests today that when you compare a variable with another value in a statement like:
assertEquals("foo", otherObject.stringFoo);
You are really testing three things:
The variable you are te... |
For 4 or fewer elements, something like this works (or at least compiles):
import scala.collection.immutable.Map;
Map<String,String> HAI_MAP = new Map4<>("Hello", "World",
"Happy", "Birthday",
"Merry", "XMas",
... |
For example, there is a common snippet in JS to get a default value:
function f(x) {
x = x || 'default_value';
}
This kind of snippet is not easily understood by all the members of my team, their JS level being low.
Should I not use this trick then? It makes the code less readable by peers, but more readable than ... |
Is there a reason why functions in most(?) programming languages are designed to support any number of input parameters but only one return value?
In most languages, it is possible to "work around" that limitation, e.g. by using out-parameters, returning pointers or by defining/returning structs/classes. But it seems s... |
In my breakdown of work I have to define work against 'Functional' and 'Non-Functional' design elements / work in my applications. I read the description from Wikipedia here: https://en.wikipedia.org/wiki/Non-functional_requirement but as typical the description did not speak exactly to me to clear up my understanding.... |
At http://www.codeproject.com/Articles/552846/Why-s-How-s-of-Asp-Net-MVC-Part-1, I read this: "You should not use Asp.Net MVC if you rely on 3rd party vendor controls for of the UI."
The author doesn't seem to say why (maybe the explanation is too subtle, or I'm too dense). Thoughts? Is it true? Why would this be?
|
I am working on a project and after arguing with people at work for about more than a hour. I decided to know what people on stack-exchange might say.
We're writing an API for a system, there is a query that should return a tree of Organization or a tree of Goals.
The tree of Organization is the organization in which t... |
In my quest to understand closures in the context of JS, I find myself asking why do you even need to use closures? What's so great about having an inner function be able to access the parent function's variables even after the parent function returns? I'm not even sure I asked that question correctly because I don't u... |
I planned to slice in backend development into to the user stories vertically.
But a backend guy on our team started to complain that this makes their work invisible.
My answer was that
at the sprint planning and review meetings we discuss backend tasks
in front of stakeholders so it makes it visible, and
maintaining... |
My customer has his own graphics designer he wants to use to style his web application we're building in ASP.NET MVC 4.
Our solution is in Bitbucket, but if he can't run it what choices do we have? I doubt he uses Visual Studio 2012.
One idea is for us to publish to our solution to a file system, send it to him, have... |
I want to write a class A that has a method calculate(<params>). That method should calculate a value using database data. So I wrote a class Test_A for unit testing (TDD). The database access is done using another class which I have mocked with a class, let's call it Accessor_Mockup.
Now, the TDD cycle requires me to ... |
I've been working on a personal closed source project for some time and would like to make it open source. I've never created my own open source project before so it will be a good learning experience. I have been using GitHub as source control, so once I've written some decent docs on how to use and develop for it etc... |
I am trying to get my head around object oriented programming as it pertains to web development (more specifically PHP).
I understand inheritance and abstraction etc, and know all the "buzz-words" like encapsulation and single purpose and why I should be doing all this.
But my knowledge is falling short with actually c... |
This question is in reference to the IEEE's CSDA and CSDP certifications.
I've already taken the CSDA course, which covered all of the knowledge areas in the Software Engineering Body of Knowledge (SWEBOK).
I'm thinking about doing the CSDP certification as well, but I can't find anywhere that tells me how it differs f... |
Assume that you are developing a functionality and are 90% sure that the implementation class will stay alone. If I was in this position in Java I would probably not use the interface right now to keep the things simple. In Java it is easy to refactor the code and extract the interface later.
In C++ the refactoring is ... |
While developing a product, I've come across a situation where my group wants to store meta data for data entry forms (questions, layout, etc) in a different database then the database where the collected data is stored. This is mostly for security because we want to be able to have our meta data public facing, while ... |
I need to fairly assign 2 experts from x experts (x is rather small - less than 50) for every n applications, so that:
each expert has the same number of applications (+-1);
each pair of experts (2-combination of x) has the same number of applications (+-1);
It is simple to generate all 2-combinations:
for (i=0; i<n;... |
I am not able to understand how bytes in memory are being mapped into a struct.
My machine is a little-endian x86_64. The code was compiled with gcc 4.7.0 from the Win64 mingw32-64 distribution for Win64.
These are contents of the relevant memory fragment:
...450002cf9fe5000040115a9fc0a8fe...
And this is the struct def... |
I have an application that runs through various tasks as an automated process.
My client would like me to create a file in a given folder for each task as a way to flag when each task completes. They prefer this to a database flag because they can be notified by the file system rather than continually polling a databa... |
While creating a 'search' form I've been faced to an overwhelming complexity and I was wondering whether there is a well-known way to accomplish such task.
Fields of the form in question can be seen here: http://developer.echonest.com/docs/v4/artist.html#search
Here are a few issues I've been faced to and tried to solv... |
From what I know, most banking applications periodically store the account balance at a certain point in time as it would not be plausible to calculate it over the entire history of transactions every time it is needed. In order to find the account balance, the application would first load the latest balance saved and ... |
We have a module in an application which stores data in multiple files and multilevel directories and access them from multiple threads (both reads and writes). The directory structure is based on a splitted hash value, like:
b1/94/6a/92/a.txt
b1/94/6a/ee/a.txt
a1/0e/db/bb/b.txt
...
If a caller removes a file the modu... |
I'm working through K&R and I notice that their code is extremely tightly spaced.
I haven't developed C since at University, but professionally most source from other languages I've worked in has used blank lines to aid readability.
Is C generally more tightly packed or is it a historical matter related to display size... |
I was looking at this thread on Stack Overflow and thinking about the functional programming I've been learning, and how immutability is so key there, and it occured to me that maybe some language has gotten the idea to have variables start out "null", then go to a "building" state, and finally become the same as any o... |
Recently the software team in my company decide to use VS2012 (upgrade from VS2008) but we found out that VS2012 does not provide a nice support for Windows XP (e.g. really hard to deploy .Net 3.5 managed C++ project).
So we want to convince our manager to drop Windows XP compatible development and and target Windows 7... |
I'm working with a team i just met.
I've been using the normal native generic php for coding up until now,
and built several webapps with it.
But a team member suggests we switch to using a framework for development.
I personally prefer going the normal way, using native generic PHP codes,
but he Suggests we use a fra... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.