instruction
stringlengths
34
19.9k
I am reading this wonderful book called "Coders at Work: Reflections on the Craft of Programming" by Peter Seibel and I am at part wherein the conversation is with Joshua Bloch and I found this answer which is an important point for a programmer. The paragraph, goes something like this. There's this problem, which is,...
I'm creating a website based on users' code, a place where they can share code in a social way and one of the features I'm currently developing is Code Review. This feature will allow users to evaluate code in certain aspects, from the top of my head I came out with things like: Legibility, Performace and Modularit...
I am leading a team of 3-4 junior developers. My job-- besides writing code-- is to provide supervision and guidance for the juniors. But, I fully understand how much developers cherish autonomy in their work, and I don't want to destroy their intrinsic motivation by spoon-feeding them with my thoughts and my algorithm...
As a result of a retrospective we were uncovering worse ways of developing software. We had a idea we though was great and tried it. We stayed with it during the development of a major update which took 3 months. After a retrospective with the maintenance engineers it turn out our idea does not work for them (we had di...
I am quite new to the Clojure world. I appreciate the fact that one has easy access to all Java libraries via Clojure interop features, but I was wondering how much Clojure stands on its own legs. Of course there are some platforms, like Android, where interoperability with Java will always be required, because the cor...
This is for a small personal project for micro-management. Basically, I store tasks in a SQLite3 database that looks like this: id INTEGER PRIMARY KEY AUTOINCREMENT label TEXT deadline INTEGER So each task has a due date (deadline) that is stored as a Unix Time Stamp. So far so good, I can do entries such ...
We all have definitely used typedefs and #defines one time or the other. Today while working with them, I started pondering on a thing. Consider the below 2 situations to use int data type with another name: typedef int MYINTEGER and #define MYINTEGER int Like above situation, we can, in many situations, very well ac...
Are there any known design patterns for implementing discount models? By discount models, I mean the following: If a customer buys Product X, Product Y and Product Z he gets a discount of 10% or $100. If a customer buys 100 units of Product X, he gets a discount of 15% or $500 If a customer has brought in the last y...
I am just going through the WPF concepts I came across these routed events, dependency properties and attached events. What are the concepts behind them and why are they called instead of .NET ordinary methods?
I develop an internal business application that our engineers use to test and debug the company's product. The engineering manager has been pushing to get the software developers involved when the engineers are in their design phase. He says that he wants to give us an idea of what's coming down the pipe, and give us t...
I have a situation where I have to access several "sub-properties" of an object and find it quite appalling to write such code. I was wondering how best to deal with this situation: void Main() { MyAClass aClass = new MyAClass(); aClass.BClass.CClass.DoSomething(); } In addition to it being an eyesore, there a...
Consider these two examples: Passing an object to a constructor class ExampleA { private $config; public function __construct($config) { $this->config = $config; } } $config = new Config; $exampleA = new ExampleA($config); Instantiating a class class ExampleB { private $config; public function __const...
I'm a little bit confused about 'function' and 'lambda'. I've seen some examples showing that the scheme keyword lambda works very similarly to the JavaScript keyword function, but I really don't know how they are related. I'm told that 'function' and 'method' can be used interchangeably when speaking about objects in...
I'm trying to gather effective ways that others have solved the following problem. At work we've been forced to release a software patch (to be installed on end-user systems) that we only want visible to a specific customer. The custom code is in its own source-control branch. The problem is we have two parallel cod...
I am part of a team of seven developers in a small software company and I am trying to introduce regular group code and design reviews. We have carried out some reviews in the past, but it has been sporadic. I would like to make it a more regular thing. I have read Code Complete and other similar resources and they tal...
I'm working on a solution for an organization that needs to last them long term (as subjective as that is). They currently have a Joomla installation whereby the CMS talks directly to the database, from there I have started "bolting on" the additions that they need for their environment (mobile app, kiosk, and lobby di...
I am developing a course registration website in Django. New users must confirm their email address by clicking on a link emailed to them. Unfortunately, this message is consistently ending up in people's spam folders. What steps can I take to prevent this from happening? Should I include an unsubscribe paragraph? Shou...
I've spent some time developing a little Android app to scratch my own itch. I'm considering publishing the current version as a beta in Android Market. Pros for publishing it now would be the potential to get feedback. It would also be a way to gauge interest in the app which could effect whether to develop it further...
Some time ago I developed a small project for use in unit testing scenario's and published it on Codeplex. Back then I choose the GPL license but I didn't really understand it. Today I changed it to MIT, because it's a much simpler license that I can understand. I like to be recognized as the copyright holder, but I w...
I need to develop/use a package manager for an embedded Linux system with the following properties: A master fully controls which packages need to be installed (the slave has no possibility to ask the master anything) Download speed on the device is slow that not just everything from the master distribution can be dow...
I am a beginner programmer. I've gotten an AS degree in CS which exposed me to the basics of c++, data structures, and algorithms and have light experience with html/css/javascript from just messing around building my own basic websites. I am no where near a proficient professional programmer as of yet. My question is...
I've recently come across github projects that I could really use, but appear to have been abandoned, with lots of issues and important pull requests, perhaps 100+ forks. Often, there isn't an alternative project. Do I use the code as is? Do I pick a fork and ignore the others? Do I manually pull in code from the pull ...
Every release, our trail of bugs keeps on increasing. These are valid bugs however, we also have to write new features to stay in the competition. Also, those features will be more used than the bugfixes; and provide better ROI. How are other engineers and product owners handling this situation?
I'm interested in learning to develop for Windows Phone down the road a bit, and am mostly interested in developing Metro Apps for the Windows Phone. It seems like there is some basic info for Metro development now, but no guidance on what will be relevant when Windows Phone 8 releases. There seem to be two potential s...
I'm in charge of a software platform, written in C, that is used to provide a variety of projects to clients. I am trying to improve the workflow for people using this platform, and looking at whether source code control (Mercurial being the most likely candidate) can help. The platform is only used internally for ~10...
I want to build an Android SIP application, and I'm looking at csipsimple's source for inspiration. I am using: Linux, Eclipse 3.7, Android sdk & ndk, swig. What are the development phases or steps for such an application? And what would be an appropriate licence? I am not asking for code, but for an overview of the...
I'm looking for an efficient algorithm to find clusters on a large graph (It has approximately 5000 vertices and 10000 edges). So far I am using the Girvan–Newman algorithm implemented in the JUNG java library but it is quite slow when I try to remove a lot of edges. Can you suggest me a better alternative for large gr...
What is the difference between Development Operations and Software Configuration Management? For me it seems to be the same as long as both DevOps and Software Configuration Management are focused on: Establishing development infrastructure - being in charge of version control, build management, deployment management,...
I am quite proficient in C and know some C++, but never touched Java. Recently I got an idea for an app which I think has potential, and I want to develop it. I am planning to go Android first, cause it doesn't require a mac/iPhone. So my question is: can I go straight to learning Android development, picking up the ...
Software developers don't typically use date as version number, though YYYYMMDD format (or its variances) looks solid enough to use. Is there anything wrong with that scheme? Or does it apply to limited 'types' of software only (like in-house productions)?
I've got a few files which are used in several of my repos: functions.sh, shell library to for example print a colored warning/error message or the documentation of a script file. Makefile; a standardized one which installs the file $(CURDIR)/[dirname].sh to $(PREFIX)/[dirname] and references a test script. LICENSE. t...
Which approach makes most sense to use, the destructive one or the non-destructive one? Does anyone have real-world experience with one, both or even a different approach? Model A permission scheme has a set of permissions linked to it. It can also have a parent from which it inherits permissions. Destructive Taking aw...
In Compilers: Principles, Techniques, & Tools, Aho et al describe an approach for optimizing for parallelism (chapter 11 in the second edition). Is anyone aware of any existing compilers which follow that approach?
I'm working on an API whereby a specific call would replace a subtree of an XML document—rooted at some element—with another subtree. The two options I'm considering for a response to this call are: Return the DOM Return the modified subtree In the interests of developing a standardized, stable API, I'd like to get t...
I am planning an application that includes a membership card functionality, where the user can place an order, either in the application or by phoning the vendor. Once the order is placed, especially in the case of a phone in order, what would be the best approach to having the vendor side communicate relevant details...
I have a desktop application that sends a POST request to my website every 5 minutes. This post request can contain a variable amount of data about the PC sending the request, but typically it contains about 20-30 variables of information. I'm storing all of this information in a MySQL table in a format like, RequestID...
So today I had a talk with my teammate about unit testing. The whole thing started when he asked me "hey, where are the tests for that class, I see only one?". The whole class was a manager (or a service if you prefer to call it like that) and almost all the methods were simply delegating stuff to a DAO so it was simil...
We just deployed a large software that affects the way the user work-day looks like in many aspects. It changes a lot of things in the way they interact between eachothers. The developers of the team are taking rounds and spending one day at the customer's site to understand better what is a typical day for our user,...
This is how my team has it's development environment set up: Each team member has a local development environment on their own computer, where they check out the code from a shared repository. Every developer work in their local development environment, once they finished writing the code they commit back. The code is...
When I'm coding in Python and I want to try something out, I open IDLE of Python on the command line and am able to quickly try something out. Is there a similar way I could do that for Java? I have heard about Java "shells" (e.g. http://www.beanshell.org/). Has anyone tried them?
When I look up "stack machine" I often get stuff like the JVM that uses a stack for data, but it still uses an array to store its instructions. I would like to find out more about machines whose programs are stacks. For example, executing the command at the top of the stack by default removes the element at the top of ...
I completed the Machine Learning course (Stanford) and got very interested, also after some research, I decided that I'd like to learn nature-inspired algorithms. I've found some resources like: Clever Algorithms: Nature-Inspired Programming Recipes (Book) Wyss institute (Website) Programming Game AI by Example (Book...
In Douglas Crockford's "JavaScript: The Good Parts", he walks through three types of inheritance: classical, prototypal, and functional. In the part on functional inheritance he writes: "The functional pattern also gives us a way to deal with super methods." He then goes on to implement a method named "superior" on a...
I have a server component which runs over Zeroc-ICE. When I wanted to load test it, I thought that using parallel library to create multiple requests would do it. But it dint end up that way. Using Parallel(Parallel.For) library from C# apparently was easier but it doesn't seem to be exactly generating everything paral...
I have written a lot of software in many different languages, and I've also "written" hardware for use with FPGAs using Verilog and VHDL. I tend to enjoy writing hardware more than software, and I think one of the primary reasons is that it is possible to write hardware that is "done" and never needs to be modified: y...
I have a web crawler, and I'm looking for hints that will help me automatically detect a website country of origin. And by country of origin I generally mean the country the website is targeting. For example: http://www.spiegel.de/ -> Germany http://www.lemonde.fr/ -> France http://publico.pt/ -> Portugal http://www.e...
It seems reasonable to me that if a serious bug is found in production by end-users, a failing unit test should be added to cover that bug, thus intentionally breaking the build until the bug is fixed. My rationale for this is that the build should have been failing all along, but wasn't due to inadequate automated tes...
I have read many articles on the creation of dynamic types and classes at run time. For example, the TypeBuilder class in C# lets one create dynamic types. Python has this type function by which one can create dynamic classes. I have certainly good information on how I should create a class at run time, but I don't fin...
I'm currently going to write something to automatically create invoices with cronjobs by using PHP and timestamps. I have a, for me, well-considered idea of how to solve it, but I want to ask the community if someone may see errors in reasoning and possible problems with my solution. I'm trying to describe my idea as d...
What were the design decisions that argued in favour of void not being constructable and not being allowed as a generic type? After all it is just a special empty struct and would have avoided the total PITA of having distinct Func and Action delegates. (C++ allows explicit void returns and allows void as a template pa...
We're going to do some peer reviews for our iOS projects. We're kind of inexperienced at reviewing each other's codes. The iOS developers attending the reviews will be from other projects, since generally one person handles one client project in the company. I know there are some questions on SO about the things you're...
I'm in the process of choosing new unit testing tools for soon to be started project. There are plenty of them! The basic requirements I have would be that it can run tests on at least Windows and Linux, it is C++/C++03 compatible, it can execute tests in parallel (e.g., to take advantage of multi-core processors), and...
Possible Duplicate: When do you rebuild an application or keep on fixing the existing one I am currently working on a project that has been in development for the last few years used throughout the organization but the way the project has been coded the maintainability of it is completely shot. Reading the code pres...
I'm about to write a simple script to test a dataset for certain conditions. I was designing it as a set of functions each one describing the condition to be tested and pass them to the test engine: # The tester engine: all(f(dataset) for f in conditions) I realized that my approach was similar to unit testing. So, to...
I am trying to classify a set of images into grayscale or color groups. I have been using ImageMagic to do that, comparing the color image to a grayscale version of itself and then using the Peak Error to determine if it is a grayscale image, as shown here: http://www.imagemagick.org/Usage/compare/#type_general This is...
According to the relevant Django documentation, a request context offers more than a normal context in that it merges request data into the context. It is hence necessary for views that perform form submission in Django. However, I am wondering why one cannot just always pass a request context for every view. After all...
We all know that the process of creating a design and the whole architecture of the software is very important before writing the code. But how deep should be dive into the design stuff - should we start from the general architecture and go down til the names of the classes or should be just designate common parts and ...
Many CMS systems which rely on third parties for much of their code often build "plugin" or "hooks" systems to make it easy for developers to modify the codebase's actions without editing the core files. This usually means an Observer or Event design pattern. However, when you look at systems like wordpress you see th...
We've just moved to SVN from CVS. We have a small team and everyone checks in code on the trunk and we have never ever used branches for development. We each have directories on a remote dev server with the codebase checked out. Each developer works on their own sandbox with an associated URL to pull up the app in a b...
I am employed full time for company X and approached by company Y to do consulting services to write embedded C for them. While I know the basics of conflicts of interests and the big no-no's of sharing proprietary information, company knowledge and proprietary algorithms, I do have some questions regarding basic gener...
I'm trying to think about how I would go about doing calculations on extremely large numbers (to infinitum - intergers no floats) if the language construct is incapable of handling numbers larger than a certain value. I am sure I am not the first nor the last to ask this question but the search terms I am using aren't...
What is the best way to query data from a MS SQL Server in C#? I know that it is not good practice to have an SQL query in the code. Is the best way to create a stored procedure and call it from C# with parameters? using (var conn = new SqlConnection(connStr)) using (var command = new SqlCommand("StoredProc", conn) { C...
There is a chapter in "Making Software: What really works and why we believe it" By Andy Oram and Greg Wilson about software defects, and what metrics can be used to predict them. To summarize (from what I can remember), they explained that they used a C codebase that was open source and had a published defect trackin...
Developing big applications requires huge effort. There may be teams for each phase of development and they must use different design patterns and go through the whole SDLC. I have two years of experience as a software developer on small applications and I'm interested on what are the common approaches & practices for...
In most other languages the condition comes before the statement to be executed when the condition is met. However, in CoffeeScript (and maybe some other languages) the syntax is: number = -42 if opposite Is there any online documentation of what the logic behind this design decision for this syntax was?
Let's take the following (JavaScript) code that returns a function that closes over variables x and y to illustrate: function test() { var x = Math.random(); var y = Math.random(); var f = function() { console.log(x, y); }; return f; } test()(); The code is nonsensical, I just want to close over x and...
Starting with a new dev team on a new project and we have to define our Branching strategy for our source repository (e.g. Microsoft Team Foundation Server 2010). We've run into a sticky discussion over whether or not to... A. Have one Release branch from which we do production builds and then Label when something is ...
Ever since I've started lurking on stackoverflow, I keep coming across programming concepts such as abstract classes, virtual functions, contracts, interfaces, etc., from a questions about other languages such as C++, Java, and C#. As far as I can tell, most of these things are related to object oriented programming ...
I have a question concerning derivative works of GPL'ed software. Imagine the following situation: A company writes a software (A) using a library (B) which is released under the terms of the GPL. Now of course, software (A) has to be released under a compatible license to the GPL. But what about dual-licensing? If sof...
Is there a programming language in which you can set your own syntax configurations and it would convert the code to a language you choose? For instance, you would choose specific configurations like "Python's indexed blocks", [a,b,c] initializes arrays, ^ for exponentiation and others. A script would convert it to you...
A few months ago I discovered a cool course called Rails for Zombies. This is a great site that allows us to write code and see the results. It takes us through the paces to get us up to speed with Rails. You have to pass each level (including code challenges) before being taken to the next level, and it gets you groun...
I am part of a Java development team with a 6 week deadline. This necessitates writing a good deal of code very very quickly. However our development team has different styles of coding. Everything from name conventions to methods of abstraction differ among our team. Does anyone know of any documents that dictate "sta...
I can't say I am a good programmer but I've been earning money for programming last decades. I've thought I was born for programming and people said I was very good at it - at some point. But after 10 years of programming, I feel my programming efficiency is not as good as others. Of course, CS education is way better ...
I am interviewing candidates for Java programmer positions. My colleague insists in filling more than half of the interview with java coding puzzles.His view is that, if candidates are able to navigate through the loops, then they must be good. One such example of coding puzzle is i=0; for( i=1 ; i< 10 ...
What would be the most cross browser friendly (IE9, Chrome, FF, Safari, Opera) way to code an animated, interactive double-helix? HTML 5/JavaScript is fine. Flash or Java is not. I am unsure if canvas or svg or pure css should be considered as graphics aren't typically my thing. In fact, I really don't know where to ...
First off, I am new to licenses and app stores. There is an example app on a framework that has a Class file with much of the functionality I'll need for my own app. It's less than 1000 lines of code and distributed under the Apache License 2.0. As far as I know I can use/modify the code and just acknowledge the devel...
I am considering basing some new software on a LGPL web application. I want to utilize this new software for creating one website for my employer, and we do not intend to sell or distribute the software itself to anybody. Does publishing web pages from LGPL software constitute "distributing" in the license, so I would ...
Recently I posted one of my the projects1 on GitHub and as I was exploring capabilities of the site, I noticed they have a rather decent issue tracking section. I want to use that section as a) other people can report bugs if they'd like and b) other people can see which bugs I'm aware of. However, as others have noted...
I have been working on my hobby project in C++ for more than 2 years. Whenever I write a module/function, I code it with lot of thinking. Now see the problem, do { --> write the code in module 'X' and test it --> ... forget for sometime ... --> revisit the same piece of code (due to some requirement) --> feel t...
There are several products for tracking the usage of your application. I know at least 10 offers. They tell you which features were used more often than others. Thus, you can identify features that may not make into new versions. While with Google Analytics, or similar tools, this a standard tool for the web at the "pa...
I'm trying to figure out an exercise but it doesn't really makes to much sense.. I'm not asking someone to provide the solution. just to try and analyse what needs to be done in order to solve this. I'm trying to understand which PSP 1.0 1.1 process I should use. PROBE? Or something else? I would greatly appreciate som...
I hope this is the right place. This is a homework assignment for my Operating Systems course and I have to implement a working virtual memory system in C++ so programming is directly involved. I've read some sources about Paging and Virtual Memory now (Tanenbaum, What Every Programmer Should Know About Memory, etc) a...
Possible Duplicate: Difference between Dependency Injection (DI) & Inversion of Control (IOC) I'm new to Inversion of Control, Dependency Injection and everything related to these stuff, so excuse me if I'm not specific in my question: Is there any magical piece of code, a good explanation or a link, so I can finall...
I am implementing a grammar in CUP, and it would often be helpful to see everything at a glance. This could also be useful in finding errors quickly. Are there any programs out there that will visualize grammar in the CUP syntax? Or can you think of a very easy way of doing it (for instance, convert the grammar to anot...
Possible Duplicate: When to use abstract classes instead of interfaces and extension methods in C#? What other reasons are there to write interfaces rather than abstract classes? This question sounded a bit trivial to me as well, till I gave a it serious thought myself. What is the point of a Java interface? Is it r...
I have a website developed in ASP.NET MVC. Now, I am looking forward to getting up a mobile interface for it. My knowledge in this regard isn't that great, so I will explain what is needed to be done. It's much like on the lines of StackOverflow or Programmers and following are the few points that need to be addressed...
I work in a company that sells SaaS web applications for HR and financial issues. Our customers are key accounts to which we guarantee the privacy of their data, for obvious reasons. We need to make usage statistics of our applications by its customers (which links are clicked the most? Which browsers are used the most...
Language Choices of Large Corporations Having spent almost 12 years working in the financial sector, at both large and small companies, my overriding impression, with the exception of Goldman Sachs, is that fragmentation (or, putting a more positive spin on things, diversity) is the name of the game. Within a single c...
We've a call stack in our project. The program is written for microcontroller, the language is C. The call stack is basically an array of integers. The variable that represents this call stack ends with the string _stack. I was reviewing the implementation. The feature is reset recovery, not the call stack, but the cal...
Over the course of my career, I've noticed that some developers don't use debugging tools, but do spot checking on erroneous code to figure out what the problem is. While many times being able to quickly find errors in code without a debugger is a good skill to have, it seems it's less productive to spend a lot of tim...
Possible Duplicate: How do you normally layout a class's regions? It often happens that I'm stuck in front of my code editor searching the best place to put a new function. I've no norm nor rules to do that. My question is simple : does some exists, if not how would order your function to structure your files or cla...
I'm trying to figure out what all is happening in the LinkedIN links URL. A link from LinkedIN community opens with a window shade (?) containing the LinkedIN site tools much like the alerts here at SE. The target link is embedded in a LinkedIN url as a GET variable. This is a LinkedIN link in three parts (the middle ...
The classical way to program is with try ... catch. When is it appropriate to use try without catch? In Python the following appears legal and can make sense: try: #do work finally: #do something unconditional However, the code didn't catch anything. Similarly one could think in Java it would be as follows: try {...
When programming Python I sometimes do a ** to make a conversion. I understand what it does but what data structures am I manipulating? A dict and what is the other? An array? Is there a name for the ** operator?
Suppose I have an XML config file like the following: <myapp> <settings/> <output> <mailto>mail service configuration parameters</mailto> OR <smsto>sms service configuration parameters</smsto> <output> While the settings node will have alway...
Possible Duplicate: Can we use Java for commercial use? I am a college student learning how to program in Java. I really like Java's simiplicity and portability and I would like to one day develop a commercial application in Java. What I am trying to understand is Java's GNU license. With the recent litigation betwe...
I am about to build some WCF Services. Those services need to communicate to each others too, in some scenarios. I've done some "Google-ing" about Service Registry but can't figure out how to implement service registry with WCF; is there any other alternate? Is there any Microsoft technology available for Service Regi...
In my quest to better my development skills I learn new design patterns. In sample projects or personal projects it's really easy to adapt new patterns into my code. However at work I have a large code base that I am responsible for architecting and maintaining. This question is focused on writing consistent and maint...
We are working on a moderately-sized C++ code base (10Mloc) which through our optimization efforts is becoming uniformly slow. This code base is a set of libraries which we combine to put them to work. When the general framework of how these libraries communicate was developed there was some emphasis on performance and...
I know that *args and **kwargs are ways to feed more arguments into a function in Python. I am wondering where these terms stem from. Why have all the asterisks in the beginning? What does the kw in kwargs stand for?