instruction stringlengths 34 19.9k |
|---|
I am studying the Array class in C#. The following is the implementation of System.Array class:
[SerializableAttribute]
[ComVisibleAttribute(true)]
public abstract class Array : ICloneable, IList, ICollection, IEnumerable, IStructuralComparable, IStructuralEquatable
I have two questions regarding this:
I have read... |
I'll be specific: Java 8 is promised to bring lambda expressions as well as method and constructor references among other things. As a Java developer I'm super psyched about that.
In my day to day programming I see more and more opportunities where using these features would greatly simplify code that would otherwise b... |
Hypothesis: I have a table (named BigTable) which could experience 5,000,000 INSERTS per day (with possibly just as many SELECTs). Each row inserted is about 50kb.
These daily INSERTs are split across 5 clients equally (the table has a FK called ClientID). There is never a need to SELECT or JOIN data across multiple c... |
I am creating a RESTful API. I am struggling to decide on the best way to design my database tables around my resources.
Initially, I though a table per resource would be a good way to go, but I'm now worried that this will result in exponentially bigger tables the further down the resource chain you go.
For example, ... |
In programming what is called Principle of Least Astonishment? How is this concept related to designing good APIs? Is this something applicable to only object oriented programming or does it permeate other programming techniques as well? Is this related to the principle of "doing a single thing in your method and do i... |
I have an program that collects data from other servers. I don’t have access to these servers so I can’t change anything. The servers can give incorrect data, I can solve the problem but I’m a little bit stuck on “when to do the correction”.
I download the data from the server, the data gets processed and stored on the... |
I am working on a product in which the responsibility of one of the modules is to parse XML files and dump the required content in a database. Even though the present requirement is only to parse XML files, I want to design my parsing module in a fashion that I can support any kind of files in the future. The reason fo... |
How can one apply DDD to a EAV database model?
Consider this EAV database model:
How am I supposed to build a domain model if all my entities and their attributes will be stored in the database?
UPDATE
To help clarify the question I'll give an example. If I'm building a Store that is going to sell some Products then... |
I know that profiling is useful to identify bottlenecks and determining what parts of the code require how much time to execute. The latter isn't always very easy to track in the midst of other paths being executed, so once I decide what I want to optimize it might be problematic to see the improvement in numbers. This... |
We had a disagreement in a code review.
What I had written:
if(unimportantThing().isGood && previouslyCalculatedIndex != -1)
{
//Stuff
}
if(otherThing().isBad && previouslyCalculatedIndex != -1)
{
//Otherstuff
}
if(yetAnotherThing().isBad)
{
//Stuffystuff
}
The reviewer called that ugly code. This is what ... |
I am about to develop a ASP.NET MVC 4 project that will make use of maps. Our company has it's own map API which is very basic at the moment, but is intended to be further developed in future to match some specific customer needs.
The project will have a mobile/tablet interface in addition to it's web interface and nee... |
I have two resources: users and links.
Users can have several links associated with them. I have designed my RESTful API so that you can reach the links associated with a user at the following URI:
/users/:id/links
However, I always need to have a URI for just links – sometimes I might want all links, regardless of use... |
My high school is starting a program where, instead of following the 'traditional' method of teaching programming (learning variables, then operations, loops, methods, and finally OOP), students are immediately introduced to object oriented programming without any other programming knowledge.
Is this a good idea?
My ... |
I just started playing around with async/await in .Net 4.5. One thing I'm initially curious about, why is the async keyword necessary? The explanation I read was that it is a marker so the compiler knows a method awaits something. But it seems like the compiler should be able to figure this out without a keyword. So wh... |
My company is using Git, and is using a peculiar branching scheme - work is done in master, and branches are reserved for releases. This works fine, so long as all of the work done in an iteration makes it into the branch, but if a critical production issue comes up, we have to ensure that the work somehow makes it in... |
I have a problem with my teammates. Long story short: We are three students working at a project for a competition. The project consists of 2 separate applications: one for Windows (that I develop) and one for Android (my colleagues are responsible for developing it). Our code bases will never intersect, the apps will ... |
I have been asked to investigate the possibility of re-engineering an existing ASP.NET AJAX Web Application as under MVC.
The project, as it stands ATM, is very heavily relient on Telerik's ASP.NET AJAX controls.
I've yet to have to opportunity to interview the person responsible for this request, so I'm unsure of the ... |
I have pretty large code base for the client product I am working on. I am using Visual Studio 2010 for my development and it's hectically slow. I can get rid off this by disabling the installer project within the solution file.
Is it a good idea to include setup projects within the same solution?
How can I increase... |
I am studying about optimizing alogrithms.(Prof. Skiena's Algorithm Guide book)
One of the exercises asks us to optimize an algorithm:
Suppose the following algorithm is used to evaluate the polynomial
p(x) = a^(xn) + a^n−1(xn−1) + . . . + a(x) + a
p := a0;
xpower := 1;
for i := 1 to n do
xpower := x ∗ xpower;
p := p +... |
I learned to code in OO languages. I've always been interested in design patterns, clean code, etc., etc. - you know the type.
Now at work I'm using a BASIC dialect. Given modern programming values, should we try to carry over these same principles to new procedural code?
I'm pondering the following issues, and I wond... |
I have a question about the best practice in this situation.
At one point, my small application allowed the client to upload a file to a server, and download a file from the server (it would also compress / decompress as well).
This was created in 1 solution which consisted of 4 projects:
FTP
CompressDecompress
UI
Tes... |
I am building a RESTful API, and so far, to make sure that my resources work as I need them to, I am using a REST client called Postman. This makes it easy for me to store routes and quickly make requests to them for testing. My current collection of routes in Postman looks like this:
The trouble with testing the API ... |
We're working on an iOS project and right now, and whenever the designer has some feedback about fonts, colors, positions of elements, what images should go where etc., I have to go back and go through each little detail and make sure it's fixed.
I'm thinking there's got to be a better way to do this, where the designe... |
Is there a model that describes the different strategies that a company may use where the organisation is split into an engineering division and a professional services division?
This is the sort of model that is followed by companies like Microsoft, whereby Engineering (or R&D) produce the core software, and professio... |
The very simple piece of C++ code below is incorrect, it's easy to see why and tools like Valgrind will tell you. In running several C++ codes containing this kind of error, I noticed that each time, it ended up with a Segmentation fault at the line which tries to use the address.
So my question is: is it safe to claim... |
There is an issue which appears while running the application. It is not an Exception, but the desired UI change is not been implemented.
While debugging to find the code which should be changed to fix this problem, the UI changes can be seen correctly, To be specific, if we put one breakpoint in the class where it is ... |
In a C++ code base I've been working on, they have a bunch of instances of the observer pattern, but it's a little different from the classical pattern. In the classic, the Observer is a specific interface with specific method(s) that are called when the Observable changes or has new data.
Observable ... |
I started my new job as a JS developer in November and starting implementing Backbone pretty soon after. This was a big enough learning curve for the team (me included), however I'm thinking about looking at CoffeeScript, which I'm guessing would require everyone on the team to know it? Is that too big of an ask, just ... |
We've started implementing some caching code in our MVC project. We've derived from .Net's ObjectCache to store it in a SQL database.
What we do right now is in each method we want to cache we have code like this:
public StatusCounts GetCounts()
{
var cache = new SqlCache<StatusCounts>("mykey");
if(cache.HasCach... |
I was recently hired by a large multi-national corporation to head up mobile development for their sales operation/support team. In a company of close to 10,000 people I am, at least in the America's, the only mobile developer. They are testing the waters and phase 1 (temp-to-hire) went well enough for them.
Now they ... |
I am interested in integrating the results of 3rd-party news API's into my for-pay application. The APIs would be a very small part of the app (e. g. the app is not just reselling the APIs). I have found that many APIs such as Yahoo have "non-commercial" conditions like the following:
YOU SHALL NOT: Sell, lease, share... |
The iterator pattern is very clearly defined. What would you call the consumer of an iterator?
|
-I'm trying to figure out how to identify Application Services in my application. I think I can identify a Domain service by 2 things:
It acts as a facade to the repository.
It holds business logic that can't be encapsulated in a single entity.
So I thought about this simple use case that I'm currently working on:
An... |
I read that Liskov's substitution principle is violated if :
Preconditions are strengthened, or
Postconditions are weakened
But I don't get fully yet how these two points would violate Liskov substitution principle. Can some one please explain with an example. Specifically, how would any one of the above conditions c... |
Recently I was looking at an open source project to contribute to however after going through the ugly code base (which seems to break quite a bit) and reading some things about the current maintainer I decided it would be a good fit for me.
Right now my thinking is to just start a new project with the same goal but us... |
I am facing a problem with changing behaviour of a library (thus cannot or don't want to change its internals because of future updates, etc.).
In this library there is an abstract class which shares few methods with all its subclasses. Now I need to change few methods in this abstract super class without changing the ... |
On the Android operating system details about the phone are available via the Android.OS.Build class. These details include things such as the phone manufacturer, model, version, etc. The customer may want us to collect this data and save it to our database for analytics and tracking. I think this raises some privacy c... |
It seems to me that the best way to manage priority for programming tasks in a backlog is to simply put them in order. Do the top task first, second one next. If priority changes, re-order the queue. I thought this was exactly how things were supposed to work in Agile.
I have yet to find an online open-source team task... |
Every example neural network for image recognition I've read about produces a simple "yes" or "no" answer. One exit node corresponds to "Yes, this is a human face," and one corresponds to "No, this is not a human face."
I understand that this is likely for simplicity of explanation, but I'm wondering how such a neural... |
I'm writing a WinForms desktop application which will be shipped out to several different clients and am wondering what the best way to implement a user configuration file is. Normally I would use the built in Settings.settings or app.config to store user settings but in this case what I want to store is unique for eve... |
I work on a open-source web application (Moodle) which connects to a number of external services such as Google Drive, Dropbox etc. to allow users to exchange files with these services.
Primarily we are using OAuth based APIs to connect with these services. One of the user interaction problems we are facing is that ou... |
I am talking about normal PC applications, memory should be sufficient.
They declare global or member variables.
In each function/method, they use the same global/member variables.
At the beginning of each method, the variables are re-initialized so the old value is never used.
Why do they keep the variables but no cha... |
I am developing a 2d game where the world is made up of tiles.
I have an overworld and a "current world":
the current world represent the current tiles on screen at any given time, currently this is in a 2d array (14x10 elements).
the overworld is the entire world, currently 28x20 elements, which means there are four ... |
I am using Codeigniter framework for PHP on Windows platform. My problem is I am trying to track progress of a controller method running in background. The controller extracts data from the database(MySQL) then does some processing and then stores the results again in the database. The complete aforesaid process can be... |
Having
a minimum
a maximum
number of ranges
a value between minimum and maximum
I'm trying to come up with a method, or two, which would calculate which range the provided value belongs to.
For min=1, max = 10, number of ranges=5 the ranges would be
[1,2],[3,4],[5,6],[7,8],[9-10]
The other method would behave like... |
Several concepts related to REST conflict in my head when I try implementing it.
I have a REST-ful back-end API system that holds the business logic, and a web application that provides the UI. From various resources about REST (particularly, REST in Practice: Hypermedia and Systems Architecture) I know that I should n... |
Is there some syntax (other than a series of if statements) that allows for the use of a switch statement in Java to check if an object is an instanceof a class? I.e., something like this:
switch (object) {
case instanceof SecondObject:
break;
case instanceof ThirdObject:
break;
}
Sidenote: ... |
We use SVN and PhpStorm at work. Recently our team has grown a bit so there are several people working on the same project at a time, sometimes on the same file. We've run into the problem where people don't update before comitting and overwrite the changes that were made by someone else. This is a hassle. I don't know... |
I'm pretty new in our develepors team.
I need some strong arguments and/or "pitfall" examples, so my boss will finally understand the advantages of Unobtrusive JavaScript, so that he, and the rest of the team, stops doing things like this:
<input type="button" class="bow-chicka-wow-wow"
onclick="send_some_ajax(... |
From https://stackoverflow.com/questions/4544588/difference-between-iphone-simulator-and-android-emulator
The difference between emulators and simulators is that emulators mimic the software and hardware environments found on actual devices. Simulators, on the other hand, only mimic the software environment; they other... |
I want to know if it is possible to write to a log/text file dynamically generated HTML in asp.net tags in an .aspx page using HTTP modules.
By dynamically generated HTML, I mean the html content that asp.net generates in response to statements between the tags <% %> or <%# %> or <%$ %>.
So when asp.net renders a page,... |
I am developing an application where I am taking dynamic gestures as input and then mapping them to keyboard controls. By dynamic gesture, I mean for example hand moving from left to right or hand moving right to left.
I have four gestures: hand moving bottom to top, top to bottom, left to right and right to left.
I am... |
Where is the best place to validate input parameters of function: in caller or in function itself?
As I would like to improve my coding style, I try to find the best practices or some rules for this issue. When and what is better.
In my previous projects, we used to check and treat every input parameter inside the func... |
I am an advocate of commenting on source code and documenting software products. It is my personal experience and observation that working on source code that is rigorously commented has helped me in different ways when I have had to grow software or maintain it.
However there's another camp that says commenting is ult... |
With regular git and GitHub, I can do a code review by simply creating a pull request of the feature branch I'm working on to the master branch. How would I do code reviews with git-flow? With a workflow step like git flow feature finish (which merges the feature branch into the develop branch), I'm confused as to wher... |
I've been focusing on multimedia applications and I've noticed that most applications don't use Java in the back end. Instead, I see solutions with PHP/ROR/Python and Flash/Silverlight without any trace of Java in the application stack.
What part of Java is either limiting or constrained - or perceived as limiting or c... |
I am working with multiple websites (freelancer) and a good amount of them I write using C# MVC4.
I created a very good boilerplace project that I plan to use on every next starting mvc4 application I build, however the namespace is named Website. I also do a lot of copy-paste from one project to another and then I alw... |
When developing an application in a team not everyone on this team will be equally good developers. Some will be skilled in some things and some in others and some not at all.
As a team working in an agile process you usually have a definition of 'done' to follow. In our DoD it says never to merge code that is not docu... |
I am coming from a .NET background and beginning my journey into the Mac OSX\Ruby\Rails environment.
A lot of the resources I have found such as this one have between 5-10 steps for setting up a Ruby\Rails environment.
My question is, what are the bare minimum requirements for setting up a working Ruby\Rails environmen... |
I'm trying to learn PHP OOP, but when I've followed tutorials, all the examples seem to involve things like:
class Human {
$_sex;
public function setSex($sex) {
$this->_sex = $sex;
}
public function getSex() {
return $this->sex;
}
}
(Pointless example, but hopefully you get what I... |
I'm wondering, what are the white box testers using to create test cases? The actual code? Some kind of diagrams?
I mean, if I am given a task to create test cases for complete branch coverage, is it possible they give me a code?
Because I saw something like that:
Reader r=null;
if(condition)
{
r=new Reader();
}
r.to... |
Overview
I considered posting this to DBA but I think the question goes beyond the database. Of all the software-related Stack Exchange sites, the Programmers FAQ seemed most in tune with what I'm asking here.
My company provides a SaaS offering. Our customers collect a lot of data using our service, and we wish to mak... |
There was a mention in the Java Posse Podcast about how teams should be divided up into pairs. However, there was a mention from the lady on the podcast that: "Pairs should be mixed up [sic]" (an encouragement for diversity)
I understand the benefits of pair programming, but what benefit is there to intentionally mix p... |
I own and read 'Java Puzzlers', 'Clean Code' and GOF's 'Design Patterns' and more specific technology books however I have not yet read 'Effective Java'. Whenever I see a list of must read books I always see a copy a 'Effective Java' but I have put off buying it seeing as a learn to write Java book rather than a writ... |
for In the project I am working on we send messages about widgets over message queues, serializing them onto the queues as XML. The XML schema contains tags for properties that are common to all types of these widget messages, such as the widget type, command name and destination. It can also contain an arbitrarily siz... |
What I know is:
A Functional test aims to test a single component (like a WebApp's Controller) from the point of view of the developer. => Did I achieve all the requirements to make it work well?
An Acceptance test aims to to test a group of components together and is focused on the Business point of view. => Does my... |
I ran into Rebol and I was wondering about it.
I ran into the following script from here:
use [feed questions answers][
feed: load-xml/dom http://stackoverflow.com/feeds/tag/rebol
questions: map-each entry feed/get-by-tag <entry> [
find/match entry/get <id> "http://stackoverflow.com/q/"
]
answ... |
Occasionally I'll run into the situation where fixing a bug requires that I delete a section of code. The TDD purist would (I assume) advocate writing a failing test, deleting the code, then watching the test pass.
Now, it seems really strange to have a test asserting that some code was removed. Sure, I suppose it woul... |
I have a question bugging me for some days. I made a webshop for a good friend of me. The problem is I have an OOP class question.
People can buy some clothing in the shop. The problem arise how to show different information for different products?
What I have now is the following:
abstract Product class
Cloth extends... |
I have a scenario similar to as depicted below,
public class Post {
private int id;
private int postType;
private int score;
private User originalPoster;
private String title;
private String body;
private String tags;
}
public class Comment {
private int id;
private int postId;
... |
Code documentation is usually related to a piece of code, be it small (method-level) or larger (class- or namespace-level). However, it is always about the inputs and the outputs of that piece of code, possibly describing its behavior and caveats.
It doesn't make much sense to document events fired by a class in the me... |
I'm currently researching the options which I have, to build an 'Online Help System'. This system should offer the user information about dialogs - which consists mainly out of forms.
So my main question is: Is there any taxonomy/language to describe user interfaces?
I have searched a lot on this subject matter, but en... |
Been writing code since about 18 years now. Lately, I've got into the habit of not indenting elses and when I look at the code it does worry me a bit mostly that someone who might look at the code might cry foul.
The snippet below explains the need for the style
if(condition) {
...
} //1
if(condition) { // Don't wa... |
From http://en.wikipedia.org/wiki/Extreme_programming
Extreme Programming is a software development methodology which is intended to improve software quality and responsiveness to changing customer requirements.
My Team Lead dislikes Extreme Programming as
May take more time to complete the project.
Increases initial... |
I'm probably missing something here, after searching I couldn't find an answer.
I've explored quite a few Python projects and one thing I keep noticing is the fact that the majority of them continue to use the % operator for formatting strings rather than the newer, recommended .format() method. Is there a reason for t... |
I'm writing a small utility in AutoIt that connects to Twitter. I would like to store the username and password in the programs setting file, but I know that it needs to be encrypted obviously. Previously when I've done this for personal use I've just adopted an iniformat - written to a temporary file and then encrypte... |
I have an algorithm with mostly invariant parts that needs to be reused within one class so as to stay DRY.
Code duplication with repeating method structure
public void save(String key, int value) {
try {
if (isValidWrite()) {
// Only variable part
editor.putInt(key, value);
... |
I have a set of classes that are all dealing with some related tasks. These tasks do have different inputs and outputs. This causes it to become impossible to have the tasks done via shared code without having this code be a pile of if-else statements handling all the different cases.
Now someone refactored this code t... |
It might be a simple question but I am looking for optimal solution. I will have numbers printed on a screen and I will be aware of coordinates. Numbers/Symbols will have 4 points(Square) to define their boundaries. Coordinates of that particular symbol will be stored in a file. Lets' say there is a number 5 and it's 4... |
Fully automated memory management increases productivity and integrity greatly, but usual implementation (GC) has a critical problem. It's non-deterministic, and not controllable. This causes many problems such as burst CPU load which is critical for realtime applications. Some kind of optimizations (incremental/concur... |
While the question itself might sounds silly, the answer is quite important to me,
as I feel that issue is negatively affecting my work performance.
A bit of the background here: I am a seasoned senior software developer in a medium size
software department of non-software company. While being above average on the tech... |
As a student in programming, I learned that encapsulation is one of the most important principles of object-oriented programming.
However, I only follow that principle when I feel like it suits my purpose. I sometimes leave internal class variables public if they are intended to be directly read at some time, and only ... |
I was wondering why the Dining philosophers problem is based on a five philosophers case. Why not four?
I guess that we can observe all unpleasant issues that can occur when discussing five philosophers example also when we are given four thinkers. Is it only for a historical reason then?
|
I read .NET Domain-Driven Design with C#: Problem - Design - Solution and I noticed that the author created a domain service for each aggregate root.
However, the domain services were only facades to the corresponding repository. For example this is a code sample from the application from his book
public static class C... |
We are currently looking at using the idquantique random number generator device to provide random numbers. There are some issues though. We would only be using one device and we have at least 5 servers that would need to use it and this number will probably increase in the future. This implies that blocks of random... |
I'm trying to learn PHP OOP "properly", and I was wondering, should the constructor grab all the information in the database and store it in the object?
To use an example I'm trying to create using PHP OOP, an internet comic website (much like XKCD's), would have two classes:
Catalogue (list and order of all the epis... |
What is this pattern called? Is this a variant of the Module pattern? I remember there's disadvantage to this pattern and it's related to memory usage.
var module = function() {
this.Alert = function() {
alert("I'm a public");
}
function iamPrivate() {
alert("not callable because I'm... |
I committed and pushed some changes to the wrong branch. I found a way to fix it, but it seems overly complicated. Is this really the easiest way?
on the branch that you made your changes, type hg parent
run hg diff -r <parent> -r <with_changes> > patch.diff
hg up <proper_branch>
hg import --no-commit patch.diff
hg ci... |
Specifying a suffix of Exception on exception classes feels like a code smell to me (Redundant information - the rest of the name implies an error state and it inherits from Exception). However, it also seems that everyone does it and it seems to be good practice.
I am looking to understand why this is good practice.
... |
I got closed on SO and told to post this here as it's about general application design as opposed to specific code.
Intro
I'm currently working on a project which involves the daily extraction of data (pharmacy records) from a VisualFox Pro database, and uploading some of it to a WordPress site, where clients of the ph... |
could some please help me understand how to find cycles in graphs in laymans terms?
I have read other questions, such as This one and also some of the wikipedia pages, but they seem to descend rather quickly into mathematical jargon.
I have a model of the graph in java, modelling nodes, and 'in' and 'out' edges - and ... |
First off, if this is in the wrong place I apologise. I wasn't too sure on which of the Stack Exchange sites to ask it.
I am studying Software Development at university, on a one year conversion course. My main programming language is Java. We have just finished studying searches and sorts. Focussing on the latter in p... |
I am trying to understand how Apache License affects patents. In regards to the Apache website http://www.apache.org/licenses/LICENSE-2.0 section 3, am I right to say for the first part that it is saying the licensee is allowed to do pretty much anything with the patent?
In the latter part, is it saying that if a lice... |
I have heard of several situations of people using say, JavaScript or Python (or something), inside a program written in C#. When would using a language like JavaScript to do something in a C# program be better then just doing it in C#?
|
I'm trying to see if these two open source licenses give protection of trademarks to the originator. I have read both licenses but they only seem to talk about their own trademark i.e. 'Apache'.
|
Imagine a hypothetical programming environment that is largely like Java or .NET, i.e. object-oriented, garbage-collected, etc., but with one small change:
Every time you call a method on an object, a lock is obtained so that no two threads can execute methods on the same object at the same time. The lock is relinquish... |
Say you have
class A {
}
class B {
}
One type dependency is "method parameter":
class A {
}
class B {
public void M(A a) {
}
}
Another is "method returns":
class A {
}
class B {
public A M() {
}
}
Then C, an adapter from A to B, could be identified by a class that exhibits both of the above dependency ch... |
I'm a front end developer...I've never done ANY backend, although I did take a course in databases once. (I have a comp sci degree; I'm a competent programmer, I just haven't done any backend web stuff before.)
So I'm trying to figure out how the framework relates to the database. Presumably they're set up separately, ... |
In my RESTful WCF web service I have something like the following response object.
public class WebResponse<T>
{
public bool Success { get; set; }
public T Data { get; set; }
public string ErrorMessage { get; set; }
}
This way I can capture any errors that occur during the request to t... |
My understanding from small MVC applications is that you have the front end, which deals with HTML, JS, jQuery, etc, and you have the back end, which consists of your controllers and models.
However, when I talk to developers from large companies, they often mention having a frontend tier and a backend tier. So someti... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.