instruction
stringlengths
34
19.9k
Is it a good practice to use reflection if greatly reduces the quantity of boilerplate code? Basically there is a trade-off between performance and maybe readability on one side and abstraction/automation/reduction of boilerplate code on the other side. Edit: Here is an example of a recommended use of reflection. To g...
First of all I'm not asking for legal advice but just checking if anyone agrees with my suspicions. That might help in convincing Sencha to change their license. Their commercial license says: The Open Source version of the Software (“GPL Version”) is licensed under the terms of the GNU General Public License versions...
I have some classes that are composed with ORM generated Models. example1: For example the Report.php (Model) is using a Document.php Model generated with ORM. Based on the document object a report is created. I would like to know some name suggestions for the Report.php folder path. It clearly belongs to the /Model fo...
Hopefully, this question is not too open-ended... I have been tasked with taking a 3 year old application (.NET 4.0, WPF, WCF, EF 4, SQL 2008) that was designed for a very specific market X and "re-purposing" it for a another very specific market Y. To further complicate things, the company has also mentioned a third m...
I am a software engineer for 4 years, and I just changed my company for the first time. Company works with pair programming, and it's been 3 days, I couldn't even write a single line of code. It's so frustrating for me because I was very productive at my previous company. The codebase is large, they are using 5-6 langu...
I am considering using sourceforge, bitbucket or github for managing source control for my business. I have open projects and I participate in open projects such as gcc. But I also have a business where I develop closed-source software for my living. How trustworthy are sourceforge, github or bitbucket in terms of ke...
I have forked a project that was released under the GPL and made substantial modifications, however there are still some parts and general ideas that are the same as upstream. Due to user interest I am wondering how, if at all, I can relicense the project. Another developer and I have attempted to reach the upstream d...
We are writing a system with a sort of quasi-MVC structure (it was never stated as that, but that's what it is). I'm building up a full knowledge of the system and the controller will have to make calls to me to update it; they system itself is something similar to a graph. We need to have a sense of a path between mu...
We have been using Hosted SVN + Fogbugz for our source control and task/issue tracking. Our developers are very comfortable with SVN and we are hesitant to switch source control (e.g. TFS) providers at this point. However, Management extensively uses Microsoft Project for project management and are considering setting ...
Adap.TV has chosen C++ to develop their software. However, they've decided not to use the standard containers1 and boost for performance reasons, as they've blogged about it in the following article: Why we use C++ (without using STL or boost) It says (emphasis mine), There are several rules that we are obeying in o...
I recently started working for a company that has me making mockups for an app they'd like to see converted to an iPhone app. I have not been informed as to how all the boards fit together, but I do have a general idea on what they should look like. I would like to write notes or comments on each individual board about...
I asked a question on StackOverflow in November about separating a very large application into layers and tiers: https://stackoverflow.com/questions/13342626/net-divorcing-layers. The previous developer included data logic and business logic in the business logic layer My question is about the tiers element. I resear...
I'm kinda having a debate here with my friend, whether it's OK to have a development language before putting the idea into C++. When I say development language I mean a language to try ideas out before putting them into the compiled language, in this case C++. My friend thinks it's unnecessary (and maybe a waste of tim...
It seems to be easier to use and more feature rich than standard swing layouts. It looks like a do it all replacement for all standard layouts. If you are making simple code to just show the time in a window, then MigLayout is probably not useful. But, if you are making a flight cockpit panel, then MigLayout might be t...
We have an MVC4 application that we would also need to distribute as a standalone (no network connectivity) desktop application. Rather than rebuild the HTML/JS front-end we would like to reuse that so in essence we're distributing a self-hosted HTML-view-based .NET MVC application. What we roughly envision is: MVC4 .N...
My design doesn't allow me to mock the data so I am using sqlite as test database that has minimum data to run the unit tests. Below is the pseudo code //Method to be tested public IList<Funds> GetFunds() { List<Funds> objFundsList = //gets two records from sqlite db; return objFundsList; } //Test Method publ...
I work on a C++ project that generates bajillions of warnings. Most of the warnings appeared after the code was written: Initially the project used Visual C++ 8, soon switching to 9, but there is little difference in the generated warnings. Warnings were either fixed or silenced, so there were no warnings then. Then a...
I have many sublcasses of one class. I choose concrete class based on type (simple enum). I like idea of class cluster. Should i use it or just create factory class (but each class in objective-c is actually a factory)? What is the difference between factory pattern and class cluster pattern. When to use it in your cod...
What are the major differences in between Java version in terms of software development? Where can one find a summary of the most important changes related to programming? The Release Notes such as http://www.oracle.com/technetwork/java/javase/releasenotes-136954.html can be hard to read. For example there is new code...
Every competent Java programmer knows that you need to use String.equals() to compare a string, rather than == because == checks for reference equality. When I'm dealing with strings, most of the time I'm checking for value equality rather than reference equality. It seems to me that it would be more intuitive if the l...
I have a project where the customer requirement specifies a report and contains mathematical equations for the contents of some of the columns on that report. One of the columns on this report is a running total which starts at a opening value, and which 'should' remain at that opening value all the way down the report...
In an Agile development process usually the main focus is on User stories, but sometimes a single requirement may span several user stories. For example, the client may request a search page for all users in a forum, and there are several actions that can occur on each user such as ban user, delete user, reset Password...
I want to use an ORM with a legacy database, but I don't want to expose some of the underlying data types. For example, some of the columns are nullable doubles or floats and I want my domain model to use non nullable decimals. It seems to be impossible to have Entity Framework automagically cast between these types, a...
I'm building a REST api where clients are authenticated using client certificates. A client in this case is not an individual user, but some sort of a presentation layer. Users are authenticated using a custom approach and it's the responsibility of the presentation layer to see that this is properly done (note: I know...
I'm a freelance programmer and recently I finished a website, it all works fine but there was one user that complained to my client that he couldn't log in. This problem was clearly a cookie-restriction/old browser one (I couldn't create the problem myself and hunderds of users are working with the website just fine) N...
I have a web application that I have been developing for a small group within my company over the past few years, using Pipeline Pilot (plus jQuery and Python scripting) for web development and back-end computation, and Oracle 10g for my RDBMS. Users upload experimental genomic data, which is parsed into a database, an...
I'm heading a new team of developers working on a software project that makes use of continuous integration (circleci) w/ a pretty fleshed out suite of busterjs unit/integration/acceptance tests. Our project is primarily written w/ coffeescript, and I try to make use of coffeescript-linter to ensure everyone working ou...
I was reading this article: A Critique of Common Lisp and finding it hard to make out the precise definition of "stock-hardware machine" and its difference with "micro-coded" machines. I tried to search for a precise definition of the former to no avail. What I currently construe stock-hardware machine to be is that, i...
I'm having some difficulty to evaluate the revision of a software: the software was paid by customer years ago, never used, and now the customer have noticed that it doesn't work as expected. Now this customer asked me to evaluate the project (I have the sources), and I should give an estimation of the time to fix it a...
Reading about ARM architecture I found many similarities to PDP-11 architecture which did not exist between ARM and x86. For example, General-purpose registers named Rx compared to AX, BX,... for x86 Uniform registry file (all registers permit all kinds of operations) Similar names for program counter (PC both on AR...
A LAMP project I am currently working on is pretty well organized on the backend. However, there are a ton of pages that just have a diarrhea of javascript and html squirted all over numerous locations with little discernible architecture, rhyme, or reason. In a few cases, some kind of javascript prototype was created ...
I am interested in hearing some guidelines as to what feedback is or is not appropriate for a code review. My team has a very unstructured review process and I am trying to suggest some ways to improve it. I am no expert so I hope to hear from you experts out there! Should code review comments be limited to actual p...
As the number of bugs in a codebase increases, that number not only decreases the quality of the code, it also affects the mindset of the developers. Developer self-confidence falls when things are not going well. If self-confidence is not right, things more easily become a mess. How do you guys keep your self confi...
I have a graph with about a billion vertices, each of which is connected to about 100 other vertices at random. I want to find the length of the shortest path between two points. I don't care about the actual path used. Notes: Sometimes edges will be severed or added. This happens about 500 times less often than looku...
I am new to image processing using Python. Now I am learning OpenCV and the mahotas module in Python. Many functions in these modules are related to watershed of an image. I don't know what watershed means for an image. Here is an example from the OpenCV documentation: http://docs.opencv.org/search.html?q=watershed...
I'm looking for a C function library, which would contain a collection of simple and plain utility functions "missing" from C or POSIX standards. I found this earlier question, but answers there list only full frameworks or libraries designed to replace/duplicate standard libraries instead of seamlessly fill the gaps. ...
Let's say we have 4 classes A, B, C, D where: A is a superclass of both B and C and C is a superclass of D. I suppose, in a diagram, it should look like this: A / \ B C \ D Moreover, the class A implements the interface Comparable<A> and also implements a method public int compareTo(A a...
The context We're building a web application using Entity Framework 5.0. One of the requirements is that it should be possible for the administrators to link related products so that when someone browses to a product we can render a list "You might also like these products:". Since a product can be linked to many produ...
If i have two systems (A and B) running on LAN(INTRANET) which are directly connected. There are no routers in the middle. In this case, if system A sends a few UDP packets every few milliseconds to system B: Is it possible that system B receives the packets in a different order? Please note that I'm not asking whe...
I am creating an advanced search page where there are about 20 search fields for a user to filter their search. My question deals with the query string, Is it standard web development practice to have say 20 parameters in a querystring? The search results display large tables of data. Is there an alternative that stil...
I'm working on a new common .NET software design (mainly) for WCF-based web service applications with related client frontends (all written in C#). As far I've chosen some frameworks (NUnit,Autofac/Castle Windsor) as basis for the application. Now I'm doing some research concerning db abstraction. I'm considering NHibe...
First of all, I'm not really a Javascript guy, but more towards PHP. However, I want to move to the next level, that is taking load off the server and let the client do the processing. Hopefully to be a more JS guy. My first thought is to request of data off the server, and it just returns key-values which the client w...
I'm still restructuring the code I have been given to update on my current work project, and I've come to the point where I'm looking at how the code handles an 'exceptional' input, that doesn't conform to the business logic. In essence, the code stitches together various different excel spreadsheets, tarts them up and...
I'm working on a project that processes requests, and there are two components to the request: the command and the parameters. The handler for each command is very simple (< 10 lines, often < 5). There are at least 20 commands, and likely will have more than 50. I've come up with a couple of solutions: one big switch/...
I am writing a node.js application which I am breaking down into modules, the issue is I am not sure how to organise my code in an idiomatic Javascript way. Currently each of my modules exposes a set of functions that are intended to be called directly. All state is modified by the module with the gameId being the firs...
One of my teammates is a jack of all trades in our IT shop and I respect his insight. However, sometimes he reviews my code (he's second in command to our team leader, so that's expected) without a heads up. So sometimes he reviews my changes before they complete the end goal and makes changes right away... and has eve...
Consider the following scenario. You currently have a feature set A you wish to extend to include feature set B. In the near feature there's a high possibility that you wish to extend this even further to include feature set C. Option 1) Cost to extend A -> B is minimal, but high maintenance costs. Option 2) Cost to r...
We have sprints of 4 weeks duration. What I have been doing is 3 weeks dev time and 1 week of pure manual/automated testing, stabilization and shipment assurance testing. How to manage TDD within dev time? In my previous experience writing tests and getting 80% coverage requires round about 50% of the development time...
We have a URL in the following format /instance/{instanceType}/{instanceId} You can call it with the standard HTTP methods: POST, GET, DELETE, PUT. However, there are a few more actions that we take on it such as "Save as draft" or "Curate" We thought we could just use custom HTTP methods like: DRAFT, VALIDATE, CURAT...
Can someone please explain the best way to solve this problem. Suppose I have three classes Person Venue Vehicle I have a DAO method that needs to return some or all of these attributes from each of the classes after doing a query. Please note, by requirements I am using one DAO for all three classes and no framework...
I am currently working on a project that has client applications communicating with a server process. The client applications could be local to the same machine as the server process, on the same network, or over the internet. I had written a single-threaded asynchronous RPC module for the server process using Boost AS...
Suppose I have a form in my web application where users can upload a profile picture. I've got few requirements about file size, dimensions etc, but when the user uploads the image, how should I name them on my system? I suppose it would need to be consistent and also unique. Maybe a GUID? a5c627bedc3c44b7ae7c06a44fb3f...
I started developing websites using PHP. I have read many times that PHP is free and open source which is an advantage over ASP.net. However, due to my current job requirements, I had to switch to ASP.net which is pretty good. Now after developing few applications, I am wondering how can I publish them for free. As P...
Long story short, I'm working on a web-based frontend that interacts with a database, and one of the functions is that every action on a particular table gets logged to keep a full history of all changes to that table. An earlier attempt at using triggers in postgreSQL to handle the logging automatically ran afoul of ...
Why do books say, "the compiler allocates space for variables in memory". Isn't it the executable which does that? I mean, for example, if I write the following program, #include <iostream> using namespace std; int main() { int foo; return 0; } and compile it, and get an executable (let it be program.exe), no...
So I develop an app that is for both Android and iOS. From time to time changes occur when working on one version that need to implemented on the other. I find it tedious to keep track of these changes so I don't forget them later. I'm just curious as to what other workflows you guys use when managing a single feature ...
In most of the projects at work it will eventually show up a package, a class (or multiple packages and classes) named "Utils", where every kind of function is dumped into. It becomes excruciating harder and harder to navigate the project without a properly named structure. I have tried to ask to stop using "Utils". ...
I am the maintainer of a project which has a large non-technical userbase. I've been maintaining it for about 4 years now and adding new features as they've been requested. I'd like to move on to other projects now and stop developing for this application. Because of the non-technical nature of the users, there have be...
I spent couple of months learning Scala and got overwhelmed by number of different constructs it had, After looking at partial functions, partially-applied functions, pattern matching, actor syntax, I gave a thought to learning Clojure which doesn't have too much in terms of syntax but looking at the how Java inter-op...
for ( i = 1 ; i <= N ; i++ ) { for ( j = 0 ; j < i ; j++ ) { if ( arr[j] > arr[i] ) { temp = arr[j] ; arr[j] = arr[i] ; for ( k = i ; k > j ; k-- ) arr[k] = arr[k - 1] ; arr[k + 1] = temp ; } } } Source: http://programminggeeks.com/c-code-for-insertion-sort/ If not, ...
I'm currently working on a project which will have client applications (desktop & android & web) communicate with varies processes running on a server(s). My question is how much should I be thinking about load balancing and the like? All projects which I have worked on before consisted of creating applications for int...
I am discovering web services to implement in my ASP.Net website. I visited many sites about Why use webservices and read many articles and found out that web services are good when you have something that is used frequently without loading your page. I want to know some other example scenarios where web services are ...
Being new to node js magic world, i'm wondering how does a web application's setup look like on a real production server? So far all tutorials, create the js file that is started from a console...and that's it. Anyone has created a real world web app that uses node js in the back end? Can you please describe how is it ...
Are developers actually likely to receive significant help by open sourcing a work in its unfinished stages, or are open source consumers more likely to want something ready to use? This is frequently cited as a benefit of open source, but I haven't been able to find evidence of it outside of already established produc...
I need some clarifications on the responsibilities of the Build Script and the Build Server. I read several articles on the Net about continuous integration and builds. Including The F5 Key Is Not a Build Process The Build Server: Your Project's Heart Monitor Daily Builds Are Your Friend And I had a conversation with...
So we have an interface like so /// <summary> /// Interface for classes capable of creating foos /// </summary> public interface ICreatesFoo { /// <summary> /// Creates foos /// </summary> void Create(Foo foo); /// <summary> /// Does Bar stuff /// </summary> void Bar(); } Recently, we played a document...
Working in immutable data with single assignments has the obvious effect of requiring more memory, one would presume, because you're constantly creating new values (though compilers under the covers do pointer tricks to make this less of an issue). But I've heard a few times now that the losses there in performance are...
When to use blocking sockets over non blocking sockets on UDP? Question 1:What's is recommended for the following scenario ? Multiple clients send data over multiple UDP sockets, i.e. say client1 sends data over sockets 100, 101, 102,..,105 . client2 on sockets 110,111,112...115 etc. Port numbers are fixed for clients...
One of the devs that works with me is following the Open/Closed Principle to add functionality to a Model by extending from our framework ORM. class BaseModel extends ORM { ... } All our models are now inheriting BaseModel, and this model works well in the context of our application. class Product extends BaseMode...
There's a (possibly abandoned) library I'm using in my project. Its Google Code project page mentions it's MIT licensed. Nowhere in the code itself, nor any of the included files, is there a copyright notice or license specified. The closest thing is the author's name in one of the headers. Since the sole requiremen...
I was running our code through JSHint, and decided to switch checks against cyclomatic complexity, and then went on long refactoring sprint. One place though baffled me, here is a code snippet: var raf = null //raf stands for requestAnimationFrame if (window.requestAnimationFrame) { raf = window.requestAnimationFram...
I'd like to implement a simple chess peer to peer network application : one instance of the program may register friends player, and when one friend is "connected" (I mean both available by another program instance and registered as friend), I can ask him to play a game. As I know J2SE language, as well as Swing framew...
I come from a strong OO background, and I have recently started working in an organization which, although the code is written in Java, has a lot less emphasis on good OO design than what I am used to. I have been told that I introduce "too much abstraction", and that I should instead code the way it has always been do...
Is it a good idea to use somebody else's library as a base and build your own library over that. I want to make a JavaScript Canvas framework for a animation player on top of KineticJS. Should I do it? Do I need permission from the author of KineticJS? Do I just say to users to donwload KineticJS before my library, or ...
I'm implementing floating-point arithmetic, for a micro-controller which does not support floating point numbers, in either hardware or software. (Software being "written" in a sort of electrical diagram program.) I've finished encoding/decoding from/to integers, adding, subtracting, and multiplication. My "floats" are...
I'm only passingly familiar with either, but it seems like most of what ZeroMQ offers is already built into Erlang, yet there's an Erlang-ZeroMQ binding that's fairly active according to its github page. What am I missing?
Recent QA testing has found some regression bugs in our code. My team lead blames recent refactoring efforts for the regressions. My team lead's stance is "refactor, but don't break too many things", but wouldn't tell me how many is "too many". My stance is it's QA's job to find bugs that we can't find, and refactoring...
I'm trying to remember a word, I think it's related to computational or database theory. The closest synonym is atomic but that's not exactly it. Basically it's a kind of computation that should produce the same result even when run multiple times in a row, meaning it doesn't create side effects for itself. I specifica...
We are developing a banking application. It's internal project of the bank. The application has to capture huge data to process. So auto save is recommended approach to capture? How to perform validations in case of auto save? And on jsp unload saving the data is correct approach? Which is best way of saving form...
I am working on creating a REST ws exposing few API's. A token is required for each API call. I am confused about the expiry time to be set for the token. Security+Performance wise what is the ideal expiry time for token (if there is one)?
I am new to freelancing websites. The problem is I have zero rating and I can't get any projects even if I bid the lowest amount. I tried bidding aggressively. I even tried bidding the lowest possible amount to get my first project but still people having higher ratings get the project. This in turn prevents me from ge...
I've been playing around and learning javascript/KineticJS by making some simple games (think like board games). I have the game model that is relatively logically simple. When a "move" is given to my game model, it updates the properties of all the pieces. However, I would like to make the view have some nice-looking ...
I am looking for a tool supporting me with estimations. What I would like to do is to specify a higher level task and break it into several smaller tasks. When a task is small enough, I could assign the time it takes to finish it. The sum of these quantifiers should show up in the parent tasks. One could use Project fo...
I am currently maintaining/enhancing a project a bit old speaking of the 1990's. Atleast 15 developers would have worked over it. Going through the code for understanding is bit difficult. No coding standards being followed. OOP concepts not clear. Too many unnecessary methods and functions, also unused files. Worst...
I am developing enterprise iPad application which contained large amount of different bundle data in terms of group of images. Is it worth to stored as a compressed file format or normal set of individual files? I am not worrying about huge amount of data which is reside in the cloud. My concern is that cloud computing...
I can never do too many Haskell tutorials. There is always something to refine and learn. So, I am working through chapter 10 of Real World Haskell, and everything makes sense. but Why do newtype Parse a = Parse { runParse :: ParseState -> Either String (a, ParseState) } identity :: a -> Parse a identity a = Parse (...
Background The Wikipedia page on Syntactic Sugar states: In computer science, syntactic sugar is syntax within a programming language that is designed to make things easier to read or to express. It makes the language "sweeter" for humans to use: things can be expressed more clearly, more concisely, or in an alternati...
We are embarking on a new project which will be using the ASP .NET MVC4 platform. I have been informed that the design is being outsourced to a custom design firm and they will be supplying us with HTML pages and stylesheets. How easy will it be to incorporate these css stylesheets and HTMl pages in our application? ...
I ran across the CareerCup website which says they can help prepare you for programming interviews with various US based top tech companies. They don't "guarantee" anything, and the site appears to be backed by a well reviewed book*. *The reviews are on Amazon I have been an active member on StackOverflow so accordi...
I'd like to improve my team's workflow and architecture. Right now we have a LAMP dev server on which every member of the team has a subdirectory. We work directly in this directory via LAN. There is also a "release" directory for when we're ready to upload via FTP to the production server. We use a github private repo...
As images have EXIF data which provide info about where and how they are created, do any Text Editors append such kind of descriptive details to code files? For example I use Coda for my programming works. Does Coda sign any files created by itself? Is it possible to find out the author of two different projects by jus...
I am interested in starting a career in artificial intelligence. Can anyone suggest how I could prepare for this? What languages should I study that would be best for this career choice?
I have this web application that is going to be all client-side technology (HTML, CSS, JavaScript/AngularJS, etc...). This web application is going to be interacting with REST API in order to access and modify data. Right now it is undecided on what type of authentication system the REST API is going to use. From my ...
I was wandering how can Object.Clone() access field fields that are actually defined in the subclasses, and not the actual implementation of this feature. What is bothering me is that I cannot see the logic to allow base class (even if it is "special") to access the fields defined in the subclasses - doesn't this break...
We're using MySQL with Sequelize.js as the ORM. What we're wondering is whether a DOA layer of abstraction is worthwhile. Here are our options: To use the Sequelize models throughout the application. To abstract Sequelize by building a layer that converts Sequelize models to Backbone models so that we're using Bac...
I'm designing an XML response for a consuming application to take in, and I'm weighing two different designs. Currently I have a design as follows (where the Product element can repeat): <Response> <AccountType> <ProductType> <Products> <Product> <ProductID /> <ProductStatus />...
What are the categories of cyclomatic complexity? For example: 1-5: easy to maintain 6-10: difficult 11-15: very difficult 20+: approaching impossible For years now, I've gone with the assumption that 10 was the limit. And anything beyond that is bad. I'm analyzing a solution, and I'm trying to make a determination of ...
I am trying to come up with a data schema/methodology for storing the data collected from various different user application forms. All forms contain the basic info like name, address, etc but then they diverge in what they collect. Each application will have its own unique subset of questions they want to ask. Becau...
I am planning on building a system where users "subscribe" to "records". Records are updated on a schedule, several times a day. When records are updated, the user should be notified that these records have been added/updated. I don't want each user to have their own copy of the records due to storage space and the ove...
I've been trying to grok the double-dispatch pattern and having a hard time. I finally attempted a sample program to help myself understand. Here's the gist. But then I decided to attempt it without Double dispatch and the solution didn't look any more terrible than usual. What am I doing wrong?