instruction
stringlengths
34
19.9k
I am learning how to write a System Requirements Specifications, and most of templates I have seen talk of a Context Diagram. What exactly is a Context Diagram?
There's a project I'm working on that is looking to produce a web application that will manage a task list between multiple users. This is a master task list whose task items get distributed by an authorized user. Each user has his/her own account to login and view the tasks they are assigned; it is possible for mult...
Does the choice of using a DVCS over a CVCS actually make for shorter release cycles? If so, what makes software release cycles shorter and what are the arguments for this? Related to pull request? Does easier submission of patches play a role here? Related to people factor? Are project teams that use CVCS act more c...
I'm writing a log parser that continuously looks for specific patterns and then fires off events to another system when it finds these matches. The firing of the event is time critical to catch errors or ensuing problems. This part is non-negotiable in terms of design. The log files belong to Applications and the Opera...
Is there a word for the problem of a framework becoming married to the software modules it supports, for example adding methods to a base class that may apply only to certain subclasses or use cases? It's a particular kind of violation of separation of concerns. The words that come to mind are "upward devolution" or "f...
It might be a strange question, but why there is no implication as a logical operator in many languages (Java, C, C++, Python Haskell - although as last one have user defined operators its trivial to add it)? I find logical implication much clearer to write (particularly in asserts or assert-like expressions) then nega...
My department specializes in converting customer data into our database schema so that they can use our software. Right now, we have C# applications that take an IDataReader (99% of the time it is a SqlDataReader), perform some cleaning and mapping, insert it into a DataRow object, and then use a SqlBulkCopy to insert ...
So I'm fairly new to programming in the real world (outside of academic projects) and have come across lots of posts saying that using instanceof is a bad thing to use to determine what class a specific object is. My situation is that I have three classes, a base product class, one that extends off that and another tha...
I've been struggling with a design so I figured I'd ask here and see if anyone's able to help :) High level overview I'm designing an app to gamify exercise by creating mini competitions (ex. Who can lose the most weight in 3 months or bike the most miles in a month). Users can create competitions (calling them races...
Like many corporations the company I work for is transitioning to a performance review system based on SMART objectives. My team is a high functioning agile development team employing practices from Extreme Programming. To our great benefit our employment of agile practices has the full support of immediate and upper m...
When it comes to JSF, I've had trouble distinguishing where certain objects I create fit into the overall MVC pattern. The View is simple enough since that's handled by the .xhtml template but when it comes to objects like: Action/Change Listeners PhaseListeners Validators Navigation Beans Converters Filters At firs...
I have been trying for years to master Swing layout managers with no success. Every time I need to do something with Swing, it is like pulling nails to get the visual components to line up the way I want them to. I am familiar with frameworks like Matisse but that's not the point. My question is: Why does Swing even...
I am reading the C# specification. I could use clarification on a segment: C# has a unified type system. All C# types, including primitive types such as int and double, inherit from a single root object type. Thus, all types share a set of common operations, and values of any type can be stored, transported, an...
I recently got hired on as a new ASP.NET developer (C# code behind). When I arrived, I was told that they were moving to MVC 4, and so I bought two books on that. However, the other day I learned that they are NOT using Razor, but using WebForms. Most of the results via Google returned articles from before the WebFo...
From Section 5.3 of Google's paper describing MapReduce. "A Map function extracts a 10-byte sorting key from a text line and emits the key and the original text line as the intermediate key/value pair. We used a built-in Identity function as the Reduce operator. This function passes the intermediate key/value ...
I have always wondered why Java does not do type inference given that the language is what it is, and its VM is very mature. Google's Go is an example of a language with excellent type inference and it reduces the amount of typing one has to do. Is there any special reason behind this feature not being a part of Java?
There seems to be an immediate problem with starting to develop in Common Lisp: choosing an implementation. What should one take into account, and how much weight should it bear when considering a CL implementation? Should it conform to the ANSI standard? Should it be supported by SLIME? Do certain implementations lack...
Firstly I am sorry I do not fully understand about licensing. Thus I want to ask here for my curiosity about licensing things. Here is the case. I build a WordPress theme that using underscores.me as its starter theme. It has GPL v2 license. And then I build the theme using Twitter Bootstrap. It has Apache v2 license. ...
$clean = array(); $email_pattern = '/^[^@\s<&>]+@([-a-z0-9]+\.)+[a-z]{2,}$/i'; if (preg_match($email_pattern, $_POST['email'])) { $clean['email'] = $_POST['email']; } The example code above (Source) uses an array called $clean to store the filtered value from $_POST. It's considered a security good practice. What...
my question is rather short: How do I document typescript code properly? I found out that for projects becoming bigger and bigger, it is important to look at a function and immediately know parameters, what it returns and side-effects etc. It is tiring to have just a bunch of comments before a function, most of the tim...
Possible Duplicate: Does “Inversion of Control” promote “Anemic Domain Model”? My impression is that projects using a DI framework like Spring or Guice tend to lose their object orientation and degenerate to a purely procedural design: DI not only centralizes the question of which implementation of an object to use...
I was reading up on scalable bloom filters and could not understand how each time a constituent bloom filters fills up, a new bloom filter with larger size is added. The elements that contributed to the set bits in the initially created filters cannot be looked up for presence. Perhaps I am wrong in my understanding of...
I am working with a legacy system that is not too bad, but I thought of making some improvements to it, and I wanted to solicit your feedback to help me make good decisions. The platform is Linix (different flavors of it). The system revolves around running [sometimes long] "jobs" - command line programs. The jobs usua...
I have a resource loader object that loads objects from the disk or from a ZIP archive, depending on the platform. It has state (e.g. the path to the directory or the ZIP archive, and possibly some caching in the future), so it needs to be a single instance. So normally, a Singleton would do. But my problem is that thi...
Recently I found about two new programming languages(Vala and google's GO) which don't support method or function overloading and intend on not supporting them in the future ever! The creators of these languages say that overloading is evil and should not be used!(in system programming?) I was told that the creators of...
I recently started working on a PHP application that was built many years ago before the advent of objects and namespaces in PHP. The code is procedural, does not separate presentation logic from business logic, lacks a front end point (front controller), and has files everywhere with a seemingly random folder heirarch...
In the error monad, the first failure halts any execution further just carrying the fault through any following binds. What monad halts on success only carrying forward successes, and basically swallowing any faults and trying the next bind disregarding the failure of the previous one? The error monad could maybe be us...
Background: Here is the scenario, imagine I have a little Robot. I give this robot a Map, and I want him to traverse the map, after doing so, I want the Robot to tell me the shortest possible path on the map. So here is an example of a Map: Difficulties: The Robot is given the Map in the form of a HashMap. For the abo...
When I started working a programmer, I learned lots at first, on the job. Although Ive been given more responsibility, which is good in a way, it is mostly in the form of increased workload. I havent had much time or energy left to learn anything much new day to day. Sometimes I have 1 hr of time and energy left at th...
I'm learning Common Lisp, mostly as a "mind gym" hobby thing, but I want to end up with a set of skills that would also be usable "in real life", because when you learn a language you also accumulate knowledge about module and package management, deployment and stuff, whether you like it or not, so I want to learn with...
I came across this about CLISP: *"it all-but-forces your code to be released as GPL" here, when looking for a good Common Lisp implementation. How can a language force a license on your code? Is this just FUD? I'm asking because I really don't speak "legalese" so maybe there's something I don't understand here... I get...
Consider this function intended to kill all running instances of a subprocess: killAllFoobars() { pids = getRunningFoobars(); foreach ( pids as p ) { killOneFoobar(p); } return TRUE; } Where should I check that in fact all Foobars were killed? Should killOneFoobar() check that its Foobar is n...
I am currently working on an MVC 3 Web app project where I need to display a lot of information on the front page. I am relatively new at web page layout and design so I have hit a wall in terms of how to structure the code behind for this page. My first thoughts were to split the page up into as many partials as possi...
I want to start a little project, where I want to connect several of my devices. Some are Android mobile devices, others are desktop devices like a PC or laptop. Furthermore I want keep the project as generic as possible. Means I want to share it, so other people can use it. By connecting I mean send messages between t...
I developed an app in Java (which is working perfectly; with this app you can scan TCP/UDP ports -for testing purposes only-), but meanwhile when I was writing the code I read several documentation (wiki) about sockets. I thought open port is mean, a protocol where the client/server can establish/bind a connection even...
I just jumped into a new project with a new company using Entity Framework and ASP.NET MVC 4. I am no expert on Entity Framework, but I think I have a decent grasp of how to use it. From what I can tell, my models should reflect a table in the database omitting the columns I don't need. Also, we can use stored procedur...
My understandment is that hash maps allow us to link, say, a string, to certain memory location. But if every string were to be linked to a unique place in memory it would need a huge block of empty memory. I don't get it.
I need to sync my local core data stack against a server running a persistent data storage underneath the covers. (I've gone through other posts here and on SO on similar topics) My requirements: One way syncing. Meaning my server is always updated and my clients just merely need to be fed incremental deltas which the...
Im reading a log file in Java on a Linux box on a continual schedule of 2 minutes looking for certain messages. I store the last offset (RandomAccessFile getFilePointer) and read from it onwards when I detect LastModified has changed; is this best practice or even right?
I was just writing an if statement with fairly long property names and came occross this problem. Let say we have an if statement like this: if(_someViewModelNameThatIsLong.AnotherPropertyINeedToCheck == someValue && !_someViewModelNameThatIsLong.ThisIsABooleanPropertyThatIsImportant) { //Do something } The sec...
In many native types, a common suffix (and sometimes prefix) of t or _t is used to denote platform-independent types (such as wchar_t, int32_t, etc.) What was the logic behind the letter t as opposed to other letters (or none at all, especially in the case of wchar_t)? Does it stand for something?
So maybe the quick answer is 'Yes' absolutely (or no I suppose), but let me explain my question angle to get a better derived answer. We all commonly use SOLID design principals when making up the pieces and parts of our applications. Don't make a class do too many things, don't make an Interface too large, use abstrac...
If I want to create an infinite list of integers in Java like so: ArrayList<Integer> list = new ArrayList<Integer>(); for(int i = 0;;i++){ list.add(i); } I run out of memory. My understanding is that we allocate some memory for i, list, and every time we add i to the list, we allocate more memory for it. But, by u...
I just read an interesting article called Getting too cute with c# yield return It made me wonder what the best way is to detect whether an IEnumerable is an actual enumerable collection, or if it's a state machine generated with the yield keyword. For example, you could modify DoubleXValue (from the article) to someth...
Why do I, as a developer, have to go through so much trouble developing PDF download options for my clients when everyone in the world can simply hit Ctrl+P and life is good? The current issue I'm working on is dealing with Google Charts, so I'm not stating that offering PDF downloads in general is relatively difficult...
I recently decided to start learning iOS Development, and to this end I’ve been reading iOS Programming: The Big Nerd Ranch Guide. In the book the authors describe a design pattern MVCS - Model-View-Controller-Store, the basic idea being that since many applications make use of multiple external sources of data keepin...
Right now I'm interning at a major engineering company. I'll be leaving in a few months though, so my project manager has requested a print out of my source code for a VBA project I've been working on. He would like to have it reviewed to make sure I didn't do anything ridiculous, and to make sure it's organized well e...
I'm a backend programmer who works mainly in Python. I'll probably never want to be a full time front end developer, but with the goal of growing my skill set, I would like to become at least passably proficient in JavaScript. It seems like a language that is wearing a lot of hats nowadays, and if nothing else, I'd lik...
Possible Duplicate: Difference between defect and bug in testing In computer science technical writing, especially in software engineering, what's the difference between fault, error and defect? I want to quote an answer on Stack OverFlow by Daniel Joseph: To quote the Software Engineering Body of Knowledge Typic...
I am working on a command-line application that runs simulations. It has to be heavily configurable; the user should be able to provide a very large number (100+) of parameters, some mandatory and some optional. Obviously, these parameters will be used by a variety of classes in the application. I can see two approache...
We are using a bunch of separate classes suffixed with -repository to retrieve the data from the database; for each table its own repository. We have for instance a customerrepository class which has all kind of methods to retrieve customers, and a vacancyrepository which has all kind of methods to retrieve vacancies. ...
I am using JRuby. In my Java code, I have a class called Texture, capable of doing some graphic manipulation stuff. In my Ruby code, I will usually need to draw things, so though I should simply call Java's Texture class to do the drawing for me. However, I ended up making a Ruby class called Texture, which wraps an in...
When coding performance-critical portions of code (not necessarily large, but code that gets executed a lot), what topics should I be aware of/take into account. I'm already fairly familiar with caching, aliasing, branching, cost of arithmetic operations, loop unrolling (and I guess some others that don't come to mind)...
We're a software consultancy with a multitude of projects for different customers. We traditionally use Subversion, but are currently considering moving to Git. A significant portion of the documents we produce are shared with our customers (requirements, global designs, test specs, etc), and we use MS Office to produc...
So after one has programmed and integrated a licensing solution into his or her application, how should one deal with licensing errors? My understanding is: Show whether a license is valid or invalid - and report if the license server is not reachable. Nothing more, nothing less. Licenses could be invalid due to a vari...
I have pieces of code, written in java, which I can convert in jar and run from the terminal. I also have some node.js script, which I would like to run before running these jar files. So the process of running my project is as follows: Start mongodb from terminal->Run Node.js script-> Run the java code(jar file) So...
Internet Explorer has a number of proprietary features that aren't found in other browsers as well as a number of incompatibilities with the standards. Does anyone have an idea what is the cause of those incompatibilities? For example: I develop a browser extension using Crossrider framework. The extension works well ...
Reading about concurrency in Erlang, reminds me of the Akka concurrency toolkit. Both give you tools to prevent or limit race conditions. But you can send links to mutable data to other processes using the Akka toolkit, which is still unsafe. I see Akka as a useful tool, but it does not provide protection against ou...
I am building a REST API to expose most of functionality of an existing Java API. Both APIs are for internal use within my organization; I do not have to design for external use. I have influence over both APIs but am implementing the REST one. The Java API will continue to be used for local applications (it's not b...
I recently had some code I wrote a year ago fail because someone linked my code to http://code.jquery.com/jquery-latest.js In the latest version, jquery had deprecated/replaced a function. Nice to have a dynamically updated version but my code isn't going to change, it's going to break. Is there any reason to use jq...
I'm trying to figure out what the Anti-Corruption layer really means. I know that it's a way to transition/work around legacy code or bad APIs. What I don't understand is how it works and what makes it a clean separation from the undesirable layer. I've done some searching, but I can't find any simple examples or expla...
I have been thinking about this for really long time without reaching an optimum answer. First of all, I'm a medical doctor who loves programming but never really studied it, except for home learning and lots of years of playing around with code in my free time. Currently I'm trying to build a small project to manage m...
I'm primarily a .NET desktop app programmer. Coming into the web world has been difficult. I'm trying to convert one of my Silverlight apps into HTML. But I'm having a hard time figuring out the authentication system. I'm trying to read up on Live ID authentication and Windows Authentication but I'm having a hard time ...
TL;DR: Why use something like Apache Archiva or Sonatype Nexus as an artifact repository instead of Subversion? The build system I use currently has a lot of binary blobs (images, sound files, compiled binaries, etc), both as input and output to our builds. Our system for managing these is very ad hoc; some are checked...
I have a hierarchical ADT that I want to store in a database. Nodes have exactly one parent element that is a node as well. Multiple nodes can have the same parent node. My current approach uses an adjacency list with a table structure similar to the following: +----------------+------------------+------+-----+--------...
I have a rails platform that I maintain. It has a lot of different web applications built on top of it. However now a client is asking for an API so that they can keep users on their site, but take advantage of some of the automated tasks we have. The platform is used to build insurance applications and allows for the...
I have a terminology question. I was searching about tips to design a website that is using less server-side code and more client-side code, and realized I don't really know which exact term to search if there is one. Example: Maximizing CDNs usage for library, using widgets when possible, integration of client-side so...
I'm thinking of using a LGPLv3 library in a closed source commercial program running in a closed embedded environment. According to what I know from LGPLv3 licensing, I can use it as long as the closed source software dynamically links with the LGPLv3 library and leaves the freedom to the user to change or update the L...
I'm trying to build a database for an upcoming Ruby on Rails webproject. There will be 4 tables minium: tasks, users, attachments and comments. And 1 table to join the n:m relations (tasks <-> users). One task has many users, many comments and many attachments. One comment has many attachments and was created by one us...
I am working on a web application that displays some data and uses JavaScript. Right now, we are serving up parts of our JavaScript code (to display certain types of information, that is, "Render a View") via our server which dynamically writes the JavaScript code with the needed data embedded in it using JSPs. Three m...
For my basic kernel I refuse to implement the dreaded confusion of virtual memory scheming, so I want only real memory addresses for everything. Some people have argued with me that since virtual memory is hardware supported, and sometimes the MMU hardware is integrated with the CPU, is that a rule that virtual memory ...
So, I have an authentication module I wrote some time ago. Now I'm seeing the errors of my way and writing unit tests for it. While writing unit tests, I have a hard time coming up with good names and good areas to test. For instance, I have things like RequiresLogin_should_redirect_when_not_logged_in RequiresLogin_sh...
I'm in the process of designing an HTTP API, hopefully making it as RESTful as possible. There are some actions which functionality spreads over a few resources, and sometime needs to be undone. I thought to myself, this sounds like a command pattern, but how can I model it into a resource? I will introduce a new resou...
Problem I want to clone an svn repo with git-svn. The problem is the subversion repository changed layouts at r1235. Specifics From revision 1 to 1234, foo used the standard svn folder layout with: /trunk/src /tags/version/src At revision 1235, the author added bar to the repo. To do so they restructured the master r...
The situation would be: I develop 2 projects in my Node.js development environment, P1 and P2. P1 required the development of two simple modules, mod1 and mod2, which are stored in P1/lib. Each one of this modules resolves find their external dependencies in P1/node_modules. Necessary dependencies for P1 have been ins...
The Problem I regularly find myself writing the same code over and over again. For example if I want a value from a nested array structure I end up writing something like this: $config = function_to_get_nested_array(); $node = $config; foreach(array('vendor','product','config','leave') as $index => $key){ if(! isse...
I am trying to understand how a radio button is created in a Dynamic field by reading from an XML using Netbeans 7.0. I know the radio button is created because of the XML being read from database, but I cannot see how the radio button is created. Also, since I don't know where to place the break points, I can't see ho...
Our business requirements required to create a layered and modular architecture. So I designed an architecture to make it as decoupled and as modular as possible. I will list my layers below ASP .NET MVC Application (UI) Business Logic Layer (BLL) Data Access Layer (DAL) I have further used IOC where each BLL module...
I want to apply k-means clustering to a (sparse) adjacency graph. For this I need to assign the nodes to a position in an euclidean space. Trivially I can do this by having a space with as many dimensions as there are nodes where each component corresponds to another node. Now, in order to make the clustering a bit mo...
I'm in the planning stage for an employee intranet system to be built with ASP.NET MVC 4. We'd like the site to consist of separate "modules", each of which provides a different feature: messaging, payroll changes, etc. I'd like these modules to be able to be enabled or disabled at compile time. The homepage will displ...
It seems like, when reading something like this Wikipedia article about "pure functions", they list Today() as an example of an impure function but it seems pretty pure to me. Is it because there is no formal input argument? Why is the actual time of day not treated as the "input to the function" in which case if you g...
I know method overload is not allowed in Scala and I have read some posts regarding the reasons. But still, I see some functions overloaded in Scala library (example: println). I want to know how it is done and if I can use the same mechanism to some of my methods.
I'm building a website for a restaurant. They have a downloadable PDF version of their menu (which is what the "real-world" menu is printed from), but we also want to have a text-based version of the menu on the website (because it's the 21st century and you shouldn't have to read a PDF when browsing a site like this)....
In imperative languages, it is trivial to devise a programming test of language's use of "value semantics" or "reference semantics". One could do the following and check the value of a (where Vertex {one, two, three :: Integer}): a := Vertex 3 4 5 b := a one b := 6 two b := 8 three b := 10 However, since variab...
Recently I've started using Git at work. Previously I've only ever used VSS (which has some problems) and so far, Git is orders of magnitude better. The key differences here is that Git is distributed while VSS has a centralized "server" version, and that VSS uses a "checkout-lock-checkin" workflow while Git doesn't. ...
I know what recursion is in programming. I do understand the basics of version control systems (have used svn that is). But I have often wondered what the meaning of "recursion" or "recursive" is with respect to version control systems. What does a function calling itself have to do with working with files and direct...
I see two common patterns for blocks in Objective-C. One is a pair of success:/failure: blocks, the other is a single completion: block. For example, lets say I have a task that will return an object asynchronously and that task might fail. The first pattern is -taskWithSuccess:(void (^)(id object))success failure:(voi...
So I am undertaking a project which does navigation sort of thing. So here is how the problem statement looks like. Say, given a map of a floor, with different rooms, now somehow, this information is provided to the program and what the program does is, it takes two more inputs, The starting location. The final locatio...
I was reading Joel Spolsky's mercurial introduction when it struck me: "And now what they do is this: each new feature is in a big #ifdef block. So they can work in one single trunk, while customers never see the new code until it’s debugged, and frankly, that’s ridiculous." Why is this so ridiculous anyway, isn't th...
Background Consider the following scenario: Link. User provides a link to some poorly formatted website (e.g., creative commons content). Scrape. Server downloads the content (web scrape), always throttled. Format. Server formats the content (e.g., performs natural language processing). Return. Server posts formatted ...
Let's say I have a feature (topic) branch that I keep rebased on top of my development branch. During the course of the project (before merging in my feature branch), I decide that I need to make a large refactor to my project (for example, after updating a 3rd part module). So I do this large refactoring on my develop...
I'm using a combination of docstrings and Sphinx to document my Python programs. With Sphinx's autodoc, I can write a lot of documentation into the source as docstrings. Is there any standard for how much documentation to put in each? For example, case 1 is index.rst .. automodule:: foo :members: and foo.py """do...
I'm talking the kind of search that auto-suggests your query as you type, the way Google does, the way Wikipedia does, the way Stack Exchange suggests other questions as you type the title, etc. And Wikipedia used to have an awful search implementation, for those of us who remember. It had no auto-suggest, was shut dow...
My specific case here is that the user can pass in a string into the application, the application parses it and assigns it to structured objects. Sometimes the user may type in something invalid. For example, their input may describe a person but they may say their age is "apple". Correct behavior in that case is ro...
I work in a small team of four devs, one domain expert and one manager. We are looking to move to using scrum to try and formalise our processes. From what I understand of agile, it seems to be close(ish) to what we are doing anyway. We have a brief document with the overall features our product will have. As we come t...
Here is the Reddit's hot algorithm: cpdef double _hot(long ups, long downs, double date): """The hot formula. Should match the equivalent function in postgres.""" s = score(ups, downs) order = log10(max(abs(s), 1)) if s > 0: sign = 1 elif s < 0: sign = -1 else: sign = 0 ...
First off, I do not have anything against OO programming (I'd be mad if i believed so). But I was thinking on some sort of procedural MVC pattern with PHP; let me explain better. As we all know, variable scopes, unless they are taken from $_SESSION (, database, redis, etc.) are never global and only refer to a singular...
One objection that I have often heard raised against Python that it is difficult to synchronize a team of many programmers on large Python project. Note: that synchronization is possible in such a project does not necessarily entail that it is practical, cheap or easy. There's still n*(n-1) communication channels betwe...
The app I'm developing needs to display lists of items. Simple enough, but there are a number of things which can change based on user input: Items can be added to/removed from the list. The items in the list can be updated. Multiple items can be updated simultaneously! The filters can be updated. Multiple filters can...
I'm reading Accelerated C++ and in Chapter 4 they bring up the concept of lvalues. There's an example of something that shouldn't work, but after trying it myself I found that it does indeed work. Specifically they state that, given these functions: // return an empty vector vector<double> emptyvec() { vector<double>...