instruction stringlengths 34 19.9k |
|---|
In my ASP.net MVC4 web application I use IEnumerables, trying to follow the mantra to program to the interface, not the implementation.
Return IEnumerable(Of Student)
vs
Return New List(Of Student)
People are telling me to use List and not IEnumerable, because lists force the query to be executed and IEumerable does ... |
Pretty simple setup: I've got a Cart and the cart has Items. I've got many varying types of "products" that can't really be boiled down into one thing or even a common ancestor, so I've instead decided to simply create a representation of the product as a CartItem, which contains all the information from the product ne... |
I work in a middle sized team which shares the same source code and while have a continues integration in place, but as all of us has to work in the same branch, the build is almost always broken.
As we also have a rule, which has been introduced recently to alleviate the broken builds, which states that no one is all... |
I have been looking at server side Javascript technologies like, Rhino and Node.js. What are the advantages of using server-side Javascript and where in the server-side to they fit in a stack?
|
I am trying to instantiate
LinkedList<?> op = new LinkedList<?>();
But I get error
Cannot instantiate the type LinkedList<?>
Why is it that this cannot be instantiated in Java?
|
I am confused a little as what should be my approach, Working on a design of shopping cart and i need to store shopping cart either in session or in database but not sure which approach would be best.here are the use case
User is not logged in and adding product to cart (Anonymous user)
User is logged in and adding pr... |
It seems most companies are practicing Agile methodologies these days for software development.
I'm curious to know if there are any downsides to using Agile, does it have shortcomings, is it always the right methodology to use?
Do you any of you have experiences of using Agile and it didn't really work, maybe it was... |
I have a desktop project I've been working on for a couple months that I want to run on Windows and Mac. When I started the project, I started writing it in Qt 4.8 in C++. Development has gone fine and the application runs fairly well on both Windows and Mac like I hoped. I would say it's about 40% complete at this poi... |
When looking at the ECMAScript 4th Edition specification here it mentions that
ES3 is a simple, highly dynamic, object-based language that takes its major ideas from the languages Self and Scheme.
I'm not familiar with these two languages and cannot seem to find any mention of what exactly is similar to these langua... |
In some pseudocode, I saw the following:
if w in [1..5,8,11]
Does it mean that if w is from 1 to 5 or 8 or 11? Or is it something else?
|
I recently implemented the Damerau-Levenshtein distance algorithm from the pseudocode on Wikipedia. I couldn't find any explanation of exactly how it works and the pseudocode uses completely uninformative variable names like DA, DB, i1, and j1 that left me scratching my head.
Here's my implementation in Python: https:/... |
Update: I've got a response from the FSF on this down in the answers
From the answer to Can I remove all-caps and shorten the disclaimer on my License?, it appears that the APP CAPS sections of a software license are largely to provide extra legal ammo and increase the weight of those sections.
On the flip side, ALL CA... |
I am developing a multipalyer web Application for Anti-Chess. It would be hosted on Google App Engine.
I have a few questions:
How do I get two different users who have opened the webapp on their browser to communicate moves with each other. P2P or through the server. If through the server, can I store some moves on i... |
If I was working on a web application designing and writing an API how does that differ from a general web application development?
What things would I need to consider and take into account? Are there any standard processes to follow when creating an API that could be used by thousands of clients?
|
I was reading some article on the internet as I was preparing for interview and I found out below statement-
Writing object oriented code, even in non-object oriented language?
Is this statement true??
Can anybody provide an example to justify the above statement if somebody asked me this question in the interview.
... |
I'm working on a MVC4 N-tier application and have a quick question about Service to Controller relation and using Domain/ViewModel.
public ActionResult Details(int id = 0)
{
TenantDomainModel tenant = _tenantService.GetById(id);
TenantViewModel tenantViewModel = Mapper.Map<TenantViewModel>(tenant... |
I am attempting to understand what a Package Management System. I grasp the main concept of it but I have some queries.
Does a package management system install features(compilers, libraries, virtual machines) necessary to run an application AND install an application or does it just install features necessary to run... |
I am attempting to understand what UML models/diagrams can be used to communicate a websites architecture.
The model or models' purpose is to communicate the architecture and functionality of a website to technical people (other software developers and engineers).
Website Features:
- The website is a recipe search engi... |
I am employed in a very brilliant company with a true intention of doing XP. Communication is good and management is open to constructive discussion but due to pressing time constraints, some certain things are considered too RUP to be discussed.
At the moment I'm a little troubled with the volume of change that become... |
JavaScript seems to calculate the array length property by the number of the last index in the array rather than counting the number of items in the array. Example:
var testArray = ['a', 'b', 'c'];
console.log(testArray.length); //3
testArray[8] = 'i';
console.log(testArray.length); //9
Normally I would use push() and... |
When Aiken devised the Mark I, why did he decided to separate data and instructions? It was not mentioned in Wikipedia (or in any other searches I've looked) on how or why Aiken separated data and instructions.
|
I have a table of user relationship which stores who follows whom, the table structure is as follows
-id
-follower
-following
when someone follows any other user, I add a record with follower user id and id of user he is following, now my question:
When user wants to un-follow that user, I have decided rather than del... |
I've seen many developers asking for "How to intercept in/out HTTP packets ", "How to modify them on the fly". The most "clean" answer I've seen is to make a kernel-mode-driver filter from the scratch (TDI for XP and earlier winx9 or NDIS for NT systems).
An other way, is to use a user-mode-driver like Windivert, also... |
Despite the best intentions of programmers; oftentimes, in the real world, software systems contain "accidental features" that are accepted as part of a working system.
For example, there may be some process that runs out of memory and crashes before the process exceeds its quota for calls to an external system (which... |
I was wondering about the origins of the "let" used in Lisp, Clojure, and Haskell. Does anyone know which language it appeared in first?
|
I was recently searching for the mathematical formula to find closest point of approach (CPA) between one ship and another ship. I need to apply the formula in my radar ship program and I can't find the correct way to calculates it.
Does anybody know what the correct formula (or pseudo-code) is instead of plotting it ... |
I have started to study design patterns using some course in pluralsight and the gang of four book.
While I feel I understand what I have studied so far, I think it would be very helpful if I would have some way of practicing them.
I know that I will get the chance in time but I feel I would get a better understanding ... |
I am looking for a language that
has First class functions
is dynamic
has prototypical inheritance
does not have too many features (i.e is easy to get into and write first program).
I have been programming in JavaScript for quite some time and have gotten quite fond of it. Are there any other languages that have simi... |
The other day I was reading a little about Unit Testing and I saw some examples where people create a repository interface (i.e. IExampleRepository) and then create the real repository (public class ExampleRepository : IExampleRepository) and a repository to be used for unit testing (FakeExampleRepository : IExampleRep... |
Heapsort is a sorting algorithm that has a time complexity of O(nlogn), and performs sorting using O(1) space complexity. However, I know that because it's unstable, it doesn't find many applications (f.e. compared to other sorting algorithms).
I know it's used for interval scheduling.
What are some practical applicat... |
For example, in case of GDB it is possible to debug itself by itself. I have not been able to find any JVM that can debug itself or even allows debugging on source level.
I was just wondering if someone can suggest on how the systems are made self debuggable. If you have references, please paste it here. I wanted to re... |
Right now we have our administrative features located at www.mysite.com/admin. It is locked down by UN/PW but it still seems like an insecure place to have it. Is there a better place to put it? Perhaps at another domain?
|
When developing on a long-running branch (here defined as living longer than one release), what's the most accepted practice(s) to keeping the branch current with its origin while keeping the history relatively clean prior to merging back?
As an example, consider the origin branch (m) and a (topic) branch (t) with the ... |
I am helping a friend with his rewrite of his .NET application, currently using WinForms + sockets, which is a client/server program that currently has on average ~120 concurrent users (sending messages, using the chat). The client will grow and eventually must be able to handle a several thousand concurrent users.
A t... |
This is a problem I've run into a few times. Imagine you have a record that you want to store into a database table. This table has a DateTime column called "date_created". This one particular record was created a long time ago, and you're not really sure about the exact date, but you know the year and month. Other rec... |
There is a class method (static method) in which I create and build some object. And for filling that object, I create it as mutable object.
My mutable object is a subclass of immutable object. So i can return it as super Class type.
That object is just created in class method and returns. It is not a part of object... |
I am coming from a php background with some python as well. I want to start working on a different language for both web and mobile development. I am also interested in real time apps dealing with games.
I am looking at node.js because I can use tools like titanium and/or phone gap to have my apps ported and compiled ... |
I know that integration testing means integrating unit tested moduls and testing for interface errors etc.
But in real world examples, I am kinda lost. Here is an example of our system:
Back end (Java).
Front end (Flex).
Back end is processind data heavily and we have a lot of tests for weekly automated regression. B... |
We have a very big application written in C++ using the MFC framework (millions of code lines). No need to say that it's a legacy system, but it's also heavily maintained and updated. This application lacks a lot of architecture. For example, we have a lot of classes that do queries directly to the database, which crea... |
Preparing myself for ISTQB, I found a bit odd many things in their textbooks. E.g. they call black box testing as functional testing when you are not concerned with structured but only observe the ouput based on inputs.
But later they say that functional testing is done at levels..well, how can I do unit testing withou... |
I know a lot about programming syntactically. What I am unsure is about how should I go to build a software from scratch. How should be the objects be designed and how should they interact with each other.
To learn how good softwares are written I have tried to read code of some good open source softwares but could no... |
In MIPS assembly, there is a register for the stack pointer, and another register for the frame pointer. What is the frame pointer and what is its purpose? How does it differ from the stack pointer?
|
Recently I read a lot about noSQL DBMSs. I understand CAP theorem, ACID rules, BASE rules and the basic theory. But didn't find any resources on why is noSQL scalable more easily than RDBMS (e.g. in case of a system that requires lots of DB servers)?
I guess that keeping constraints and foreign keys cost resources and ... |
I work on an ExtJS application with a Django backend, and we keep running into issues when we push new code. Our users seldom refresh their browsers, so after a code push we end up with users using the same (now outdated) version of our ExtJS application for days at a time instead of the new, updated version.
How do o... |
Concretely I am looking at this 2000 line file of what I will pretty arbitrarily call "mediocre" code.
It's not well-commented
variable names and function names seem consistently intelligent
functions are not well-documented
functions are good length
In short: its lines and small structures are readable, but it's im... |
I am wondering about how much time Google Summer of Code typically takes. I do have an internship lined up for this summer, but GSoC seems like quite an awesome experience. I also really want to get into Open Source development. It states in the FAQ that it's not a good idea to attempt both, but it doesn't give any ... |
Are constants always irrelevant even if they are large?
For example is
O(10^9 * N) == O(N) ?
|
I want to build most of my functionality on the client. However I'm not quite sure which server-side web development framework can provide me with a nice REST endpoint to handle resources, business logic, etc. I come from a JAVA EE world, where JSF is mostly stateful and component based (both have their pros and cons, ... |
How do I go about managing projects when there are two fundamental relationships that need to be maintained? The most obvious example that I can think of would be a firm doing some kind of location-based consulting.
I've been wracking my brain on how to explain this, in essence, this is the bullet point version:
Each... |
I have a project that will need to handle 1000s of requests a second with a decent amount of processing for each. For the most part, the processing will be done on a list of items, basically filtering it and returning a smaller list. This process can be done in parallel fairly easily and I should also say, speed is i... |
Currently we are using Source Safe and have started migration to Subversion.
All of our external SDK's(> 500 MB) are held in Source Safe right now, and I am looking for ways to move them from VSS to a repository.
We have C++ (mostly), C# (many), Java (few) projects. Hundreds of projects, all running on Windows.
I looke... |
In general, if I am using an API whose methods have side-effects that I only want to occur once, how can I guarantee that my own application only calls them once even if an error occurs before it can register a response?
For example, if I am calling a payment processing API once each month for a subscription service, h... |
I have a PHP MVC application and a file table. I need to implement the functionality: mark all as read. The best solution for the code I found so far was to put the actual implementation in a Model/Service/FileService.php
The problem is the class FileService will get bloated really fast with different functionality.
W... |
When I started studying C++ a couple of years ago, a lot of the books and texts I read did a very thorough job of explaining, how the code written would translate into concrete operations in the hardware (like dynamically memory allocation, pointer arithmetics etc.). I found those explanations extremely helpful in orde... |
I heard Silverlight will not be supported any more by Microsoft. It is true? If so, could anyone share with me Microsoft announcement? And if there are already application developed by Silverlight, what is the new technology to migration to?
thanks in advance,
Lin
|
An enum X : int (C#) or enum class X : int (C++11) is a type that has a hidden inner field of int that can hold any value. In addition, a number of predefined constants of X are defined on the enum. It is possible to cast the enum to its integer value and vice versa. This is all true in both C# and C++11.
In C# enums a... |
Some Agile job posts have a requirement "strong understanding of multiple lifecycles application development", what does it means ?
So my question would be: what's that field for, and what would I need to learn, knowing that I got Java EE experience and Agile more than 2 years.
Sorry if my question isn't constructed we... |
We have a site that allows users to generate their own content. If users generate illegal content, we'll be submitting a report to the authorities. In the event that we do have to report a user, we want as much info as possible on that user. With that said, I have two questions:
Is tracking the user's ip address enou... |
The problem: I am working on a freelance marketplace, and I decided to cancel project with one of my clients, because client is impossible to work with with limitless delays and lots of bugs in his backend. I want to give him a partial refund (partial because I worked for two months and there is 3k lines of code, thoug... |
I've been learning more about Big O Notation and how to calculate it based on how an algorithm is written. I came across an interesting set of "rules" for calculating an algorithms Big O notation and I wanted to see if I'm on the right track or way off.
Big O Notation: N
function(n) {
For(var a = 0; i <= n; i++) { ... |
Setup: Suppose you are teaching an introduction to Databases class, the students are CS students that have a working knowledge of tree structures, how they can speed up searches, and have probably implemented a few in their lifetime.
Question: How would you describe the way in which a database uses indexes to search a ... |
I'm in the process of learning the Android SDK and creating some projects to get a grasp on the system. The current project I'm working with works just fine but I'd like to get some advice about other ways I can go about designing it.
Here's what it needs to do.
When a text message is received from a specific number, ... |
I've worked in some projects where most of the business logic was implemented on the database (mostly through stored procedures). On the other side, I've heard from some fellow programmers that this is a bad practice ("Databases are there to store data. Applications are there to do the rest").
Which of these approaches... |
I believe that in an ideal team, members should have different but complementary abilities. But is that true about software development teams?
As an example we are a small team of 5. We almost have the same abilities and interests but with different levels of skills. Regarding such situation I think we don't cover our... |
Given sorted data, the search solution is obvious. Given unsorted data, sensible options are sort then search or just linear search.
This question is about what to do if the data is somewhat sorted, but cannot be re-organized (write operations require sector erase, and sectors won't fit in ram).
the details:
Data reco... |
As far as I know it is not possible to see the bits of an integer in Visual Studio, you can see variables in decimal or hexadecimal format in the Locals and Watch windows in the debugger.
Why is this limitation in place and are there any tools/addins to see integers as bits?
|
I should define a testing strategy and environments and I have encountered rather terminology issue (but might well be my fault) so I hope someone will correct me here.
We are using INT environment where the application is deployed at first and then SIT environment, where is the app passed if it is fine on INT. So, tes... |
I was wonder what people do in this situation.
You have an admin area of a system where you let users define a list of values they want to see in a dropdowns across the system.
What do you do in your application is a user wants to delete this option?
What do you do with data records which already use this value?
|
I'm looking for pseudocode suggestions for sorting my mp3 files in a way that avoids title and artist repetition. I listen to crooners - Frank Sinatra, Tony Bennett, Ella Fitzgerald etc. singing old standards. Each artist records many of the same songs - Fly Me To The Moon, The Way You Look Tonight, Stardust etc. My g... |
Suppose we have some long stack of numbers. There is another intermediate stack, and a destination stack to be returned in the end. The only two operations allowed is transferring the top of the old stack to the top element of the intermediate stack and transferring the top element of the intermediate stack onto the to... |
Given a number n, find a permutation of the numbers 1...n such that all adjacent entries sum up to primes. If such a permutation does not exist, throw an error.
Is there a purely-functional way to do this problem? The solution, which apparently uses backtracking, given uses C++, a language which I am not very familiar ... |
I started coding with php, mysql, html, and javascript back in 2002 and heck that is all you basically needed to create any type of website. Over the years I picked up other languages, but what turned me off were all of the frameworks and JQuery that was popping up every few months and clients (if freelancing) or emplo... |
I have realized that its possible to create algorithms that operate physically to solve problems much more efficiently than in a computer itself. Consider the following:
Finding the shortest path between 2 points in a connected graph. If one were to physically create the graph with the edge weights correspond to length... |
I'm writing Ruby code for a simple encryption exercise and have frequently run across this dilemma (the exercise is a solitaire cipher if you must know). It is a question of whether I should pad out my logic with descriptive variables and single step statements that make the function readable instead of a concise, eve... |
I've read in several sources including Mark Seemann's 'Ploeh' blog about how the appropriate placement of the composition root of an IoC container is as close as possible to the entry point of an application.
In the .NET world, these applications seem to be commonly thought of as Web projects, WPF projects, console app... |
I'm working on a realtime multiplayer game using Django and gevent-socketio, I'm facing some issues:
I need to send an update of the game state to connected players every X seconds (~4 seconds), so basically I need to execute a function every x seconds which does some calculations and sends the connected players the ne... |
From the Blink Blog:
Finally we’d like to explore even larger ideas like moving the entire Document Object Model (DOM) into JavaScript.
What does this mean? Does it mean WebKit's DOM is currently not coded in JavaScript but in some other language? Does it mean that they want to expose more public accessors to the DOM... |
I've been studying http://www.vagrantup.com/ for several days and I'd like a feedback by people using it in a professional context or for personal projects. I think I get what positive things can bring Vagrant but I have questions about its drawbacks:
I'm a php developer and I work in a small company. I'm wondering if... |
I'm currently planning a new ASP.NET MVC3 project which will be quite bespoke. However, there will be a lot of common features (login, profile edit, blog etc).
Initially I was planning on building this all from scratch, however I'm tempted by CMS so that I'm not reinventing the wheel, and don't waste time building stan... |
I am working in C++ and I have this problem.
class Container {
Container(int which_type_to_use_a_b_or_c);
A & getData(A & prototype);
B & getData(B & prototype);
C & getData(C & prototype);
private:
A a;
B b;
C c;
int type_used;
}
Only one of the A,B or C datatypes is actually used in a clas... |
Somewhere I read Spring offers convenience over configuration. But Spring folks are bringing in so much changes over the configuration , that I am now really getting confused to use the xml configuration or the annotation.
I would like anyone to suggest a surefire methodology or rule of thumb in using xml and annotatio... |
I'm currently on a medium-sized team of web developers. We're using jira for bug tracking.
We're working on a product with frequent layout changes. A lot of times bugs are filed about a bug in the layout in some browser. Sometimes, by the time we get around to dealing with a low priority bug, the layout has already cha... |
I'm trying to improve my OOP code and I think my User class is becoming way too fat.
In my program a user has rights over "lists". Read, Write, Update, Delete.
So I made a User class
class User
{
protected $_id;
protected $_email;
protected $_username;
protected $_hashedPassword;
//...Various setters/getters
public f... |
In both algorithms objective functions, that will be executed with non quantum computers, are used. Both algorithms are methods for finding the global minimum of a given objective function.
From wikipedia:
Quantum annealing can be compared to simulated annealing (SA), whose "temperature" parameter plays a similar ro... |
What would be the best approach to resetting a mobile app's content/settings?
Let's say the app is cross platform: iOS/android using javascript/phonegap. The current way this is designed is to have an admin area that can see mobile devices (users which have logged in). The admin has the ability to flag a device for r... |
I've recently had doubts about some design decisions that I frequently make, so this time I decided to take some time and try to analyze it to find the best solution. I will describe a simple scenario where the design decision can be easily understood. :)
Suppose we are developing a game in Java where players can have ... |
I have an existing website theme that I have built. I've been using github to maintain this theme, let's call it dragon. We are changing the theme entirely but we're using the existing theme as a foundation. Should I create a new github repository for the new theme? Or should I just continue pushing to the dragon repo?... |
I've been doing a lot of reading online trying to figure out how to write asynchronous JavaScript code. One of the techniques that has come up a lot in my research is to use callbacks. While I understand the process of how to write and execute a callback function, I'm confused why callbacks seem to automagically make t... |
Has anyone ever come across this problem?
When you have a team of developers working on a project, how can you measure their contributions to said project? Is there a "formal" way of doing it? Number of commits? Number of bug fixes? Lines committed? Or maybe on a ticket basis?
I'm trying to think of a workflow where ... |
I want to build three sites in PHP. I'm doing this as slowly, thoughtfully and carefully as I can, to learn as much about things like OOP and software architecture as possible.
From past experience I already know there will be a time when I will be glad to have logging functionality. I probably want to have different t... |
I am about to port a game that was initially written for iOs and I am having some doubts how certain things should be done.
I have been looking many of the examples of the game loops for android, and almost everywhere the game loop is designed to run in separate thread and not in main UI thread which seems fine and log... |
We have a function that modifies a JS object, by adding some custom properties to it. The function doesn't return antyhing
addTransaction: function (obj) {
obj.transactionId = this.getTransactionId;
obj.id = this.recordId;
},
Somebody said they preferred that addTransaction return the obj.
Here's what I thou... |
I'm having some issues with my Nexus 7 drawing just 500mA from a USB port able to supply 2.1A (test with my iPad). Details in this question. However, there is a comment posted "The Nexus obviously detects the 'data' pin connected, and assumes it is not permitted to draw more than 500mA (which is the proper USB spec)."
... |
I have the following classes that I want to store.
public class StorableObject
{
public string Id { get; set; }
}
public class User : StorableObject
{
public string Name { get; set; }
}
public class Project : StorableObject
{
public string Name { get; set; }
public User Owner { get; set; }
public ... |
I am designing an open source Java library that I will likely release with an MIT license, and its sole dependency is the ASM dynamic bytecode injection library.
According to their license:
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in... |
Programmers often talk about the time complexity of an algorithm, e.g. O(log n) or O(n^2).
Time complexity classifications are made as the input size goes to infinity, but ironically infinite input size in computation is not used.
Put another way, the classification of an algorithm is based on a situation that algorith... |
I'm developing a WordPress theme and am planning to sell it myself. I was thinking of having a 14- or 30-day refund policy for customers, but my concern is that people can essentially get the theme for free, if they: 1) buy it, 2) download the files, and then 3) request a refund. Then they would have both the theme and... |
Which open source java projects do you know to be high performance or real time performance? I tried hard to find them on github or google, but couldn't find suitable.
I want to learn from this projects, so will not be as a newbie on my interviews ;)
So far I am going to stick to Play Framework project.
Are there bett... |
From that question about differences between Quantum annealing and simulated annealing, we found (in comments to answer) that physical implementation of quantum annealing exists (D-Wave quantum computers).
Can anyone explain that algorithm in terms of quantum gates and quantum algorithms, or in physical terms (a part o... |
I have branched from my develop branch bugfix/issue2 to work on a bugfix. Now that it's done I want to merge this branch bugfix/issue2 back onto develop but it's asking me if I want to merge into my current branch. And I don't know if my current branch is develop?
See attached screendumps:
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.