instruction stringlengths 34 19.9k |
|---|
We have some requirements to send emails when various field values are changed in our system.
It's an asp.net system using linq to sql with javascript/jquery.
Is it preferred to check if a value is changed via js (hidden field is set if the value is changed) or is it better since we are using linq and I have access ... |
I have employed a recursive call to a closure in order to mitigate against some race conditions I am getting (That's what I think it is).
I'd like to know if (and why) this is a good solution or a bad solution.
function getResources(activity, resource) {
var q = when.defer(),
resourceQuery = constructSelection... |
I've built a set of what will be server-side programs in python. Essentially they crawl the net and index news articles.
The iOS mobile application will be what the user interacts with. So it needs to query the server somehow to get the results back. I.e. if the user types in 'Google' or 'GOOG' it will return news arti... |
Should performance tests be instrumented by build tools as part of the build process, or should they live completely outside? If outside, then where in the deployment pipeline should they live?
I currently see performance tests being attached to integration testing lifecycle phases. While it's fine for now, I know thi... |
When using gettext or a similar framework, should the translation strings include ':' (like "Label:") for generating labels for UI or should I add ':' in UI code itself?
|
After reading about the HashLife algorithm, I found that it runs in O(log n). The Game of Life is also Turing Complete, so in theory we should be able to run any algorithm on a "computer" constructed in GoL.
As a consequence of HashLife's time complexity, could algorithms run faster? e.g. if an algorithm takes 10 secon... |
Say I have this code:
Design
{
public function load()
{
$this->loadProduct();
$this->loadService();
...
}
public function loadProduct()
{
try
{
$this->product = new Product();
$this->product->spec = $this->product->loadSpecs($this->a, ... |
We follow pair programming in our company and always face the issue of balanced and effective pair rotation within the developers on stories.
We follow a simple metrics in which every developer's name is mapped with every other developer and we mark the respective intersection whenever two developers are pairing.
This... |
I have a website that stores all users in a database. A user can log on to the website and if they have sufficient privileges can add/delete users, as well as change their privileges.
How do I ensure there is always at least one Administrator (to create/edit/delete users) in the system or that an administrator can easi... |
We are evaluating and setting up Continuous Integration for our PHP project. Each of the Continuous Integration tools has their own proprietary "build language" which will run many commands and check the return status of these commands.
Here is an example of a .travis.yml configuration:
language: php
php:
- "5.3"
... |
I solved my problem by using simple nested loops and comparisons but I'm wondering if there is a well known Selection Algorithm to solve my problem.
Let's say I have an array such as
[1, 10, 250, 9, 8,8, 249, 249, 248, 247, 2, 4, 9, 10, 9, 7, 6]
I need to find subarrays
[6,7,8,9,10] [8,9,10] [247, 248, 249, 250]
Suba... |
Background
I am coding two closely related Java projects.
The first project is Single Facility Simulator,
which simulates a very simple supply chain with a single facility.
The second project is Supply Chain Simulator,
which simulates more complex supply chain networks,
i.e. multiple facilities arranged as a graph
with... |
I have been trying to use classes that implement ActionListener to respond to user input. I'm consistently noticing that for an action listener to communicate the event to other objects, it has to contain the object. Like,
The object I want to get updated when action_src is clicked:
public class Display_Field {
... |
I'm trying to find the best patterns for javascript usage in my sites, and in doing so I tend to look at source code at some sites (meetup.com, facebook.com, etc). One thing that sticks out at me is the fact these sites seem to compress all of their javascript and place it in the actual page rather than using a <scrip... |
I'm going to use a language-agnostic description of monads like this, first describing monoids:
A monoid is (roughly) a set of functions that take some type as a parameter and return the same type.
A monad is (roughly) a set of functions that take a wrapper type as a parameter and returns the same wrapper type.
Note ... |
Recently, I found multiple GitHub repositories that would allow me to perform the same task. (In my case, assess the readability of text strings.)
It made me wonder, what are the best practices for programmers to choose between different open-source libraries, and in particular, libraries hosted on GitHub?
GitHub stat... |
What would be the best design pattern for this problem:
I have an Object A. Object A can either be registered or deleted from the database depending on the user request.
Data validation is performed before registration or deletion of the object. There are a set of rules to be checked before the object can be registered... |
Do the message being passed between objects in Sequence Diagram match with the methods in Class Diagram?
|
I'm doing this one anonymously.
Our company manufactures some kind of machines and also has a software department, which I'm part of. Our philosophy is mostly to have in-house software and components of the machine instead of third-party where reasonable, so we can quickly implement customer requirements.
Most recent... |
I have 2 applications one is written in C++ and one is written in Java. the applications communicate by passing byte arrays which represent a serialized object.
each communication object represent a Command and holds the command id and the associated data.
I will use an example to describe my problem.
Let's say I have ... |
I have a project which involves collecting config data from windows servers in our (very large) server estate. My manager wants me to collect over 150 data items across all configuration areas including network config data, disks, registry values, BIOS version, dll versions, you name it. The server support team current... |
I've had a few programming jobs in the past where I was the only developer working on a project. After I've left, I typically get several emails a week from these companies, usually from the developer(s) who's replaced me there. These emails are usually asking for details about how things work and how I'd best go about... |
I am currently working with an "interesting" code-base and see the following type of thing alot in the code.
public Object doSomething()
{
Object obj = new Object();
// Do some stuff to the object
obj = doSomthingElse(obj);
return obj;
}
I always feel when looking at this kind of code that it is... |
I'm using Features to document the features as we originally communicated them to our client at proposal stage. I now want to create User Stories that relate to the features so that I can easily map our stories back to the proposal.
Many of the stories naturally map across features, but Team Foundation Server (TFS) do... |
Yesterday I was discussing with a "hobby" programmer (I myself am a professional programmer). We came across some of his work, and he said he always queries all columns in his database (even on/in production server/code).
I tried to convince him not to do so, but wasn't so successful yet. In my opinion a programmer sho... |
Does the variable used for iteration in a foreach loop have a more specific term than simply 'the foreach variable?' Especially to differentiate it from the collection variable?
E.g. item in foreach (item in collection)
Edit: Loop variant was suggested (wiki):
In computer science, a loop variant is a mathematical func... |
The application we have in mind is a relay server. The aim is to accept large numbers of incoming socket connections (at least thousands) that will stay open for lengthy periods (hours or maybe days). They will exchange modest quantities of data and they need reasonably low latency.
The technical design is straightfowa... |
I've developed the standard ELO implementation that can be found here, but the problem I'm running into is that my players will only have between 10 and 40 games in a "season". Since my first season has already completed (I'm just now starting my OWN rating system for my game), I know what the rank of my players ELO ra... |
I'm asking myself a question to code the right way on a new fresh project.
I have a designed database and I mapped tables to equivalent POCO classes using Entity Framework 6 Code First.
Then, I thought "wait, if some day I want to switch from EF to another Framework for whatever reasons, or even say let's go for direct... |
I hear that Abstraction is a technique that helps us identify which specific information should be visible, and which information should be hidden.
Encapsulation is then the technique for packaging the information in such a way as to hide what should be hidden, and make visible what is intended to be visible.
I unders... |
I'm a self taught PHP programmer. Because I have no formal training in PHP, I often find my coding style to be considerably different than example code I find on the Internet. I've slowly started adapting some of the more common practices I find. However, before changing my habits, I try to find a good reason to use th... |
When working with a single object there are a number of ways to segregate interfaces to it.
Breaking it into smaller components that can be treated independently.
Breaking it into simpler interfaces.
Both of these seem challenging to do with a tree. I think it would be nice to be able to do the following.
class Node... |
I've got a Python project wherein a basic object is created and various different attributes are modified/given to it via what I thought was a good example of a strategy pattern.
In this silly game there are enemies with multiple different potential patterns of movement. The Enemy class has a basic pattern of movement ... |
I'm not quite sure what the real practice is in the programming community. But when a user deletes content from your service (ie. deleting a status update, a photo of theirs, a comment they made). Should I actually delete them from my server or just hide it?
The reason why I am asking this is because we live in a age w... |
I have a large list of intercommunicating components; so I decided to have one class create all of them and then subsequently delegate them to other classes to facilitate finer tweaking and wiring together.
By "finer tweaking", I mean that the components are modified to their final state; and by "wiring together" I mea... |
This is a question that's been on my mind for a while.
Recently I've been checking out concurrent languages like Haskell or Go or Erlang.
From my point of view, they have huge benefit in performance as opposed to languages like C++ or Python because of the way they handle functions in parallel.
My question is: Why is t... |
I had an idea (which I'm sure already exists), to create a sort of 'network of observers/subjects'. I would like to describe how it works and than ask several questions about it.
Say we have 5 objects: Objects A, B, C, D and E. Objects D and E need to observe objects A, B and C.
With the regular Observer pattern, both ... |
I'm trying to understand how the Dependency Inversion Principle differs from the "program to an interface, not an implementation" principle.
I understand what "Program to an interface, not an implementation" means. I also understand how it allows for more flexible and maintainable designs.
But I don't understand how th... |
Is it recommended that TDD be always practiced in a project, or are there cases when it should be avoided?
Should we all adopt TDD?
Is it standard practice in major software companies?
|
Our company is trying to follow Agile methodologies when it comes to estimating and prioritizing any new development work. The reading I've done makes this concept appear great so we are trying to give it a good crack at making it work for us and hence help with providing a better solution at the end of the day for ou... |
Given a large group (50+) of programmers:
All given the same problem,
All using Test-Driven Development (TDD),
All pair programming,
All doing group-based code review,
I have personally seen the wide spectrum tests that are possible for the same problem, even on the first test. So, if TDD is design, how do you know y... |
We are working on ASP.NET webforms application developed using WCSF (MVP pattern). In the application, there is a search screen that allows the user to enter some fields and display the results.
We have segregated the functionality into user controls and each user control has its own view and presenter.
Search -> It ... |
For the entire past year I've been written Scala code (coming from a Java background). I really liked how you could create simpler and cleaner code, with vals, case classes, map/filter/lambda functions, implicits and the type inference. I've used it mostly for an Akka-based application.
This year I'm on a Scala project... |
Let's say you work for a company and what you do is develop software for them. You have no idea of the big picture or maybe slight. What you do have are tasks assigned to you via issue tracking system. You're given tasks, you make them work the way the task describes them, you send them back. Like adding 2 integers:
fu... |
I have a class Container containing objects of type Item. They are different classes, and especially they have no common base class (e.g. a Container does not itself have a Container).:
class Container
{
public ICollection<Item> Items { get { /* ... */ } }
}
class Item
{
public Container Container { get { /* .... |
Why does Python use hash table to implement dict, but not Red-Black Tree?
What is the key? Performance?
|
I am trying to figure out how to architecture my project in the DDD paradigm (a complete beginner in DDD) and stumbled upon a problem about the implementation of the web services... These are some options that I see:
Fat client, Fat server (option 1):
Server:
Repository layer: talks to database and can return domain ... |
In the manufacturing of a device each one has to get a unique identifier. So far so good, one can have a file containing the last used ID on a shared drive, or a network-based service managing and assigning IDs so that the uploading of the ID into the device will not be limited to a single workstation.
However, in the ... |
Why do so many people recommend offloading email to a transactional service such as Mandrill, Postmark or Sendgrid?
Is sending email via smtp really that much slower than sending a request out to said service?
I imagine it has something to do with the rendering of the actual message, but I'd like a more informed reason... |
Consider this license I wrote for my software:
Copyright 2014, [my name]
The author(s) of this software intends to provide the users with the
maximum amount of freedom. As such, this software may be used under
any one of the following licenses:
1. MIT: [link to the license]
2. Apache 2.0: [link to the license]
3. BSD... |
The following code give the identity matrix of any size the user wish it to be:
program identitymatrix
real, dimension(:, :), allocatable :: I
character:: fmt*8
integer :: ms, j
print*,'the size of the matrix is?'
read*,ms
allocate(I(ms,ms))
I = 0 ! Initialize the array.
fora... |
Is it necessary to use interfaces for small projects? I work at a shop writing small custom applications for clients, primarily data manipulation. I'm mostly self-taught but also took some programming classes in college. I've been trying to apply more OO concepts to my coding practices, but I really don't see the need ... |
Alexander Stepanov stated in talks and interviews that his realization that eventually lead him to generic programming and the Standard Template Library, was from the case of the parallel reduction algorithm.
Why isn't there parallel_reduction(begin,end,associativeop) in the STL? Or something that could easily be turne... |
Referring to the image here:
From http://en.wikipedia.org/wiki/File:X86_Paging_4K.svg
Could somebody please explain something for me? I don't get exactly how this works. As I understand it the page "directory" contains an entity which essentially points to the beginning of the "page table". However, surely all of the... |
I have a web application that uses MongoDB as primary database. This is the first project I do with a NoSQL DB. I'm trying to create the application model but I'm confused. I know NoSQL databases are non-normalized and it is normal to replicate data avoiding joins (which are not supported) but I'm now thinking of this... |
my IT boss wanted this scenario to be undertaken: First, we develop an Alumni program using PHP and deploy this in the web server which can be accessed by that school alumni in the web to update their personal data anytime. Then, using exactly that SAME program we must also deploy this locally, thru the LAN in its sate... |
I recently had a discussion with a friend of mine about OOP in video game development.
I was explaining the architecture of one of my games which, to my friend's surprise, contained many small classes and several abstraction layers. I argued that this was the result of me focusing on giving everything a Single Respons... |
Design by Contract says, in terms of the function talking: "you give me all the right parameters and I'll give you exactly this kind of data" ...in essence.
So, given that, should I use up resources checking the output? I should check for properties that the function does not guarantee its output possesses, but the pr... |
As far as I know, declaring an interface is like so:
public interface Roots_Squares {
public double square_root( double value );
}
Now... how do you enforce value to have non-negative values? Such a function should avoid negative values right? If someone creates a class that implements this, and that implementat... |
My team is working with git for the first time and has really messed up our git remote due to our inexperience. I'm trying to help educate them on git to solve the problem in the long term, but in the meantime, the commits that have been made are totally wrong. We haven't made very much progress at all, and I don't see... |
The build server at our company sucks. The build agents (there are a dozen of them, each is a separate VM, and apparently they are all living on their own ESX server) are SLOW. The web interface is SLOW and is running on a Windows VM, also on ESX. Everything is SLOW, SLOW, SLOW. Artifact upload sometimes fails for unkn... |
I recently had a small "argument" about inheritance with a friend. I think people overuse it a lot. Intuition tells me that that the only good reason for class inheritance is polymorphism - when there is a case that you want to treat uniquely object of different but related classes.
Our argument was about having a Base... |
I often see the advice that you should try to make each library independent. And yet in reality I can never seem to achieve this. Is this BS advice or is it actually possibly in any realistic way?
Example: I write a 2D Vector library, I then use that to make a 2D collision library. I then build a 2D physics library tha... |
An agency wants to develop a highly secret computer system using public contractors. So they hire different companies to implement different components of the system. When all the components are put together the system is functional, but each component on it's own does not reveal the true nature of the system. Often t... |
I'm trying to get some pointers on what the best methodology to follow for a web application would be.
First, some background: I've built two different APIs using Node.js where Node serves the data to clients using a JSON interface. The clients have both been iOS applications, making heavy use of Socket.io and Express.... |
I primarily develop in .Net, and have been playing around with F#. It's a nice concise language, but I'm just using it for throwaway code currently. I've taken to sitting my tests in the same file as the main code that I'm writing.
I am under the unexamined opinion that this is done so that we don't have testing code f... |
Thinking about the design of a potential new language, I wonder how related are the concepts of built a OO similar to GO interfaces and multi-methods (I get this from http://docs.julialang.org/en/latest/manual/methods/).
If I understand this right, the interfaces are simply a group of methods that must be implemented b... |
I did my homework, and it says that dynamic data structures are "data structures that change in size as a program needs it to by allocating and de-allocating memory from the heap".
So I was wondering, are PHP arrays examples of dynamic data structures, or are they limited to binary trees and double-linked lists?
Thanks... |
I am trying to write a branch and bound search on the set of all functions f: D -> R, where the domain size is small (|D| ~ 20) and the range is much bigger (|R| ~ 2^20). Initially, I came up with the following solution.
(builder (domain range condlist partial-map)
(let ((passed? (check condlist partial-map... |
I am using a bunch of freelance programmers to develop a web application. We are in the early stages of development, meaning that we are making many changes to our database schema. We have one test database and one production database, we also have a replica of the live database, which gets a clone of the live database... |
These options which obscure me are like
ps aux, route -ee, gcc -fPIC xxx, find . -name xxx and so on.
The examples above aren't comprehensive.
I.e., I don't think that the argument handle function like getopt or getopt_long could handle all the "strange" options.
In the other hand, these handle ways aren't intuitive... |
I am wondering how to test .aspx.cs and .ascx.cs code behind. Can I use unit testing and if so how? Are there alternatives that will help test the functions in the code behind files? I don't know how to mock the page or control.
I would like to try to apply tdd methodology but I don't know how to unit test the code beh... |
In localization code (like T('English phrase with %s and %s parameters', param1, param2) the order of parameters in different languages is different. How to handle this?
Our localization engine seems not to support named or numbered parameters, so the parameters need to go in the same order as they are in code.
|
There are bunch of console programs and especially games using full redraw (not sure ho this correctly named) of console window.
For example, look at output of linux top program -> http://upload.wikimedia.org/wikipedia/commons/9/9f/Top_program.jpg
it doesn't just write text line by line all the time making the whole ou... |
I am modeling a class diagram and have spotted an opportunity to simplify it slightly. What I want to know is, would this it be better to implement an abstract class or an interface?
The scenario is this, I have the classes:
Artist
Genre
Album
Song
All of which share the methods getName, setName, and getCount (playc... |
I am wondering about performance of a web site/application when there is code in the code behind files rather than when the code is moved to separate files in the App_Code folder.
My understanding is that the code behind gets compiled and executed every time they are requested by the user. If this is not the case, ple... |
I've been confused for a while about the differences between the patterns Factory Method and Abstract Factory. Been doing a lot of research, still confused.
I have one question:
Is the only difference between the two patterns, is that Factory Method produces one object, and Abstract Factory produces a family of objects... |
For a project, I need to work with varying types of files from some old games and related software--configuration files, saves, resource archives, and so on. The bulk of these aren't yet documented, nor do tools exist to work with them, so I must reverse-engineer the formats and build my own libraries to handle them.
A... |
I'm trying to understand when is preferred to use recursion rather than iteration.
Actually I've encountered recursion only in Javascript but never in Python. I imagine that recursion should be used in determinate contexts or languages but I don't understand when I should use it and which advantages it gives me.
I woul... |
Question:
As an lone, Agile (PXP/PSP) developer what is the proper structure for a formal project post-mortem?
Scenario
I'm using a PXP methodology (which is a blend of extreme programming and the personal software process) to work on an undergrad project. The project revolves around computer vision and architecture. ... |
You can use << to multiply and >> to divide numbers in python when I time them I find using the binary shift way of doing it is 10x faster than dividing or multiplying the regular way.
Why is using << and >> a lot faster than * and /?
What are the behind the scene processes going on to make * and / so slow?
|
Suppose i have an abstract base class Parent which defines an abstract Method A(some parameter) taking a parameter, also it defines an instance Method B which calls method A(parameter) inside its body and passing some parameter.Then we have an concrete child class B which extends the base class and provide its own imp... |
What is the industrial practice on how to separate html and php code in a web project? Using echos to generate html is considered bad but what is the standard way to achieve the sought separation? Using template engines like twig?
|
When studying OOP by myself I often encounter UML class diagrams. I understand them, but don't completely know how to write them.
Meaning, I don't entirely know what each kind of arrow means, and things like that.
1- How important is it to learn the 'language' of UML class diagrams? If it is something worth the time, c... |
A is a sorted list. B is a sorted list, and a subset of A.
If an element is inserted into A at index i what's the most efficient way to determine the correct index i' for it's position in B?
Given the fact that both lists are sorted, and that we know B is subset of A I would think we should be able to devise quite an e... |
final String str = "do not change me";
str = "why not?"; //it will result in compile time error saying that final fields can not be re-assigned once created i.e. the reference cannot be changed
String str1 = "hello world";
System.out.println(str1.replaceAll("h", "q"));
str1 = str1.replaceAll("h", "q");
S... |
Why do projects opt to stay on an older framework version of the .NET Framework?
For example, staying on .NET Framework version 3.5 which was released in 2007 instead of upgrading to the latest 4.5.1 version?
Jon Skeet's Noda Time also targets .NET 3.5. Why?
|
My question concerns deployment scripts in the process of continuous delivery.
Continuous delivery recommends that deployment scripts should be versioned into SCM just as normal code.
What is the best practice to avoid issues such as checking out (e.g. from Git) a script that does not have the right permission or is n... |
It is common sense not to store passwords/credentials into SCM.
I would like to know then what would be a good strategy for storing passwords/credentials in the context of continuous delivery.
Where and how do I store credentials?
How do I retrieve and use those credentials/passwords?
|
I am currently looking into Google Caja to run user-supplied JS code in the browser and in Node.
So far, I understand, that, in a browser context, "cajoled code" disallows reading and messing with the window state by running unsafe code through a full-blown parser that gets rid of all kinds of attack vectors, and then ... |
I am using a very primitive Java that doesn't have Generics, and also I can't use reflection.
I want to create a generic list so it would be typed safe (i.e. I only have a list that contains Objects and I want to create a list that contains specific object and not a mix).
On the other hand I also don't want to create a... |
I'm currently reading 'Head first design patterns' and I already have a few questions on the first chapter of the book.
This chapter introduces the 'prefer composition over inheritance' design principle, by explaining the 'Strategy-Pattern'. My question isn't about the pattern, but rather about a more basic design deci... |
I was reading a lecture on arrays for Fortran 90
and I came across this sentence :
'Fortran always stores by columns - the first subscript
varies more rapidly than the second, and so on.'
What does the author mean to say ?
|
I'm learning about the Dependency Inversion Principle. It states that:
High level modules should not depend upon low-level modules. Both
should depend upon abstractions.
For a while I tried to understand what it means that both the high level components and the low level components, rely on the abstractions and are... |
On this site hackfind.com the autor put minified version of my library without any copyright notice. Is this violation of the LGPL. Note that using on a site is not a copy.
|
I am confused with what's the different between clarify and gather. I know using interview, observe or questionnaire can to elicit the requirement we want, but how to clarify the functional requirement?
|
I'm wondering what the difference is, and at what stage these different terms are used within the Agile/Scrum methodology?
use case, user requirements and user stories
Am I right in thinking they start off in the requirement elicitation stage as use cases then become the user requirements, which are pretty much the sam... |
As far as I can see there are two ways of building a html page: "inside" the language (I'll call it building for lack of a better name) or outside the language (using templates). Let me explain a bit what I
mean by this before I jump to the questions.
Building
One way is to build the html page "inside" the language you... |
I am very confused about white box testing.
A simplified version of the example: the entire system consists of three methods - methodA(), methodB(), methodC().
The program starts from methodA(), and methodB() requires input from methodA() and methodC() requires input from methodB().
Do we create 3 white box tests, one ... |
I'm currently working on a project with a team that's using a git workflow. It's fairly simple: master should be in a deployable state and branches are used to create features and hotfixes. Whenever we have a feature or bugfix completed and tested then we move that over to master as soon as we can. The idea is that bra... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.