instruction stringlengths 34 19.9k |
|---|
Something I've been wondering about recently is how to organize types in directories/namespaces w.r.t. their dependencies.
One method I've seen, which I believe is the recommendation for both Haskell and .NET (though I can't find the references for this at the moment), is:
Type
Type/ATypeThatUsesType
Type/AnotherTypeTh... |
Using signed manifests in ClickOnce deployments, it is not possible to modify files after the deployment package has been published - installation will fail as hash information in the manifest won't match up with the modified files. I recently stumbled upon a situation where this was problematic - customers need to be ... |
In building an application that deals with a lot of mathematical calculations, I have encountered the problem that certain numbers cause rounding errors.
While I understand that floating point is not exact, the problem is how do I deal with exact numbers to make sure that when calculations are preformed on them float... |
I'm writing an application for a medium sized company that will be used by about 90% of our employees and our clients.
In planning for the future we decided to add functionality that will verify that the version of the program that is running is a version that we still support. Currently the application will forcequit ... |
I have around 10000+ strings and have to identify and group all the strings which looks similar(I base the similarity on the number of common words between any two give strings). The more number of common words, more similar the strings would be. For instance:
How to make another layer from an existing layer
Unable to... |
the purpose of oop using classes is to encapsulate members from the outer space. i always read that accessing members should be done by methods. for example:
template<typename T>
class foo_1 {
T state_;
public:
// following below
};
the most common doing that by my professor was to have a get and set method.
//... |
I've developed an ADHD management system for myself that's attempting to change multiple habits at once. I know this is counter to conventional wisdom, but I've tried the conventional for years & am now trying it my way. (just wanted to say that to try and prevent it from distracting people from the actual question)
An... |
Trying to make most of the GAE Datastore entities concept, but some doubts drill my head.
Say I have the model:
class User(ndb.Model):
email = ndb.StringProperty(indexed=True)
password = ndb.StringProperty(indexed=False)
first_name = ndb.StringProperty(indexed=False)
last_name = ndb.StringProperty(index... |
Suppose you've got a project that is running late. Is there any proof or argument that teams become much more productive by adding more people? I am looking for answers that can be supported by facts and references if possible.
What I'm thinking about is that existing devs have to teach the new ones (thus losing overa... |
What I mean about that is that in nearly every tutorial I've read about functional languages, is that one of the great things about functions, is that if you call a function with the same parameters twice, you'll always end up with the same result.
How on earth do you then make a function that takes a seed as a paramet... |
I just have read some stuff on enum today. Use of flags with enum was something interesting and new for me. But often practice and theoretical uses are different. I go through many articles they examples they quoted were good to get the concept but am still wondering in what situations one can use Enums with flag to st... |
Sometimes, although not often, I have to include math logic in my code. The concepts used are mostly very simple, but the resulting code is not - a lot of variables with unclear purpose, and some operations with not so obvious intent. I don't mean that the code is unreadable or unmaintainable, just that it's waaaay har... |
Which code is better:
// C++
void handle_message(...some input parameters..., bool& wasHandled)
void set_some_value(int newValue, int* oldValue = nullptr)
// C#
void handle_message(...some input parameters..., out bool wasHandled)
void set_some_value(int newValue, out int oldValue)
or
bool handle_message(...some inp... |
I have been working on some software application and I update them every 6 months. Currently, the way I track the date is by extracting the date from the system when the user installs the application, encrypt it and store it in a file locally. Whenever the application is started, it checks if 6 months have passed, then... |
I find that whenever I want to go run a past project, it will take a long time before I can find it and before I have everything set-up again for it to be able to run.
For example, I have python projects I created in Linux, and it depends on software packages that are easily installed in Linux, yet I no longer have t... |
I am trying to learn GRASP and I found this explained (here on page 3) about Low Coupling and I was very surprised when I found this:
Consider the method addTrack for an Album class, two possible methods are:
addTrack( Track t )
and
addTrack( int no, String title, double duration )
Which method reduces coupling?
The... |
I find that I sometimes use placeholders in strings, like this:
$ cat example-apache
<VirtualHost *:80>
ServerName ##DOMAIN_NAME##
ServerAlias www.##DOMAIN_NAME##
DocumentRoot /var/www/##DOMAIN_NAME##/public_html
</VirtualHost>
Now I am sure that it is a minor issue if the placeholder is ##DOMAIN_NAME##, !... |
I'm working on a project that has its own database call it InternalDb, but also it queries two other databases, call them ExternalDb1 and ExternalDb2. Both ExternalDb1 and ExternalDb2 are actually required by a few other projects. I'm wondering what the best approach for dealing with this is?
Currently, I've just cre... |
I am working on a system that has many remote laptops all connected to the internet through cellular data connections.
The application will synchronize periodically to a central database. The problem is, due to factors outside our control, the cost to move data across the cellular networks are spectacularly expensive... |
I've been learning F# and it's starting to influence how I think when I'm programming C#. To that end, I have been using recursion when I feel the result improves readability and I can't envision it winding out to a stack overflow.
This leads me to ask whether or not compilers could automatically convert recursive fu... |
Is it necessary/recommend/best practice/any other positive to use only one server environment to perform all development, unit testing and QA?
If so, is it then wise/part of Agile to then have only one staging environment before Live?
Considering that this could mean internationally distributed teams of developers and ... |
Microsoft employees commonly describe Windows 8 as having both a Render thread and UI thread.
Typically they say the Render thread performs animations and the UI thread handles most other operations: parsing, layout, applying templates, data binding, input processing, most app callbacks, etc.
Animations can be calcula... |
You know how in Minecraft, the World is ever-expanding and all the biomes are randomized?
My generalized question is: In relation to a space simulation that is also ever-expanding as the player moves about the world, how would one go about programming this randomization in Java?
My real question is: Could I get a simpl... |
Here's the problem :
While implementing a C# wrapper for an online API (Discogs) I've been faced to a dilemma : quite often the responses returned have mostly similar members and while modeling these responses to classes, some questions surfaces on which way to go would be the best.
Example :
Querying for a 'release' o... |
So I am reading up on python in Mark Lutz's wonderful LEARNING PYTHON book. Mark makes a big deal about how part of the python development philosophy is polymorphism and that functions and code should rely on polymorphism and not do much type checking. However, I do a lot of math type programming and so the idea of pol... |
I have a Folder entity that can be Moderated by users. Folders can contain other folders. So I may have a structure like this:
Folder 1
Folder 2
Folder 3
Folder 4
I have to decide how to implement Moderation for this entity. I've come up with two options:
Option 1
When the user is given moderatio... |
I've found a project on Github that I'm interested in contributing to which claims to be open source and has a GPL license included with it.
But the original author has added a copyright notification to each source file. I'm not sure why but I don't feel right contributing to a project that's always going to have some... |
Long running switch cases or if-else-if constructs are avoided in OOP using polymorphism wherever it is applicable.
instead of branching by matching a value, branching is done at class-level itself.
How can similar approach be applied in Functional Programming paradigm, Clojure specifically ?
|
Without being presumptuous, I would like you to consider the possibility of this.
Most OS today are based on pretty low level languages (mainly C/C++)
Even the new ones such as Android uses JNI & underlying implementation is in C
In fact, (this is a personal observation) many programs written in C run a lot faster than... |
I've been using Python since version 2.2. I do pick up new language constructs like for example with statement or dictionary/set comprehensions. However, I've realized that even though I'm being consistent with PEP-8, for existing constructs I'm using old style, rather than new style (for example except Exception, e in... |
I have recently used some software, which come as a regular setup file, where you install your software, and then when you run it, opens the browser, uses the localhost with some specific port number to connect to the software, and runs it from there. I find it quite useful and interesting. But I even don't know whethe... |
As a relational database programmer (most of the time), I read articles about how relational databases don't scale, and NoSQL solutions such as MongoDB do.
As most of the databases I have developed so far have been small to mid scale, I have never had a problem that hasn't been solved by some indexing, query optimizat... |
When a bug is fixed, the dev set its status to "resolved" and the bug is reassigned back to the person that created it. In our case this is usually the product owner - we don't have dedicated testers.
But what's a good process for controlling how/when the PO tests the software? Should he be given the latest build after... |
Say I have a simple structure:
app = webapp2.WSGIApplication([
(r'/', 'pages.login'),
(r'/profile', 'pages.profile'),
(r'/dashboard', 'pages.dash'),
], debug=True)
Basically all pages require authentication except for the login. If visitor tries to reach a restrictive page and he isn't authorized (or lacks... |
This test would call a web service over and over for about a minute to confirm that a particular response code is returned, notifying us of our rate limit being reached. Not only is it a very slow test, it doesn't confirm much of anything, and wastes resources.
I feel that this is like confirming that chugging a bottle... |
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 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.