instruction
stringlengths
34
19.9k
I was just experimenting with the Chain of responsibility design pattern, implementing my own version. I'm currently reading Design Patterns, but I'm not really sure whether DP tells to stop the forwarding of the requests when a single action is accomplished, or just continuing to the end of the chain. What I'm intere...
I'm writing documentation for some software that I wrote. Specifically, I'm writing a guide to installing the software. I'm delivering the source-code to my client, so I expect that they will want to be able to build from source. I explain to open the solution in Visual Studio 2010 and to right-click on the project a...
Does the web industry have any standard or common name that refers specifically to web applications that don't use the conventional window-HTTP-navigation model, instead relying on mostly or wholly on DOM manipulation? These applications usually have the following attributes: load an application frame from the server ...
So, I've got an interesting design problem and I honestly don't know how to tackle this. I have an application that will be ran on a dozen of workstations. Of those workstations, it is impossible to know at any given time how many of them will be on or using my application. Every 4 hours of local time if any of the ...
I have a data structure that describes a tree. Nodes are ordered, with "depth" information, and knowing the order and the depth the tree can be reconstructed. I'm not entirely sure how to describe it so I'm hoping this small example will illustrate it node #1, depth 0 // parent: none node #2, depth 1 // parent: #1 node...
I have read that story point estimation is not intended to actually tie with number of hours , but is used to identify the relative capacity. I have a java application which has a adapter layer , a service implementation layer , a DAO layer and an external connector service layer. If I am given a high level requirement...
I'm new to objective C, I'm following "Objective C 5th Edition Stephen Kochan and I don't have anyone to ask my doubts to. I'm confused with this question: Q. Is it necessary to use "-" or "+" before every property or method declaration in Interface? What will happen if I don't use "-" or "+" before every property or m...
I'm interested in developing a large-scale user-facing website that is written in Java. As for design, I'm thinking of developing independent, modular services that can act as data providers to my main web application. As for writing these modular services (data providers), I can leverage an existing framework like Sp...
I've recently started two introductory level courses - one using Python, the other Java. I've read the answers to this Question but still have difficulty understanding how each ends up with machine code and what the main differences between the two models are: Is an interpreter doing the same job as something like the...
I am working on a fairly large open source project (Drupal) and the next major version will begin to use UUIDs for a lot of things, including configuration objects. If we put UUIDs into the configuration we ship with and then various sites change their configuration then there will be many, many objects in the wild wit...
In my project we assign 4 hours for 1 story point and estimate based on story point. So in this case one ideal day of work will be done in 2 elapsed days. From an agile standpoint are we doing story point estimation or ideal days estimation or none of these?
Why does: something = false always return false? Since it is an assignment and not a comparison, it seems it would make more sense to return the result (success/failure) of the assignment (like pretty much every other assignment you do). EDIT - this is wrong, as the answers below point out. My bad. Slight brain fart. ...
I am designing a language, and wondering which character (or string) to use to represent that something is an attribute of something else. In all languages I have used, this is done with a dot - my_class_instance.attribute. However, in this language, I want to have what would usually be methods as syntactic sugar for n...
I presently have a clock app that calculates from scratch at every iteration. This means O(1) corrupt bits in my doubles and heavy object creation and deletion as well. I am wary of running indefinite calculations with doubles or any other floats because O(n) corrupt bits normally accompany every step. I would like to ...
I am currently employed as a software developer using C# and C++. However, I want to find a new job for personal reasons and applied for a job ad that listed PHP, CSS, and Javascript as the skills the company is looking for. I am interested in learning about PHP, CSS, Javascript. That company wants to interview me. How...
Since this statement is so common: while (true) (Java) or while (1) (C) or sometimes for (;;) Why is there not a single instruction for this? I could think that an instruction that could do it is just do but do requires a while at the end of the block but it would be more logical to write an infinite loop like this do ...
I've just looked for a formal definition and haven't found one. The term - "bug in the requirements" was always confusing for me, what does mean exactly?
When I think of pretty much any programming language - like C, C++, PHP, SQL, JavaScript, Python, ActionScript, Haskell, Lua, Lisp, Java, etc - I'm like awesome I would love to develop a computer application using any of those languages. But when I think of web frameworks(I do mostly PHP) - like Cake, CI, Symfony, Lara...
Just as in the title, why doesn't git daemon start the service in the background, since it's a "daemon", being a background process? I know that I can start it in the background using git daemon &, but I'm just wondering about the philosophical reason for this decision.
I'm delving into multi-threaded programming with Java, but I'm finding it hard to test my program for bugs. My computer simply has too many resources and cores, making it hard to see how my program acts under stress. Is there any way to limit the resources available to my program? It seems ridiculous that my only opti...
I found by Valgring that some GTK+ programs leaks memory. How important it is to fix those leaks? I mean, often those programs works very well but on the other hand, one can never be sure if one wants to copy part of the leaking code to some other program. And I'm not sure if the idea of GTK+-programs is to work fast a...
What are some best practices for using functions to break up large blocks of code into discrete chunks of logic when those functions are only ever going to be used once within the lifetime of a function? The canonical example for web development is the initialization of a home page. When the page loads, you might do s...
I am designing a bit of software that will integrate with our enterprise system using web services. We are dealing with work orders that are needed to maintain equipment. We have a bit of a disagreement in regards to the structure of the contract. There are two methods on my side, I would like a single work order clas...
From my experiences in software development (Eg. Waterfall ) I see it that most of the times it is the development team that sweats it out with the BA folk to get requirement clarity. The development folks then slog it out to meet deliverable deadlines. Where is the QA - they might be free - but will only hitch onto t...
This is a theoretical question, but after many years of programming in what I now realize is "normal" imperative technique, using C++ mainly, I've discovered this other world of functional programming, which I stumbled upon accidentally while casually learning JavaScript. This has led me to wonder if you could technica...
We are considering using the Dynamic.CS linq-sample included in the "Samples" directory of visual studio 2008 for our WebAPI project to allow clients to query our data. The interface would be something like this (In addition to the normal GET-methods): public HttpResponseMessage List(string filter = null); The plan i...
I'm wondering, why would one (consider it not just a single developer, but a company) prefer C# or Java for web applications? What's their considerations regarding the question. I mean, a company, has an assignment to make a web-site for customer, or online game, or web-portal, how does the project management or/and th...
I'm writing a system that has a number of objects with data in them. For example one object has a user name attribute, another has a date, another shopping cart item etc. I'm making an object that generates a MD5 hash based on a concatenated string of these values. So for example md5(username + date + special_number +...
By default, the installer for my product copies files to the Users\Username\AppData\local\MyProduct directory (though the user can change this during installation, of course). I want to bundle some other files with product - documentation, sample spreadsheets (it includes an Excel add-in) etc. It doesn't seem approp...
I have a sequence of binary strings that I want to find a match for among a set of longer sequences of binary strings. A match means that the compared sequence gives the lowest average Hamming distance when all elements in the shorter sequence have been matched against a sequence in one of the longer sets. Let me try t...
Can I bundle my proprietary JavaScript code with MIT licensed libraries (e.g. JQuery, AngularJS) into the same file, distribute it via HTTP but disallow my users to use my own code as an MIT licensed code? This way I could minimize the number of browser requests, and reduce errors due to network errors. I don't want to...
Preamble: I am making a simple board game in C++, in which AI characters move around squares on the board. There are different types of squares, each inherited from an abstract class, each with different effects on the AI character. For example, some are shops where the character can buy stuff, others are workplaces wh...
I have a static Jekyll website. The website is constructed once, on my computer, and then sent to the server in the form of plain HTML, image, and CSS files, to be served by a regular HTTP server. This construction process involves a template engine that has to glue various components together. For example, this is the...
My background is Ruby, C#, JavaScript and Java. And now I'm learning Clojure. What makes me feel uncomfortable about the later is that idiomatic Clojure seems to neglect the Uniform access principle (wiki, c2) and thus to a certain degree encapsulation as well by suggesting to use maps instead of some sort of "structur...
Let's say 3-5 years ago (more or less) n-tier application on the server side - and some javascript/html/CSS for the UI was a basic approach for web development. Nowadays we can see that traditional web development paradigm changes a lot. Each day I saw more and more application who do not have server side in traditiona...
We have a single-page web application, and we have a new SSO site (also our own) using OAuth2, and are looking to hook them up. On our production/staging/CI deployments, it's easy to hook everything up. For instance: on production we'll have https://app.company.com access our prod backend point to https://sso.company....
Whenever I come across a new API or programming language or even simple Linux man pages, I always (ever since I remember) avoided them and instead lazily relied on examples for gaining understanding of new concepts. Subconsciously, I avoid documentation/APIs whenever it is not straightforward or cryptic or just plain ...
Is it legal to use a third party library in a software project that is itself licensed under MPL 2.0? So some potential project hierarchies would look like this Library Project [MPL 2.0] (Open Source, Distributed) Third party library [Proprietary] (Closed source, not distributed) Someone else's project [MPL 2.0] ...
Me and my team use feature branches (with git). I'm wondering which is the best strategy for code review before merge to master. I checkout a new branch from master, lets call it fb_#1 I commit a few times and than want to merge it back to master Before I merge someone is supposed to make a code review Now there are ...
I am the Director of a small startup organisation. We currently have two programmers (one experienced, one less experienced) who are building a web application platform. One of the greatest challenges so far is the planning process. The programmers usually are in charge of planning their own work, but we keep exceeding...
One of the things you see in numerous places in the standard java library is final classes. It is claimed that this is for immutability which I understand...to an extent. Suppose you have a class: final public class ImmutableTest { private String value; public ImmutableTest(String value) { this.value = ...
I'm designing a REST API for a three-tier system like: Client application -> Front-end API cloud server -> user's home API server (Home). Home is a home device, and is supposed to maintain connection to Front-end via Websocket or a long poll (this is the first place where we're violating REST. It gets even worse later ...
I and my co-worker are developing a web application with rails and node.js and we can't reach a consensus regarding a particular architectural decision. Our setup is basically a rails server working with node.js and redis, when a client makes a http request to our rails API in some cases our rails application posts the...
I have seen animation, and i can't figure out how to do something like in this video(youtube). I want to discuss how it's made. I don't think that they're using sprites. I have one idea how to do this: for example i want to create animation of "walking" animal (when animal moves, he's legs "runs" moving animation), i s...
I am aware that for the general case, the answer to "should I throw an exception from a property" is "generally don't, but in some special circumstances it is OK to do so". There is a Microsoft guideline which gives this general answer, and also a question on this site. Now I am faced with a situation which I think ma...
I've been working on a utility app for a while, and when we're in the final phases the boss is asking for adding user behavior and location tracking and was explicit about publishing them to 3rd party developers to make use of them. He seems to have set his mind about it, is there anything I can/should do about it? Cla...
I am trying to figure out what is the best way to setup a FSM and also keep my interfaces clean and use an IOC container to use DI. Let's just visit the Head First design pattern textbook example of the gumball machine. interface IState { InsertQuarter(); EjectQuarter(); TurnCrank(); Dispense(); } Is t...
Please tell me if this is mad, but basically, I've created a custom rake task, and before it does its thing, it gives the user a warning message: Warning, please back up your database before continuing Just in case something does go wrong. But I thought this would be awesome: Warning, please back up your database befo...
The end goal is to have a variety of data sets that can all be graphically plotted against eachother. All data should correspond to a date, so that when plotted against each other, they show the correct relationship through time. The key feature though, is to be able to add a new parameter to log at any time which will...
I titled the question jokingly because I'm sure that "it depends," but I have some specific questions. Working in software that has many deep layers of dependency, my team has become accustomed using mocking fairly extensively to separate each code module from the dependencies beneath it. Therefore I was surprised that...
We process messages through a variety of services (one message will touch probably 9 services before it's done, each doing a specific IO-related function). Right now we have a combination of the worst-case (XML data contract serialization) and best-case (in-memory MSMQ) for performance. The nature of the message means...
I just assumed tech lead for a project which has had a problem with its very part-time (maybe 2-5 hours / week) contractors: submitting code that brings down the production app, pull requests that cannot be auto-merged, writing misnamed tests that don't actually test what they claim, and not writing tests for the ...
On a code review, I've stumbled on an interesting idea, which I can't properly judge alone. Is it OK to improve readability of code by means of not widely known language syntax? When the original writer didn't use a special syntax designated for solving a specific coding problem, and solved it by simulating with workar...
I am currently developing an Ajax chat application that uses PHP on the back-end. Some of the features it has right now are different types of users (admin/mod/banned), public and private rooms, commands, and announcements. I recently learned about unit/integration testing and it sounds like a good alternative to manua...
I have an old habit of avoiding calling references multiple times, both for easier to read/maintain code, and for possible efficiency. But I'm wondering which is more efficient (memory, performance, both?). For example when working with XML using a VTD parser if( vn.toString( vn.getCurrentIndex() ).equalsIgnoreCase( "...
I have a web app that occasionally (after some idleness) will block a very simple request for small chunks of data (30~50 kb) up to 20 or so seconds. Assuming I can't refactor or modify the API, is there some pattern in javascript or jquery to accommodate a situation like this? I'm thinking to set a timeout for 5 secon...
I'm employed at a mobile app development company since 4 months as Android developer. Currently I'm using my two private Android devices for development. Is it common practice that developers use their own hardware devices for development in mobile development companies, or should I ask for company devices?
I am in the process of structuring a small program to perform some hydraulic analysis of pipe flow. As I am envisioning this, the program will read an input file, store the input parameters in a suitable way, operate on them and finally output results. I am struggling with how to structure the input file in a sane way;...
Problem In Codeigniter (PHP framework), I am trying to create a helper function that will inject an ActiveRecord (for MySQL) command into a chain of existing ActiveRecord calls. The reasoning for this is that the current ActiveRecord commands available are not reliable enough, and produce differing results depending on...
I am currently learning about delegate and the Law of Demeter. I understand the Law of Demeter, but I can't seem to find a good example of where using delegate to avoid breaking the law would actually even be useful. I want to find an example related to my project, since I have to give a presentation. The only line of ...
I'm very new to programming and I'm using Java. I got interested to learn programming because I want to create games. I love playing computer games and I know that game developers make money. I told myself that instead of just playing why not create my own game and probably make some money. I read some articles about g...
I am a newbie, studying programming and I came across this question today: How can I make sure that I'm actually learning how to program rather than simply learning the details of a language? A commenter, ChaosPandion, had asked the question if the programmer thinks in syntax or in a faster mental model. I, while writ...
I read much about GPL license. But it couldn't clear my doubt. I want to develop a small web application using ExtJs because of its features. I won't use much of it. But some features are very good. Now, as my understanding I think I can give this app to my friend for free for his business needs, right? Or should I ta...
[Warning]: I am new to the whole unit testing and have been trying to learn as much as possible. I am working on a MS CRM 2011 project and I have been trying to introduce unit testing in my company. For unit testing JavaScript web resources, I found this link at MSDN blog. The Solutions Architect in my company suggest ...
With normal form submission I use the pattern Post / Redirect / Get, when processing the forms. I have a database application built with Django. I want to allow the users to select a number of items from the database, then launch a computationally intensive task based on those items. I expect the task to take between...
Suppose you have two interfaces: interface Readable { public void read(); } interface Writable { public void write(); } In some cases the implementing objects can only support one of these but in a lot of cases the implementations will support both interfaces. The people who use the interfaces will have to do...
Is an automation tester supposed to know concepts of OOPS and design patterns to write Tests in a way where changes & code re-use are possible? For example, I pick up Java to write cucumber step definitions that instruct a selenium webdriver. Should I be using a lot of inheritance, interfaces, delegation etc. to make l...
This is a bit of an open ended question but I wanted some opinions, as I grew up in a world where inline SQL scripts were the norm, then we were all made very aware of SQL injection based issues, and how fragile the sql was when doing string manipulations all over the place. Then came the dawn of the ORM where you were...
I'm planning to map some of my TFS projects to two different directories as discussed here. I'll be using two different workspaces, both with the same Computer and the same Owner. Is there any reason why this would be a bad idea? Are there any complications with merging or locks that one user with two mappings would ...
So here's a typical workflow on Github... Like some project -> fork it -> git clone https://github.com/you/someproject. Open project. Like what you see, but make some changes. Having been careful to work only in a feature-branch (git checkout -b some-feature), you decide to make a pull request with the upstream ma...
I'm looking for an umbrella term for all the nitty-gritty requirements that it's helpful to have specified up front but which the client never thinks about in his excitement about the product. In the client's mind, they think of the headline requirements, the main user stories such as "I need to be able to view the sta...
Watching a CEO for a new "cloud computing" company describe his company on a finance TV program today, he said something like "Cloud computing is superior to old-fashioned client-server computing". Now I'm confused. Can someone please explain what "cloud computing" means in contrast to client-server? As far as I under...
Generally whenever we're programming in any Programming language, say C, we would pass the parameters we need to pass to a function using the parentheses next to the name of the function. Whereas in jQuery, other than the user defined function() we write the action we need the function to perform inside the parentheses...
I started working at a company that is primarily C# oriented. We have a few people who like Java and JRuby, but a majority of programmers here like C#. I was hired because I have a lot of experience building web applications and because I lean towards newer technologies like JRuby on Rails or nodejs. I have recently st...
At my company, all of our development (bug fixes and new features) is done on separate branches. When it's complete, we send it off to QA who tests it on that branch, and when they give us the green light, we merge it into our main branch. This could take anywhere between a day and a year. If we try to squeeze any refa...
When I created my first web application few years ago, I remember trying to use the designer in VS 2008. Before I can even remember I abandoned it to the favor of actual debug to understand how my UI will actually look like. Since then, I gave it few more shoots but I was never convinced that it's even possible to buil...
My doubt arises from this sentence in the gifmerge distribution conditions: "This software may be freely copied, modified and redistributed without fee provided that this copyright notice is preserved intact on all copies and modified copies." Especially the "without fee" part is the one thet puzzle me. Can some expert...
I'm under the impression, and I agree with it, that it's bad to create a web application requiring JavaScript to function properly. What if one were to create a single page application? Is it possible to create one that doesn't rely on JavaScript, without being difficult, or full of "hacks"?
I'm a Rails developer doing TDD on a Mac with RSpec, Capybara and Selenium webdriver. Now I have been asked by my company to use this approach for a .NET on Windows environment. What is the best way of doing this? I could just install Ruby and use RSPEC, Capybara and Selenium webdriver for integration testing. But what...
Current field-of-use restrictions defined in "Oracle Binary Code License Agreement for the Java SE Platform Products" prohibit its use in embedded systems. "General Purpose Desktop Computers and Servers" means computers, including desktop and laptop computers, or servers, used for general computing functions under end...
I am reading a book called Rails AntiPatterns and they talk about using delegation to to avoid breaking the Law of Demeter. Here is their prime example: They believe that calling something like this in the controller is bad (and I agree) @street = @invoice.customer.address.street Their proposed solution is to do the f...
I have a task that involves talking to a .NET-based API (namely AutoCAD) to retrieve data, send commands, and react to events. I want to separate the API operations and the proper program logic (largely already implemented in Python) by using natural tools for both: a C# DLL for the former and a Python app for the latt...
I wonder if I should close any unnecessary database connection inside of my PHP scripts. I am aware of the fact that database connections are closed implicitly when the block stops executing and 'manually' closing the connections could kinda bloat the codebase with unnecessary code. But shouldn't I do so in order to ma...
I am fairly new in product development and I am trying to work over a product. The problem that I have realized is that people draw diagrams and charts showing different modules and layers. But as I am working alone (I am my own team) I got a bit confused about the interaction I am facing in the development within the ...
I have the following tables in my database: Configuration Table: ====================================== Start_Range | End Range | Config_id 10 | 15 | 1 ====================================== Available_UserIDs ========================== ID | UserID | Used_YN | 1 | 10 | t | 1 | 11...
I'm using an SPI host adapter for a project. The Aardvark from TotalPhase. And I did something crazy, I read that EULA license that everyone just clicks through. The driver installation license includes these bits: This driver installer package also includes a WIN32 driver that is entirely based on the libusb-win32 pr...
I am researching alternatives to database-level pessimistic locking to achieve transaction isolation in a cluster of Java applications going against the same database. Synchronizing concurrent access in the application tier is clearly not a solution in the present configuration because the same database transaction ca...
I'm curious if there's a series of tendencies or anti-patterns when programming whereby a developer will always locally re-wrap external dependencies when consuming them. A slightly less vague example might be say when consuming an implementation of an interface or abstract, and mapping every touch-point locally before...
I am asking this question in continuation with http-session-or-database-approach. I am planning to follow this approach. When user add product to cart, create a Cart Model, add items to cart and save to DB. Convert Cart model to cart data and save it to HTTP session. Any update/ edit update underlying cart in DB and u...
I am reading a book called Rails AntiPatterns and they talk about using delegation to to avoid breaking the Law of Demeter. Here is their prime example: They believe that calling something like this in the controller is bad (and I agree) @street = @invoice.customer.address.street Their proposed solution is to do the f...
I am reading a book called Rails AntiPatterns and they talk about using delegation to to avoid breaking the Law of Demeter. Here is their prime example: They believe that calling something like this in the controller is bad (and I agree) @street = @invoice.customer.address.street Their proposed solution is to do the f...
On my dev team, we're doing code reviews, however not in a proper way i believe. The issues our process suffers from: Not enough time is allocated for proper code review. Doing reviews is not mandatory - many times it is simply not done. Devs sit together for reviews, due to lack of another easy mechanism for doing it...
I'm trying to refactor some code such that the display is separate from the implementation, and I'm not sure where to put the existing enums. My project is currently structured as follows: Utilities RemoteData (Depends on: Utilities) LocalData (Depends on: RemoteData, Utilities) RemoteWeb (Depends on: RemoteData, Uti...
I want to create a immutable Scale class in C#. public sealed class Scale { string _Name; string _Description; SomeOrderedCollection _ScaleValueDefinitions; Unit _Unit // properties .... // methods ContainsValue(double value) .... // constructors // all parameters except sc...
My java code is just like below: public void check()throws MissingParamException{ ...... } public static void main(){ PrintWriter out = response.getWriter(); try { check(); } catch (MissingParamException e) { // TODO Auto-generated catch block out.println("message:"+e.getMessage...
I wonder if I should write a database class for my application, and if so, how to accomplish it? Over there on SO, a guy mentioned it should be written as an abstract class. However, I can't understand why this would be a benefit. Do I understand correctly, that if I would write an abstract class, every other class tha...
Are there established models for releasing an initially proprietary piece of software under FLOSS conditions after a defined period or a certain point of time? The main problem here is that all parties involved must be able to trust that the Open Source licensing will actually take place at the defined time and no par...
I'm currently trying to figure out the best techniques for organizing GUI view hierarchies, that is dividing a window into several panels which are in turn divided into other components. I've given a look to the Composite Design Pattern, but I don't know if I can find better alternatives, so I'd appreciate to know if u...
for a lot of quick tasks where one could employ a function f(x,y), in plain C, macros are used. I would like to ask specifically about these cases, that are solvable by a function call (i.e. macros used for inlining functions, not for code expansion of arbitrary code). Typically C functions are not inlined since they m...
I come from a Java background and I have been working with PHP for almost a year now. I have worked with WordPress, Zend and currently I'm using CakePHP. I was going through Cake's lib and I couldn't help notice that Cake goes a long way avoiding the "private" access specifier. Cake says Try to avoid private methods ...