Is there a useful correlation between choice of web-browser/search engine and good quality programmers?

After a round of interviews earlier this year, which included some practical questions with access to a computer, I noticed that, at least for the applicants we were seeing, there was a high inverse correlation between quality of applicant and the explicit choice of Bing/IE as the stack for search/browsing the web. That is, a large number of applicants specifically searched for IE to use as a browser when browsing the web, and specifically used Bing as the search engine (even typing in Bing in the Google search box, before starting a search) Is this just an outlier, a fluke, or is there some sort of information I can obtain from this observation? So far, my best candidates are:   * Yes, there is a high correlation between good programmers and choice of web browser/search engine   * There is some training program, or community, which advises using IE/Bing during interviews, and I just happened to run into a poor selection from that group   * Something else is going on, that I don't know about, but someone here might know. So, to repeat, the question is: is there more than coincidence at work here, and, if there is, what's going on?


Rearranging Cartons Algorithm

**Problem Statement -** ![Problem Statement](http://i.stack.imgur.com/pbK2U.png) The task is to find the minimum number of swaps required in the given arrangement of cartons to get the desired arrangement of cartons. Only adjacent cartons can be swapped. I have tried an ad hoc approach, but it proved inefficient towards the upper limit of the data range. Here it is for reference -               Traversing through the given arrangement of cartons      if position of carton>than the desired position       swap back       go to previous iteration      What would be a pragmatic approach to the problem? Test Data Range - N<=105 Source - INOI 2009 Q Paper


Is tracking Android OS.Buid/Manufacturer info a privacy issue?

On the Android operating system details about the phone are available via the `Android.OS.Build` class. These details include things such as the phone manufacturer, model, version, etc. The customer may want us to collect this data and save it to our database for analytics and tracking. I think this raises some privacy concerns for the end user. Are we obligated to inform the user that we are collecting this information (similar to how the use of the device's capabilities, such as camera or microphone, are presented in the Play Store) and what we intend to use it for? If we are not required to do so, is this something that we should, from an ethical perspective, inform the user that we are doing?


What pattern should one use to dynamically add multiple small views to one big main view?

Imagine a small calculator GUI, with basic operations (`+,-,/,*`), and in the menu we can check for example scientific calculator and a small new view with the extra functions appears beside. I was thinking that the decorator pattern is the solution but after reading some documentation on it, I am confused now. Which pattern would be more suitable for doing such things?


What happens if you're unable to solve a problem?

I'm a year away from graduating from university, and I'm really looking forward to solving practical problems. Especially non-trivial ones which require a bit of research and a lot of thinking. But at the same time, that is also my greatest fear - being faced with a problem that I'm unable to solve, no matter how hard I try. And with pressure to deliver code on impending deadlines just around the corner, it does look a bit scary when viewing it from the safe playgrounds on uni (where the worst thing that can happen is that you have to redo a course or exam). So for those who have been in industry for any longer length of time, what would happen if you were told to solve a problem that you couldn't? Has it happened, and if so, what did happen? Did they just drop it and said "Oh well, guess we can make do with something else"? Were there consequences? Were you reprimanded, or even fired?


How practical is it to build your very own social network?

A friend of mine wants to create his own niche social network for a specific target audience. I want to give my friend an idea about how practical this is on the software side. What kind of work would go into this? Is this a practical undertaking?


Best practices in versioning

I develop some scripts for data analysis in a small team. For the moment we use SVN, but not in a very structured way. We haven't even looked how to use branches even though we need this functionality. What do you suggest as the best practice to setup the following system:   * two code bases (core and plugins)   * versions can be incompatible to previous scripts   * sometimes individual features are being developed and not yet finished, while other fixes have to be done urgently to the code In the end we don't deliver the code as a package, but rather place the Python scripts in some directory (with version names?). Some other python script which serves as a configuration choses the desired version, sets the path to these libraries and then starts to import the modules. I saw stable releases to be named "trunk" so I did the same. However, no version numbers yet. Core and plugins are different repositories, however we have to match versions for compatibility. Can you suggest some best practices or reference to ease development and reduce chaos? :) Some suggested GIT. I haven't heard about it, but I'm free to change.


Can you recommend a good release notes template?

I am looking for a good release notes template. Possibly in a plain text or HTML form. What do you guy use? **EDIT:** I forgot to mention that these notes will be used internally in our company for other developers using our libraries. I am interested in what you believe a release note should and should not contain. E.g. do you list all open issues or just issues closed in this release? Do you maintain all previous release notes in the same file (possibly in reversed chronological order), or have separate documents for each release? A couple of examples that I have found on Apache web site:   * TXT: Apache Commons Net   * HTML: Maven


Is it possible to develop a web application entirely in Javascript today (client and server) including a RESTful API exposing PostgreSQL data?

Where I work we have over a dozen internal SW systems that we have developed in-house using a variety of technologies, frameworks, and languages. Those include various from Microsoft (ASP.NET Web Forms, WebAPI, WinForms, SharePoint, Office Automation, Win8 Native Apps, SQL Server, SSRS) and others not from Microsoft (plain-old JS/HTML/CSS, PHP, Lithium, PostgreSQL, MySQL). Our SW dev team has grown and shrunk again to where it's just me and one other dev now. I love trying shiny new tech and taking advantage of different tools to get things done, which partly explains the huge span of different technologies we've chosen over the years, but we're suffering from the "jack of all trades, master of none" syndrome. Now we've been told that the company is expecting significant new growth and that the two of us will need to produce a number of new applications over the next year. I'm ready to consolidate our skill sets and tool sets so that we can master the tools and focus more on the business problems we will face without having the slowdown of context switching between technologies. The two of us have been doing a lot of "plain old" JS/HTML5/CSS3 development recently and I would like to focus on that technology set moving forward. We will be primarily using PostgreSQL as our data store on the back end (possibly augmenting with some NoSQL for very specific uses, and probably needing to find an advanced full-text search tool to integrate in). Our primary user interfaces will be a combination of traditional web apps and Single Page Apps (50%-50% mix), but there is the hope for native mobile apps down the line. Therefore I would like to expose our business data via a RESTful API so that it's easy to consume by various clients. And **the most important factor in all of this is that I want to be able to code exclusively in Javascript from front to back** (with the exception of writing SQL as necessary for the DB layer, and HTML5/CSS3 for the presentation). This leaves me with the following questions:   1. Is it possible today to code all these layers/components exclusively in Javascript without resorting, for example, to PHP on the server, or C# for the RESTful API (i.e., WebAPI)?   2. Is node.js required to make this a reality, or can I use a non-node web server and still achieve the "Javascript-only" ideal? (related...would node.js just make more sense in a JS-only paradigm?)   3. Are there any frameworks for building JS-only RESTful APIs that can talk to PostgreSQL?   4. Are there any advanced full-text search tools (such as Lucene) that allow you to program against them with a JS-only approach?


"Standard" format for using a timestamp as part of a filename

I searched for a standard format for using a date/time as part of a file name and was unable to come up with anything. My question is two parts: **Is using time stamps ~~to enforce unique~~ in file names a poor practice?** I could get the time from the creation date and serialize the file names (file0001.bak, file0002.bak, etc) but just including the time stamp lets perform file operations such as `mv 2011-01* somewhere/`. Is there a downside to using this type of naming system? The format I am using is `YYYY-mm-dd_HH-MM-SS`. **Is there a better format I should be using?** With this format should i be concerned with file system compatibility, str_to_date_parsing concerns, etc? Thanks! edit: I might have wanted to leave out the **enforce** uniqueness bit since it's a single user generating backup using a cronjob (there shouldn't be any concurrency problems).


Do I have to include full gpl v2 license information in my commercial project if I use another author's work?

I would like to use another author's work in my commercial project. That author's work is licensed under GPL v2. I'm not using full code. I'm using only part of the code. Also I modified it as per my project needs. Now i'm confused about what kind of license information I should include. This is the full license text. I'm using multiple author's work in functions.php file. Some works are licensed under MIT. 1) Do I have to include full license text in my php file as a comment? 2) Do I have to create separate php file for each author's work.?


How to implement two different web services running the same business logic?

We are developing a ReSTful HTTP API with Servicestack(.NET). Some of the API clients, which have a subset of the actions, demand a service which could be easily added with all the entities, like with the "Add Service Reference" with Visual Studio. We are thinking about creating a simple asmx web service, but our thoughts on how to do it divide to two:   1. The asmx WS will call the ServiceStack service with an HTTP client.   2. The asmx WS will reference the same BL that the main service references and will call it directly. **Which is the preffered way?** **Is there any other way you would recommend?**


How does customized executable generation work?

One of the things that Valve's Steam distribution platform is known for is its Custom Executable Generation system, which creates a unique copy of a program for each person that buys it. I'm sure that Valve isn't the only company or person to have implemented or thought of implementing such a system, however. If I wanted to try and roll my own system that generated executable files on the server side that are unique to the downloader or their account, what would I need to know how to do? What are the basics of such a system in the first place?


Is Python Cookbook for python 2.4 applicable to python 2.7.5?

My college has a course on Introduction to programming using python and we are using Python 2.7.5. I would like to know if it will be helpful to read Python Cookbook which is for python 2.4? There are no separate cookbooks for python 2.7.x, to my knowledge. But, are there any similar books? There is a later edition to python cookbook for Python 3, but it turns out that python 3 and python 2 are quite different.


Using Paypal (or similar) to log into my site?

I have a web site and I want to offer a few levels of service - one free, one for a one-off payment, and one for a subscription. My first inclination is to use Paypal for the payment options. I understand that I can make some login page on my site where you create an account or login to an existing account, and then I can make an API call to Paypal to see what they've paid for and give them the appropriate level of access, and redirect to Paypal for them to pay for the access they want. I'm not sure yet if the free service will require a login or not. But having read Joel Spolsky's and Bruce Schnier's blogs, I'm conscious of how hard it is to do authentication right, and what a pain it is for users to have to create an account or login to my site, and then create an account or login to Paypal. Is there a way to use Paypal's login system directly, so they login to Paypal and Paypal sends me back a token saying who they are and what they've paid for? That kind of sounds like almost an OpenID, or something similar?


When should i learn a php framework?

I am working on a project , a mobile hybrid application , that combines native code , html5 - jquery mobile (for the frond end) and php - mysql (for the back end). The server side , is responsible for things like registering new users to a database , updating users , subscribing users to events etc. Basically is simple php code with mysql queries. Lately i started to read a lot about php frameworks. I started to wonder when is really time to use any and basically why? From my understanding the framework only helps in the back end of a service and usually all the back end i ve build till now is described roughly above. In general i am interested a lot on building mobile services which include both back end and frond end development. By learning/using a framework do i earn something special in my case? I dont understand how my 100line php scripts could get any easier if they were written with a framework. Yes i ve read a 100 times that is better to use something tested and bug free than use your own things but i dont understand what exactly they are talking about. What could go wrong by quering a database and fetching/saving/editing data that a framework would solve it? What i am asking here is maybe for some examples when a php framework should be preferred.


Should a PHP beginner use a framework?

> **Possible Duplicate:**   >  When should I start learning a PHP Framework I am an absolute beginner programmer. I've got lots of theoretical understanding from university a decade ago but no practical experience. I want to remedy that with a hobby project that would be similar to a real-world sellable web app. I've chosen PHP in order to avoid OS specifics, build process, etc. **Should I start out using a framework, or coding everything by hand? What would the benefits of using a framework be?** I have briefly looked at PHP Code Ignition and it does a good job of praising its own benefits. I am sure that is true for an experienced developer, but does it also apply to a beginner?


How should I specify a grammar for a parser?

I have been programming for many years, but one task that still takes me inordinately long is to specify a grammar for a parser, and even after this excessive effort, I'm never sure that the grammar I've come up with is good (by any reasonable measure of "good"). I don't expect that there is an algorithm for automating the process of specifying a grammar, but I hope that there are ways to structure the problem that eliminate much of the guesswork and trial-and-error of my current approach. My first thought has been to read about parsers, and I've done some of this, but everything I've read on this subject takes the grammar as a given (or trivial enough that one can specify it by inspection), and focuses on the problem of translating this grammar into a parser. I'm interested in the problem immediately before: how to specify the grammar in the first place. I'm primarily interested in the problem of specifying a _grammar_ that formally represents a collection of concrete examples (positive and negative). This is different from the problem of designing a new _syntax_. Thanks to Macneil for pointing out this distinction. I had never really appreciated the distinction between a grammar and a syntax, but now that I'm beginning to see it, I could sharpen my first clarification by saying that I'm primarily interested in the problem of specifying a grammar that will enforce a predefined syntax: it just so happens that in my case, the basis for this syntax is usually a collection of positive and negative examples. How is the grammar specified for a parser? Is there a book or reference out there that's the de-facto standard for describing best practices, design methodologies, and other helpful information about specifying a grammar for a parser? What points, when reading about parser grammar, should I be focusing on?


What's the best way to store documentation associated with a code project?

We have a lot of documents associated with our software development. These include things like requirements, design documents, external PDFs, customer files, testing instructions, etc. Currently, these documents are scattered all over the place (wiki, "some place on the network", a local developers hard drive(!), and even worse places). What's the best way to keep track of them? Since we use visual studio (2010) for our development, and we don't really have any non-developers on the project, I thought it'd be a great idea to store them within the VS "solution", which would allow them to be source controlled, and universally accessible by all the developers. However, VS really doesn't seem to be built to do this. If you edit any document file, even one that is setup with the build properties "None", "Do not copy", VS must will rebuild the software before it will run again. There is no way to create a "Documentation Project" within the solution. (We use an Empty C# project for this). Visual Studio and Word/Excel flat do not do source control well. You can't view a checked-in file, and then decide to make a change without first closing the file, going to the project, and manually checking it out before making the change. It's slow and tedious at best. Anyway this is the best our team has come up with, but I really wish I had a better (free) solution.


Lowering barriers to entry into new programming endeavors

What things do you do to lower the barrier to beginning new projects? How long does it take to get into something new from when the idea hits to when you start making enough code to play with? In general, I'm referring to toy projects, but the concept still stands for more substantial FOSS projects upon which work is desired to be done. For example, I would like to stop being afraid of image file formats, and to that end I'd like to be able to create an app that leverages OpenGL for viewing arbitrary image formats. Or, I'd like to explore how to handle very large image files. Maybe these kinds of projects are not casual enough for me to dive into and out of. Other examples are things like, wow this FOSS program is great! But I'd like to fix some functionality. Oh look, if I'm going to build this on windows I have to find these million dependencies and compile them myself. Or, dang, this code is written in python. Oh wait, 2.6, now I need to make sure I install that version as well, and remember which version I'm writing for. Do you find it more conducive to work in linux? Is the idea of a casual programming endeavor just a myth? In what ways have you lowered your barrier to getting started? Thanks


Best resources for learning Play! Framework

Awhile back I discussed the possibility of moving to a startup that is going to be using Java, more specifically the Play! Framework; well, I'm going to go for it! I have been a .NET guy for a long time now and haven't really been in the Java game except for the occasional Android tinkering or messing around with Scala a little bit. I have looked at the Play! Framework before but only on a cursory level. I think I will be fine with Java as a language, as I've been given great advice before on learning materials. My question, is aside from the very great site for the Play! Framework I haven't found much else out there except a few blogs. Does anyone know of any other good resources for the Play! Framework like books? An Amazon search turned up zero results. I know there is an eBook floating around out there but it seems a little outdated at this point. Anyway, thanks for your input.


Creating Objects

I have a general coding standard question. Is it bad practice to initialize and create an object in multiple methods depending on the outcome of a users choice. So for example if the user quits a poker game, create the poker hand with the cards the user has received, even if < 5, and if the user played till the end create object to show completed hand to show outcome of the game. The key is that the object will only be created once in actuality, there are just different paths and parameters is will receive depending on if the user folded, or played on to the showdown.


External repository moved from Sourceforge (SVN) to GitHub, now what?

We've been getting the head revision of the JEDI Code library for a while, we only use it a tiny bit so never have bothered to manage which version we're getting. The problem is they appear to be totally untethered from SVN now and we'd been including it in our repository as an external and now my build server it kaput. The obvious thing to do would be to just download zip and make a new repository on my SVN server and use that instead, updating when I feel like it. But is there a better solution? We use Tortoise SVN as an SVN client. (BTW, it's pretty strange that the JCL changed to Git with the great integration in the Delphi IDE isn't it?)


Steps towards TDD

I need some advice to take the steps for TDD. How do we think in terms of interfaces for everything when we are writing code? Most of the testing books tell you how to write tests. But I want a book which tells whats the good way to write code in terms of TDD


Is it possible to write an operating system in C?

A while back I saw a comment on a Stack Overflow question that surprised me: > No one can write an operating system in C. It is not possible. What one can > do is write an operating system in a C-based/C-like language that > adds/defines a considerable amount of non-standard capabilities on top of C > core. Is it useful to define C so narrowly? People say Linux, or a GPU driver, or an embedded system was "written in C", not "written in C-with-some-extensions-to- accommodate-the-hardware." Is it incorrect to do so?


3-Tier Object-Oriented Design Flaw?

I am going through training at my new job to use good object-oriented design with a 3-tier programming style. My supervisor says I have a design problem with my code:               class Program     {         public static void Main()         {             UserInputValidator Validater = new UserInputValidator();             int logSelected = -2;             Console.Write("\nFilepath: ");             string filePath = Console.ReadLine();             while (logSelected != -1)             {                 Console.WriteLine("\n" + "SELECT AN OPTION MENU");                 Console.WriteLine("-----------------------");                 Console.Write("\n" +                 /* Display option menu here with several options */                 "9 ) Exit\n\n");                 Console.WriteLine("-----------------------");                 logSelected = Convert.ToInt32(Console.ReadLine());                 Validater.ValidateOptionsMenu(logSelected, filePath);             }         }              public void DisplayMessage(string message)         {             Console.WriteLine(message);         }     }      Validator.ValidateOptionsMenu() handles the logic for starting a process depending on the option that was selected. This is a 3-layer application with Presentation, Business, and Data Access layer. Program is in the Presentation layer, and other layers use code similar to the following to display a message:               Program program = new Program();     program.DisplayMessage(message);      I need to understand why this is bad practice - my supervisor says the class Program only starts the application, like App class in WPF. It has to have only 1 responsibility. The interaction with user (my option menu) is delegated to another class. I am having a hard time understanding my supervisor, and I'm not sure how to fix it. Can anyone help me understand?


How can I overcome a badly structured software development model?

I joined the company currently I am working on as a fresher. Due to the limited number of skilled people in GIS software development, and since I was among one of them I was directly recruited as a Project Manager. I was quite conversant with Java and GIS, and I have done self motivated research on location based services, but not with project management and structured software development. It was one year after my graduation as a Geology special and during the previous year I was working as an academic in a University. Thanks to the interest I was having at work, an opportunity shown up, and eventually I was made responsible for the Business Intelligence department of the company as well. The company believed in me. I myself studied data warehousing and BI concepts and was successful in combining GIS with BI as well. Also I am currently working with two developers on our BI tool in C# WPF, where I also play the role of a developer at times (which I like). I tried extremely hard to adopt good software development methodologies with agile project management, but it was not very successful. Also, though I believe in well designed code as far as a product is concerned, due to the lack of technical knowledge my CEO has (who is directly above me), I normally do not get the amount of time needed to do it. The time taken is greatly enhanced by the lack of expertise we have in the specific coding language as a whole too (for instance WPF opposed to Java). Also there is no version controlling system in place as well. I am extremely fed up with the way things are going as it is not structured and I find most of my time thinking than working as to how to get things structured. I hope you guys with good professional experience will be able to help me overcome this situation.


How many programming languages is a programmer expected to be an expert at?

Do most programmers specialize on a single stack, leaving other things be, or are they expert at multiple languages at the same time? If it's more than one, how many is standard? By expert, I mean more than simply knowing the syntax of a language - an expert knows enough of standard libraries, tools, environments and syntax to be able to write non-trivial programs without having to constantly look things up or read books/tutorials.


Splitting up a Rails/Ruby app onto multiple servers

We recently moved a large application to two machines, both running the same codebase. I. Machine A   * Web server for public facing application   * Receives web hook call backs from our ESP   * Handles a few large, list-processing jobs (uploaded spreadsheets with data) II. Machine B   * Manages a massive set of (background) jobs but, primarily, focuses on building and assembling newsletters   * Runs all integration with our NetSuite platform   * Runs all system maintenance (read: DB) jobs  To me, having these two apps running the same codebase (a large, monolithic Rails application) seems 'wrong'. I am wondering if anyone has advice on how to better break up the code for these two apps. While they both need the same DB and, ultimately, the same model code, Machine B has no need for Controllers and Views and it feels wasteful running a full-stack Rails app for its tasks. A couple things came to mind but I'm not sure if I'm trying to solve a problem that doesn't exist:   * Break the models out into a sub-module on git and include into both apps   * Build out the Mahcine B app in plain Ruby or a lighter framework like Sinatra (where I could use ActiveRecord with Sinatra in combo with a sub-module for the model folder).  I'm new to this scenario and appreciate any and all feedback or direction! Thank you.


how complex a constructor should be

I am having a discussion with my co-worker on how much work a constructor can do. I have a class, B that internally requires another object A. Object A is one of a few members that class B needs to do its job. All of its public methods depends on the internal object A. Information about object A is stored in the DB so I try to validate and get it by looking it up on the DB in the constructor. My co-worker pointed out that the constructor should not do much work other than capture the constructor parameters. Since all of public methods would fail anyway if object A is not found using the inputs to the constructor, I argued that instead of allowing an instance to be created and later fail, it is actually better to throw early in constructor. Not all classes do this but i found that StreamWriter constructor also throws if it has problem opening a file and doesn't delay the validation until the first call to Write. What others think? I am using C# if that makes any difference. Reading Is there ever a reason to do all an object's work in a constructor? i wonder fetching object A by going to DB is part of "any other initialization necessary to make the object ready to use" because if user passed in wrong values to the constructor, i wouldn't be able to use any of its public methods. > Constructors should instantiate the fields of an object and do any other > initialization necessary to make the object ready to use. This is generally > means constructors are small, but there are scenarios where this would be a > substantial amount of work.


What is the benefit of having the assignment operator return a value?

I'm developing a language which I intend to replace both Javascript and PHP. (I can't see any problem with this. It's not like either of these languages have a large install base.) One of the things I wanted to change was to turn the assignment operator into an assignment command, removing the ability to make use of the returned value.               x=1;          /* Assignment. */     if (x==1) {}  /* Comparison. */     x==1;         /* Error or warning, I've not decided yet. */     if (x=1) {}   /* Error. */      I know that this would mean that those one-line functions that C people love so much would no longer work. I figured (with little evidence beyond my personal experience) that the vast majority of times this happened, it was really intended to be comparison operation. Or is it? Are there any practical uses of the assignment operator's return value that could not be trivially rewritten? (For any language that has such a concept.)


iOS App Signing and Certificates

In order to sign an application for the Apple App Store, we need to create a certificate by saving a certificate request file from `keychain` and then upload it to the Apple store. I was wondering, what does this certificate request file contain?   Does the certificate contain any information (like a finger print) about the OS or hardware?


How do you track third party services SSL certificates?

Recently Windows Azure Storage SSL certificate unexpectedly expired and since a lot of dependent services defaulted to "refuse to connect to a site with expired SSL certificate" that became a serious problem. Now the SSL certificate of any web service can be retrieved by anyone at any time for validation. The picture is from the linked to question: ![cert expired](http://i.stack.imgur.com/xebIt.png) So it means that the information was available at all times to "anyone it might concern" and any user of the service could have noticed the upcoming expiration and for example post a message on Microsoft forums before it was too late. However I can't find any information about how such cases are typically handled except this question for doing that in code. Is there any kind of best practice for validating third party services SSL certificates? What tools are typically used?


Testing Git competence

I hire a lot of programmers for tiny tasks. I very clearly specify that the tasks can only be completed by making a pull request on GitHub. Unfortunatelly, so many programmers do not know Git and often the programmers cannot complete the project due to not understanding/being willing to learn Git, even after they have undertaken the programming of the task. This is bad both for me and for the programmers. Sometimes I end up arguing for why it is inefficient that they just send me a zip file containing the code. Therefore, I am looking for an online service to certify that the programmers know how to make a pull request so I do not waste their nor my time. The certificate should be free for the coders, but may cost me. It is important that the course just focuses on exactly what is needed to make a clean pull request so it should not take more than 5 minutes to go through. Does such a thing exist?


What is the difference between Times and Dup in Assembly Language?

In a bootloader, the second last line is : > TIMES 510-($-$$) db 0 Now, will this command also do the same : > db 510-($-$$) DUP (0) If not why? I know what `TIMES` does, but its not mentioned in my x86 book by Mazidi (Pearson Publication). Any idea why? And what is the meaning of the `$` sign exactly? Different sites have different information about `$`. And is the line `TIMES 510-($-$$) db 0` absolutely necessary even if my bootloader code is of 512 bytes in size? So can anyone help me with these questions?


How do I correctly include copyright statements for included libraries? I have a program that uses libraries which are licensed under the GPL and MIT (either jointly under both, just only MIT) licences. How do I specify this at the top of a combined and minified file? I have this currently:               My Program (GPL)     Copyright 2009-2013, Me          jQuery (GPL/MIT)     Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors          Some other library (MIT)     Copyright 2013, Some other person          This file is part of My Program.          My Program is free software: you can redistribute it and/or modify     it under the terms of the GNU General Public License as published by     the Free Software Foundation, either version 3 of the License, or     (at your option) any later version.          My Program is distributed in the hope that it will be useful,     but WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     GNU General Public License for more details.          You should have received a copy of the GNU General Public License     along with My Program.  If not, see <http://www.gnu.org/licenses/>.          ...jQuery's code...     ...my code...     ...some other libraries code...


How can I cleanly separate first open tutorial code from my regular display code under OOP?

I have a MVC architecture, and I have the basic views completed. I now need to add the first user tutorial mode into the project. I don't want to add checks for first user state in all the views that need it, but the only alternative I can think of is to subclass everything and use those subclasses on first open. Is there a standard or widely-used practice for adding support for tutorials, etc. without making a mess of everything? EDIT: I was unclear in my question. I'm talking about tutorials that a user encounters when first using the app -- in our case we want to add visual effects to direct their attention to key UI elements. I wrote "first user state" to mean we store state about the number of uses on a local machine and use that to determine if display is necessary. Usually I would add some kind of edge case code to the views, say, if User.firstUse() arrowView.show();, but I was wondering if there's a cleaner way to partition that kind of code from regular code.


How to train yourself to avoid writing “clever” code?

Do you know that feeling when you just _need_ to show off that new trick with `Expression`s or generalize three different procedures? This does not have to be on Architecture Astronaut scale and in fact may be helpful but I can't help but notice someone else would implement the same class or package in a more clear, straightforward (and sometimes boring) manner. I noticed I often design programs by **oversolving the problem** , sometimes deliberately and sometimes out of boredom. In either case, I usually honestly believe my solution is crystal clear and elegant, until I see evidence to the contrary but it's usually too late. There is also a part of me that _prefers_ undocumented assumptions to code duplication, and cleverness to simplicity. > What can I do to **resist the urge to write “cleverish” code** and when > should the bell ring that **I am Doing It Wrong**? The problem is getting even more pushing as I'm now working with a team of experienced developers, and sometimes my attempts at writing smart code seem foolish even to myself after time dispels the illusion of elegance.


Technology for atoms animation

I would like to make an animation of Molecular diffusion. I have some CSV or binary file with data to create 3D scene with atoms. It has to be fast animation with diffrent camera views and transparency vary depends on atom's energy. Since I code in C# on a regular basis I am going to pick up XNA (later Mono.XNA). Is it the best fit? Is there anything good that reduce the amout of code? Has anyone had problem with porting XNA animation to Mono.XNA?


Detailed C++ book for a programmer already familiar with C and object-oriented programming?

I know (to some extent) a few languages, including C, Java and Python. I'm also (somewhat) familiar with Scala and Scheme, plus I can read (but not write) x86 Assembly. Say I want to learn C++, what is a good book which doesn't try to teach me what a class is, teach me inheritance, polymorphism or loosely coupled classes again, nor does try to teach me other basics, just the C++ language (as well as how to write _idiomatic_ C++ code, not e.g. Java with C++ syntax) and its standard library? **Note:** "Detailed" as used in the title means that it doesn't try to cover C++ in 100 pages, I want to know the details of the language. Of course, mastery comes from practice, but I don't want to learn just a little bit of C++ from the book, but learn it quite thoroughly.


What does it mean to expose a C++ code publicly as a C API and what are the advantages of doing it?

I often hear people say that C++ programmers should expose their library's/product's public API as a C API. What does that mean and what are the advantages of that?


Recursion without factorial, Fibonacci numbers etc

Almost every article I can find about recursion includes the examples of factorial or Fibonacci Numbers, which are:   1. Math   2. Useless in real life Are there some interesting non-math _code_ examples to teach recursion? I'm thinking divide-and-conquer algorithms but they usually involve complex data structures.


Testing: deterministic or non-deterministic?

Is it better to have either a   * Deterministic test suite, that results in the same tests succeeding   * Non-deterministic test suite, which potentially possibly covers more cases ? **Example:** You write a test suite to test controller functionality in an MVC application. The controller requires application data from a database as input during the test. There are two options to do this:   * You hardcode which row(s) from the test database are selected as input (e.g. the 10th and 412th row)   * You use a random number generator to pseudorandomly pick the data from the database (two rows selected by a random number generator) The first is deterministic: every run of the test for the same revision of code should yield the same result. The second is non-deterministic: every run of the test suite has the possibility to yield a different result. The randomly picked data might however be a better representation of data edge cases. It might simulate a user feeding our controllers with unpredictable data better? What are reasons to choose one over the other?


How Immutable Sets are Manipulated

When working with an immutable set or map, like the ones found in many functional programming languages, operations that would otherwise modify the container generate a new container instead. I know that most list operations in functional languages do not result in a copy of the list and just rearrange pointers. This is why working with lists is extremely efficient. I am curious whether immutable maps are similar or if an entirely new map is created after each operation. I am asking because a library I wrote manipulates a lot of maps and I am curious whether I will see a performance boost if I switch over to immutable maps. Currently, I am just looping over my map adding or throwing away key/value pairs as I go.


MVVM Reporting App Approach ? Data Access Layer?

I'm trying to follow the MVVM pattern in a reporting / statistics application that I'm making in C# / WPF. I have made many model classes to hold properties as a starting point. Some of these models are made to encapsulate different statistics so that I can present data that can be cross refrenced. I'm thinking the next step is to create a data access layer with classes and methods to connect to a database and grab the values to populate these models. I was thinking of creating a connection and query passing class. Then other classes for each specific set of data that I will need for the models. (constructing queries to pass) From what I understand I will be calling these data access layer methods from the view model to populate instances of my models. Which I will present with the view. Is my approach in theory the correct standard way to approach this problem? Any suggestions? Or Reference Material?


Warranty or guarantee clause for code breaking

Should I guarantee or add a warranty clause to my contract in the event code breaks or an anomaly occurs outside the client's hand or act of God? If so, what should that language say?


How do I improve my ability to manipulate code quickly, not wpm?

I have seen several questions on here about touch typing and words per minute but not about improving ones ability to manipulate text using keyboard shortcuts, bindings etc. I have tried putting a **cheat sheet of keyboard shortcuts** next to my monitor but I can never incorporate them in my 'flow'. I have also tried the **'just use vi and don't touch the mouse'** method but that only helps me with navigating code and not editing. I would prefer to use some application (or game) to learn text manipulation. But it looks like nothing like that exists (app idea?). I'm open to other suggestions too.


Using some kind of version control when working alone and with small projects?

Very often I'm working on small projects only for myself. I'm working on one machine, but recently I thought about using some kind of version control nevertheless. This would have some benefits as for example:   * I don't have to care anymore for local backup   * Mistakes can easily made undone   * History can be maintained But on the other hand it has also some drawbacks like for example:   * Additional resources required   * Time to setup, get used to it, etc. From your experience, is it a good thing to use revision control when your working alone?


How long does a Comp Sci degree last?

I keep hearing from people that if I don't become a programmer soon after graduation my degree will be a useless piece of paper, they claim it will become outdated. I kind of find this hard to believe considering what I was taught at a fairly good school has been standard practice for some time. So is this a true belief in industry? That somehow I become less desirable after a year or two, even though the graduates who comes after me pretty much get the same identical education.


C# Unit Testing In A Single Project

Alright, so I'm doing my first "real" C# project. I'm chugging along, enjoying myself, nice little language I've got here, fairly easy to use, la ti da. Then I get to the point that I realize there's no simple way of setting up friend classes for unit testing. Well. This is unfortunate. I dig around and find that I can jump through some burning hoops and expose everything to another assembly with:               [assembly: InternalsVisibleTo("AssemblyName")]      But... this is a fairly minor in-house app that I've just going to a single binary and doesn't really warrant multiple assemblies. What other options - if any - does C# offer?


How many different configurations are used for software tests?

This article shows that for Android apps, software developers use between 30 and 50 different devices for compatibility tests. I tried to find information about tests of applications on "classic" computers, for example PC games or graphics-oriented business applications: how many different hardware configurations are typically tested in this area?


Separating roles authorization and database

Something really bothers me about the way authorization tends to be done with roles in ASP.NET MVC. The way it is normally done is that you have a Users table and a Roles table. A User can have many Roles. Then you decorate your controllers/actions with an authorize attribute saying which roles you want to allow access to the controller/action:               [Authorize(Roles = "Admin")]     public ActionResult AdminOnlyAction()     {     }      The problem with this is that your code is reliant on data within the database. Obviously you could, at application start, seed your database with the roles needed if they're not present but there's still a fragile dependency on the data in the database (e.g. it could be deleted, renamed, etc. etc.). Having an enum or similar with the Role levels in instead of storing them in the database seems reasonable but still leaves me with a sour feeling. Is there an elegant alternative which I've not hit upon?


How and what should I be (unit) testing for in this method?

I am relatively new to unit testing and have a query about what/how I should be testing a certain method. For the following (psudo-c#) method I have created (not a real-life example) what would you test for? Initially, my thoughts would be to test the output with variations on the dictionary of form fields, e.g. valid, invalid, missing values. However I also wonder how you would test to make sure the object values have been changed to the correct value and that the correct email message was attempted to be sent (obviously both services could/would be mocked). I hope what I am asking makes sense, I appreciate this is a subjective question and the answers may be 'it depends' ;)               public bool ProcessInput(Dictionary<string, string> formFields, ObjService objService, EmailService emailService)         {             try             {                        // Get my object id                        int objId;                        if(!int.TryParse(formField["objId"], out objId)                        {                           return false;                        }                             // Update my object - would you validate the save against a DB or a mocked inmemory db?                        var myObj = objService.Find(objId);                        myObj.Name = formField["objName"];                        objService.Save(myObj);                             // Send an email - how would you test to make sure content, recipient, etc was correct?                         emailService.SendEmail(formField("email"), "Hello World");                             return true;                 }             catch(Exception ex)             {             return false;             }         }


What to do with bugs that do not repro?

I have a tester that while testing will have an error occur (ok so far), but then he frequently reports it right away. We (the developers) then later find that the tester has not tried to reproduce the issue and (when asked) cannot find a way to make it happen again. Now these are still bugs, I don't want to ignore them. But without repro steps I am kind of stuck. Sometimes there is a stack trace (though frequently it is not useful because this is compact framework and there are no line numbers). But when there is one I can take the stack trace and crack open the code and start guessing, but that does not lead to testable "fixes". What do you do in scenarios like this?


Programming During a Crisis

I'm having difficulty turning this into a proper question, but here goes... Some of you may have heard about the flooding happening in Queensland, Australia. Well, I'm in the inner suburbs of Brisbane right now; the river has been slowly creeping toward my house since Tuesday. When I left for work this morning it was twenty meters down the road when it is normally kilometers away. Within hours of the distater striking, the government already had some pretty good web applications available for people to get information about what was happening and where the flood was predicted to rise. They also set up a database for people to search for the whereabouts of relatives or could register their location for others to see. Has anyone been involved in the development of these kinds of projects before? It's interesting that they could churn out this software in what appeared to be less than a day when the average development house could take weeks at best. In what ways did it differ from a 'normal' project? Any other thoughts?


Is it legal for me to contribute to open source software while employed?

I work for a large corporation and I want to keep my skills fresh. I think contributing to an open source project would help, especially if I ever want a job at a startup. I have heard that large companies often own any development employees do outside of work. Could I face legal consequences by contributing to an open source project without notifying my employer? Could I be putting an open source project at risk if I contributed to it while employed? If refrained from contributing due to legal reasons and I applied to another company where open source development experience is expected, would they understand or would my application go in the trash bin?


Programming Language most relevant to the Financial sector?

I am a freshman in college and doing a software engineering/ finance double major. I've been learning programming on my own and have a good bit of familiarity with php by now. I was wondering what you guys think the most relevant programming language is for financial/investment banking use? I have read this thread: Books on developing software for financial markets/investment banks I want to start learning/reading up on a language (the basics not financial/quant stuff) to set a foundation for the future financial/quant stuff.


Is Rails 3 ready for use in production?

I'm looking to get a snapshot of Rails 3 at this point in time. We're about to start a new long term project, and I'm wondering if R3 is ready for real use. Or, if there are still a lot of bumps to be worked out. E.g. I saw questions about its compatibility with Passenger. (?) Thanks!


Why we need Throw-away Prototyping?

What is throw-away prototyping model and why do we need it? How does it differentiate from Evolutionary Prototyping?


How does the MongoDb licence define "commercial" and "non-commercial" use?

I have a question about "commercial" and "non-commercial" usage, also with the usage of MongoDb. Lets imagine we got a website without a business model, the site grows in popularity but still no incomming money. Are we talking about non-commercial at this point? And once the website starts making money, is it allowed to decide at that point to get a commercial license? Thanks for help.


Cookie access within a HTTP Class

I have a HTTP class that has a Get, and Post, method. It's a simple class I created to encapsulate Post and Get requests so I don't have to repeat the get/post code throughout the application. In C#:               class HTTP     {         private CookieContainer cookieJar;         private String userAgent = "...";              public HTTP()         {             this.cookieJar = new CookieContainer();         }              public String get(String url)         {             // Make get request. Return the JSON         }              public String post(String url, String postData)         {             // Make post request. Return the JSON         }     }      I've made the CookieJar a property because I want to preserve the cookie values throughout the session. If the user is logged into Twitter with my application, each request I make (be it get or post) I want to use the cookies so they remain logged in. That's the basics of it anyway. But, I don't want to return a string in all instances. Sometimes I may want the cookie, or a header value, or something else from the request. Ideally I'd like to be able to do this in my code:               Cookie cookie = http.get("http://google.com").cookie("g_user");     String g_user = cookie.value;      or               String source = http.get("http://google.com").body;      _My question_ - To do this, would I need to have a Get class, and a Post class, that are included within the HTTP class and are accessible via accessors? Within the Get and Post class I would then have the Cookie method, and the body property, and whatever else is needed.   Should I also use an interface, or create a Request class and have Post and Get extend it so that common methods and properties are available to both classes? Or, am I thinking totally wrong?


JavaScript client for talking with WCF server with WebSockets binding

I'm excited about the possibilities for duplex communication with WebSockets between a web browser and web server. I see that WCF for .NET 4.5 supports a WebSockets binding now, and I know there's a JavaScript API for using WebSockets. However, what I don't understand is how these are supposed to interoperate. Yes, you can deal with raw message passing with the JS API, but there doesn't seem to be any JS library for doing SOAP-based RPC compatible with WCF. Do any of you know if there are any libraries to enable a web browser to call a WCF service using WebSockets?


Do all functional languages use garbage collection?

Is there a functional language which allows to use stack semantics - automatic deterministic destruction at the end of the scope?


Is there a good example of Python code for unit testing an api?

Do you know any good example of Python unit testing code for testing an API? Thanks! **Update** :   * Found this very interesting question: http://stackoverflow.com/questions/7336101/testing-rest-api-with-database-backend   * I am especially looking for examples to test a CRUD API


Asymptotic running time of for-loops

I have this question which I need answered: > What is the asymptotic running time for the following piece of code? >   >   >     if (N < 1000) >       for (int i = 0; i < N; i++) >         for (int j = 0; j < N; j++) >           A[i] = j; >     else >       for (int i = 0; i < N; i++) >         A[i] = i; >   > >   1. logarithmic in N >   2. linear in N () >   3. linearithmic in N >   4. quadratic in N > And the correct result is “ _2. linear in N_ ” which I can't figure out why, since that as far as I've understood, we want to accept the worst case>best case. The worst case here is that the if statement is run and the time would then be quadratic in N. I am aware that we're trying to find some kind of average of more attempts, but how can I know what the value of N is? If N is really high (10000), it's obviously the else statement that is run most of the times. But can we assume this or have I misunderstood something?


Implementing a modern web application with Web API on top of old services

My company has many WCF services which may or may not be replaced in the near future. The old web application is written in WebForms and communicates straight with these services via SOAP and returns `DataTables`. Now I am designing a new modern web application in a modern style, an AngularJS client which communicates with an ASP.NET Web API via JSON. The Web API then communicates with the WCF services via SOAP. In the future I want to let the Web API handle all requests and go straight to the database, but because the business logic implemented in the WCF services is complicated it's going to take some time to rewrite and replace it. **Now to the problem:** I'm trying to make it easy in the near future to replace the WCF services with some other data storage, e.g. another endpoint, database or whatever. I also want to make it easy to unit test the business logic. That's why I have structured the Web API with a `repository layer` and a `service layer`. The repository layer has a straight communication with the data storage (WCF service, database, or whatever) and the service layer then uses the repository (`Dependency Injection`) to get the data. It doesn't care where it gets the data from. Later on I can be in control and structure the data returned from the data storage (DataTable to POCO) and be able to test the logic in the service layer with some mock repository (using Dependency Injection). Below is some code to explain where I'm going with this. But my question is, does this all make sense? Am I making this overly complicated and could this be simplified in any way possible? Does this simplicity make this too complicated to maintain? **My main goal** is to make it as easy as possible to switch to another data storage later on, e.g. an ORM and be able to test the logic in the service layer. And because the majority of the business logic is implemented in these WCF services (and they return DataTables), I want to be in control of the data and the structure returned to the client. Any advice is greatly appreciated. **Update 20/08/14** I created a repository factory, so services would all share repositories. Now it's easy to mock a repository, add it to the factory and create a provider using that factory. Any advice is much appreciated. **I want to know if I'm making things more complicated than they should be.** So it looks like this: **1. Repository Factory**               public class RepositoryFactory     {         private Dictionary<Type, IServiceRepository> repositories;              public RepositoryFactory()         {             this.repositories = new Dictionary<Type, IServiceRepository>();         }              public void AddRepository<T>(IServiceRepository repo) where T : class         {             if (this.repositories.ContainsKey(typeof(T)))             {                 this.repositories.Remove(typeof(T));             }                  this.repositories.Add(typeof(T), repo);         }              public dynamic GetRepository<T>()         {             if (this.repositories.ContainsKey(typeof(T)))             {                 return this.repositories[typeof(T)];             }                  throw new RepositoryNotFoundException("No repository found for " + typeof(T).Name);         }     }      _I'm not very fond of`dynamic` but I don't know how to retrieve that repository otherwise._ **2. Repository and service**               // Service repository interface     // All repository interfaces extend this     public interface IServiceRepository     {     }          // Invoice repository interface     // Makes it easy to mock the repository later on     public interface IInvoiceServiceRepository : IServiceRepository     {         List<Invoice> GetInvoices();     }          // Invoice repository     // Connects to some data storage to retrieve invoices     public class InvoiceServiceRepository : IInvoiceServiceRepository     {         public List<Invoice> GetInvoices()         {             // Get the invoices from somewhere             // This could be a WCF, a database, or whatever             using(InvoiceServiceClient proxy = new InvoiceServiceClient())             {                 return proxy.GetInvoices();             }         }     }          // Invoice service     // Service that handles talking to a real or a mock repository     public class InvoiceService     {         // Repository factory         RepositoryFactory repoFactory;              // Default constructor         // Default connects to the real repository         public InvoiceService(RepositoryFactory repo)         {             repoFactory = repo;         }              // Service function that gets all invoices from some repository (mock or real)         public List<Invoice> GetInvoices()         {             // Query the repository             return repoFactory.GetRepository<IInvoiceServiceRepository>().GetInvoices();         }     }


Common header file for C++ and JavaScipt

I have an app that runs a C++ server backend and Javascript on the client. I would like to define certain strings once only, for both pieces of code. For example, I might have a CSS class "row-hover" - I want to define this class name in one place only in case I change it later. Is there an easy way to include, or read, some sort of common definitions file into both C++ and JavaScript? Ideally as a compile / preprocessing step but any neat approach good.


Asking people to disable Java for security - what's next for developer?

I don't know what best to give as title to this so pardon me if it sounds weird. I saw this question asked on IT Security and another site asking people to disable Java from their system or browser because it's vulnerable. As a lover of Java, though currently doing C#, I would love to still do more Java in future, but this news is giving a bad name to the good old Java. Wouldn't this drive developers like me away from Java? Wouldn't it spell a bad name for Java among developers and prospective clients?


What does the term "fast follower" mean?

In the last few days, I've heard the term "fast follower" mentioned several times. It's used in the context of an unresolved bug/issue that (supposedly) will be quickly fixed and implemented. Is this some new corporate jargon? I'm aware of a fast follower strategy, or second mover strategy (as described in this wikipedia article), but that doesn't apply in the context.


Automatically propagating changes

When working on multiple similar projects there are often changes that can't be extracted into a library, but should be applied to most of the projects. I mean changes like a modified directory structure, some common configuration, similar ui code, etc. The most basic strategy is to copy a new project from the last finished one and throw out the business logic. The problem is that the improvements to the newest project won't move back to the older ones. A slightly better strategy is to set up a boilerplate repository, clone every new project from it. Then the reusable bits can be extracted form the newest project into the boilerplate and then pulled to the older projects. Of course, merging might be complicated, but I've had this strategy work quite well for me. Pushing the changes is still too much work though. Is there a strategy to automate propagation of _some_ changes across multiple projects?


Scrum decision making versus maintainability and development time?

I appreciate that this question may be controversial. In a sense, it is the flip-side of the question "Business trying to make technical decisions". In Scrum, the development team is supposed to be collectively responsible for making design and technical and code-level decisions, to fulfill the customer requirements. There is a division of responsibility and power between the product owner, who defines and prioritises the stories by communicating with stakeholders, and the team, who decide _how_ to implement the stories. I think this is motivated by the belief that, since developers are intimately familiar with the code they have written so far, and all the information they have memorised or noted about the project, and they will face the consequences of poor decisions when they have to modify the code in future, they are best placed to make design decisions. And if in hindsight they realise they made a bad decision, it will be a very valuable learning experience for them, and they won't be able to blame management for what went wrong. In theory, I agree with all this. But (to kind of play devil's advocate) I can see several situations in which following this principle _to the letter_ could be a bad idea:   1. The development team are mostly either temporary contractors, are (unbenownst to others) intending to jump ship, or are going to be made redundant after shipping this project, or are going to move to another project and there is an _entirely separate_ team which will do "code maintenance". (A good example of this might be: a typical outsourced government computerisation project.) So, for any of these reasons, the team mostly aren't the people who will be doing the actual maintenance.   2. Or, the development team are _all_ inexperienced developers who don't really have a clear idea of the maintainability problems that can be caused by slipshod development practices or poor design decisions. While they have an incentive _in theory_ to do the right things, the incentive isn't working yet because they haven't been burned enough times (or they haven't acknowledged the connection between sloppy coding practices and getting burned).   3. The development team _like_ making big mistakes and working crazy hours to fix or work around them because (a) they are workaholics, (b) they like wasting time writing boilerplate code or using some bad old framework because it gives them a sense of job security, or (c) it makes them look like or feel like heroes.   4. The team like to endlessly bikeshed, or discuss endless different permutations of ideas, or add "internally-visible features" which are low-value, while the business really needs them to deliver value faster, and come on, good enough is good enough! There may be others in the organisation who could provide a variety of useful inputs into design and technical decisions: More experienced developers; Polyglot developers; Specialists, including DBAs (who may not necessarily be in the scrum team); Managers, who may be cynical and may have seen over- ambitious or wrong-headed architectures go awry too many times. But it's not just about getting input from people with valuable experience. More than this, isn't it fundamentally sometimes necessary for management (at any level) to be able to say "No, this way of implementing it would be a bad idea. Do it this way instead", or at least "No, you can try that later if there's time, but do it this simpler way initially"? It seems to me that Scrum is too idealistic in this respect. I know that this does happen, obviously, but to say that because of this interference "your organisation is not doing Scrum" suggests that "doing Scrum" is not desirable in such cases!


Distribution of Event Listeners in a Distributed Service Oriented Architecture

I have a service architecture composed of services that service common areas of the application. Examples of services would be:   * AccountService (manages client accounts in the system)   * BillingService (bills clients for products that are configured)   * UserService (manages user and groups under a given client)   * NotificationService (sends notifications via email/SMS/push/any method when certain events happen) I have an ActiveMQ cluster where I push events to act on...which leads to the question... Where is the right place to put a message listener that reacts to an event for the purposes of sending a notification? A simple example would be: "I want to notify the account owner via e-mail when a new user is added to their account." Should this listener be in NotificationService (which is intended to be highly generic), or in UserService (where the action is being performed), or in a separate service entirely which acts as a sort of router?


Futures/Monads vs Events

In an application framework when performance impact can be ignored (10-20 events per second at max),   **what is more maintainable and flexible to use as a preferred medium for communication between modules - Events or Futures/Promises/Monads**? It's often being said, that Events (pub/sub, mediator) allow loose-coupling and thus - more maintainable app... My experience deny this: once you have more that 20+ events - debugging becomes hard, and so is refactoring - because it is very hard to see: who, when and why uses what. Promises (I'm coding in Javascript) are much uglier and dumber, than Events. But: you can clearly see connections between function calls, so application logic becomes more straight-forward. What I'm afraid. though, is that Promises will bring more hard-coupling with them... p.s: the answer does not have to be based on JS, experience from other functional languages is much welcome.


Best Way to Present a Report with Code

I'm in a statistic course at Uni currently. We have to present reports on the findings along with the code we used. I'm wondering what is the best way to present this code in the reports. A separate page with a reference to the report or inline. Or something else? Thanks


Minimising little coding mistakes

I make a fair amount of small mistakes when I code (things such as getting an angle bracket to the wrong direction). It adds a fair amount of time to my coding because I have to debug several times and iron out the dinks. Have you got any advice on how to stop these mistakes creeping in?


Version control and personal configuration file

Our project uses a user-specific configuration file. This file is currently not in version control, since it is different for each user. The problem is, whenever a developer adds a new module that requires configuration, or changes the name of an existing modules, the other developers get errors because their private configuration files are not updated. To solve the problem, we thought of working with two configuration files: a default/global configuration file that will be in version control and will be updated regularly by each developer that adds a new module, and a private configuration file that will be kept out of version control and will contain only the user-specific changes. However, this still seems like an ad-hoc solution. Can you propose a better solution? What do the professionals do?


What to do after reading a beginner's book on C#?

I am 16 years old and want to get a job in the programming field in the future. Since I will be applying for a foreign university, I want to start programming by myself and gain experience, both to increase my chances for quality education and for later employment. Last year I learned Java, but whatever motivation I had mustered fizzled out after finishing the book, and I only did some basic work on a project I came up with by myself, before getting stuck and abandoning it. This year, I decided to learn C#. My Java knowledge, however small it may be, would help me pick up and remember more information from a beginner book, and since an year of inactivity without much prior experience warrants a reread anyway, I thought I might as well learn a different-yet-similar language, as opposed to just going through my HF Java for a second time. I picked up Herb Schildt's "C# 3.0 A Beginner's Guide" and finished it. However, I have no idea what to do now. Come up with a random project and work on it (potentially picking up something far beyond my limited ability)? Read up on more advanced topics (even though I don't have any practical experience)? I'm at a loss regarding what to do to actually become a capable programmer, after reading a beginner's book.


Is it possible to write a program that pipes the sound from one computer through the sound card of another?

I have a case where I need to use one computer's sound card to play sound but I want the sound to be generated at another computer that's on the same network as the other. Ideally the program that does this would only run on the computer that was generating the sound, though I'm fairly certain that isn't possible based on the research I have been doing. What ever I do with it though the solution would need to be such that the computer actually playing the sound would be secure. Thanks for any input.


What is Android's payment system like?

I've heard that Apple pays the developers in lump sums (I forget how often) for their app downloads. My question is does Google work the same way with Android? If not, how do they operate their payment system? Kind of a side question as well, but how do Apple and Google get you the money from other countries? Do they automatically convert it for you and take a cut for swapping the currency or is that your job?


Learning PHP OOP

I have been coding PHP for about 2 years now and I THINK that I have a very good grasps of the fundamental parts of PHP, i.e.   * Functions   * foreach/IF statements   * sessions/cookies   * POST/GET Amongst a few others. I want to move on to learning OOP PHP now, so learning how to use classes and making it a really valuable skill. I have 1 requirement, the source must be a respected source that doesn't teach developers bad habits. I have the book: PHP and MySQL Web Development However, as useful as that is I would like an online source. I would like to know from people with experience in OOP PHP, how and where did they learn OOP PHP. Obviously by doing, but I would really appreciate some great resources which help me along the way.


Rails: controllers vs models which should handle file manipulation

This post by Jamis Buck about keeping Rails controllers skinny has always stuck with me. I have an app in which a zip file consisting of an XML file and some images is uploaded and used to create the model (mostly from the xml file, which points to the images). Should all the code dealing with extracting the files from the zip and moving them to their appropriate place go in the controller or the model? thanks!


Does it make sense to have a single tab interface?

This is more a web design / user experience question, but since programmers.stackexchange.com is more opinion based, I posted this here - Does it make sense to have a single tab in a web app? I don't see any reason to have a tab if you can't tab to it from some other tab. My PM is demanding a single tab. I honestly think my PM is making horrible decisions regarding the design (we have no official designer) and eventually we will lose customers. The design of the application was made early 2000's and it shows (HTML tables, lots of inline css, etc). I am afraid that if we don't update it to match this decade's expectations of application, it will just turn off our potential customers. The application is an enterprise app that we sell to potential customers. We are a small company - our team for this application is 6 (3 developers, 2 qa (one being the pm), and one of the company's partners). Everyone's opinion matters (so I have been told), but if someone happens to disagree with the PM (who can do no wrong), she gets all huffy....and I am rambling. So my question remains - what are your thoughts on a single tab?


Is it better to document functions in the header file or the source file?

In languages that distinguish between a "source" and "header" file (mainly C and C++), is it better to document functions in the header file: _(pilfered fromCCAN)_               /**      * time_now - return the current time      *      * Example:      *  printf("Now is %lu seconds since epoch\n", (long)time_now().tv_sec);      */     struct timeval time_now(void);      or in the source file? _(pilfered from PostgreSQL)_               /*      * Convert a UTF-8 character to a Unicode code point.      * This is a one-character version of pg_utf2wchar_with_len.      *      * No error checks here, c must point to a long-enough string.      */     pg_wchar     utf8_to_unicode(const unsigned char *c)     {     ...      Note that some things are defined in the header only, such as structs, macros, and `static inline` functions. I'm only talking about things that are _declared_ in a header file and _defined_ in a source file. Here are some arguments I can think of. I am leaning toward documenting in the source file, so my "Pro-header" arguments may be somewhat weak. Pro-header:   * The user doesn't need the source code to see the documentation.      * The source may be inconvenient, or even impossible, to acquire.     * This keeps interface and implementation further apart. Pro-source:   * It makes the header a lot shorter, giving the reader a birds-eye view of the module as a whole.   * It pairs the documentation of a function with its implementation, making it easier to see that a function does what it says it does. When answering, please be wary of arguments based on what tools and "modern IDEs" can do. Examples:   * Pro-header: Code folding can help make commented headers more navigable by hiding the comments.   * Pro-source: cscope's `Find this global definition` feature takes you to the source file (where the _definition_ is) rather than the header file (where the _declaration_ is). I'm not saying don't make such arguments, but bear in mind that not everyone is as comfortable with the tools you use as you are.


License for freeware but closed source application

I have developed a simple application which I want to put release for free but I'm not planning releasing the source code. I want the application to be freely available but I do not want anyone to sell it or reverse engineer it. MIT License looks simple and nice but it also allows anyone to sell it. Is there any license out there suitable for me or should I just modify MIT License?


How to manage ratings system of my web app?

I am making a website where in users would rate posts by other users, according to how useful they are. The posts will be about products - mobiles, tablets, and other personal consumer electronics only. I want to make sure no trolling or slandering goes on, so I'll need a system that will make sure the good ratings of posts are genuine, and not just from people hired by those products' companies, or the bad ratings aren't from that product's company's competitors. I like the StackOverflow system of upvotes and downvotes. But that requires a lot of moderation, and frankly, I don't have the resources for that. I mean, the SO community has a lot of trusted mods, and admins, but in my site, in the beginning only me and my friend who are making this site would be the ones to trust, in order to keep only legit posts and legit ratings in our database, for the public to value from. EDIT 1: One solution I have in mind is, to include Facebook Like button as the only way to "upvote" a post. That way, leveraging the authenticity of users offered by Facebook (atleast to some extent), would benefit me. I'd count the number of likes and store them as upvotes for a particular post. There would be though, no downvotes. I'm thinking storing a ratio of "X users found it useful" as `Viewers that liked this post`/`Total number of viewers of that post`


Should the controller pass data to a view in the MVC pattern?

I work with ASP.NET MVC (and other web-based MVC implementations) quite often, but this is something I've never been sure of: Should controller and view communicate? Of course the controller should be choosing which view to use, but what I is mean should the controller be passing data to the view? In my opinion, if the view is expecting data from the controller, then they're effectively tied together as a (controller, view) pair. Instead, I usually have the view communicate with the model itself and be independent of any controller. Do I have the right approach, or is this a case of there being no one correct answer? Does the answer change when working in the web versus other environments? Does the answer change when you have the concept of a strongly- typed view (like in ASP.NET MVC) or not?


Subclass only have methods without variables

Is it ok to have subclass which does not declare its own variables (instance variables) and inherits from super class or base class? It has methods and there are some common methods which it overides but do not have variables of its own. Is it ok to have subclasses which defines behavior only or I am missing something? I want to divide in subclasses to separate logic of my classes. I have `Medication` class and I want to subclass to `DailyMedication` , `WeeklyMedication` but I have all my instance variable in `Medication` as I do not have any specific for these classes. I want to make subclasses to divide logic as I have too much if conditions in my code.               MedicationEntity     name     dose     weekdays    //in case of daily and monthly this is null      monthdays   //in case of weekly and daily this is null     frequencyType  //Daily or weekly or monthly     etc      EDIT: I want to make subclasses because these all classes have diffrent logic.I have enum of `frequency`(for Daily,Weekly etc) in my `Medication` class and this makes worse as i have to put all the checks in my code for these frequency type as if frequency is that than do that and if daily than do that as now i want to remove these switch conditions. 1)Also please suggest any good idea as weekdays is null if frequency is daily or monthly.But i need to send null to server.So where i can put weekdays if i subclass as it is not null only in case of weekly frequency but as i have to send null to server in request for all other frequencies.Should i put `weekdays` in subclass if yes than how i send null to server if frequency is daily as `DailyMedication` have no information about `weekdays`.


API method placement guidelines?

Are there any guidelines for placing methods in API when the placement isn't obvious? Example: I have classes `A` and `B` and a method `X`. The work being carried out can be phrased in two ways:   1. `A does X with B`   2. `B does X to A` Given the two ways of phrasing this, it's unclear whether `X` belongs in `A` or `B`. **Are there guidelines for placing the method in this scenario?** * * * For a more concrete example, consider think of a user (`A`), an event (`B`) and a sign-up action (`X`). A user can sign up to an event (`A does X with B` ), or an event can add a user to the sign-up list (`B does X to A`).


Property or Method to obtain information about a collection?

Suppose I have a `MyList` class which extends `ObservableCollection<MyObject>` where `MyObject` has the `Boolean` Property `Enabled`. Let's say I want the number of `MyObject` objects that have the Property `Enabled` equal to `true`. Should define this as a Property or a Method? In `MyList` class, should I use:               public int GetNumEnabledMyObjects(){         return this.Count(o => o.Enabled == true);     }      or               public int NumEnabledMyObjects {         get {             return this.Count(o => o.Enabled == true);         }     }      I looked at Properties vs. Methods in MSDN Design Guidelines and I'm leaning towards a method since it might be considered expensive enough.


Return interface or class

Suppose I have a method               public List<User> GetBatchOfUsers(IEnumerable<int> userIDs)     {         List<User> users = new List<User>();              // some database stuff              return users;     }      I have read that it would be better to return an interface (either `IList` or `IEnumerable`) as opposed to returning a `List`. Some arguments I have heard for doing so is that it hides data, and gives the API developer the flexibility of changing the internal representation of the data at a later date. My concern about just returning an `IEnumerable` is that you lose functionality, such as random access and the `Count` property. I know that accepting an `IEnumerable` as a parameter makes sense, as it gives the consumer the best flexibility to send data to my method, the minimalist set of requirements for the method to operate. What is the best practice for the return type?


Solutions to C# 5 async re-entrancy

So, something's been bugging me about the new async support in C# 5: The user presses a button which starts an async operation. The call returns immediately and the message pump starts running again - that's the whole point. So the user can press the button again - causing re-entrancy. What if this is a problem? In the demos I've seen, they disable the button before the `await` call and enable it again afterwards. This seems to me like a very fragile solution in a real-world app. Should we code some sort of state machine that specifies which controls must be disabled for a given set of running operations? Or is there a better way? I'm tempted to just show a modal dialog for the duration of the operation, but this feels a bit like using a sledgehammer. Anyone got any bright ideas, please? * * * EDIT: I think disabling the controls that shouldn't be used while an operation is running is fragile because I think it will quickly become complex when you have a window with many controls on it. I like to keep things simple because it reduces the chance of bugs, both during the initial coding and the subsequent maintenance. What if there is a collection of controls that should be disabled for a particular operation? And what if multiple operations are running concurrently?


What's the difference between WTFPL, CC0, and public domain?

What's the difference between WTFPL (NSFW text), CC0, and public domain? Are they essentially the same thing?


Patterns for maintenance login

Are there any reliable strategies to implement a login mechanism that will allow access to an application for maintenance purposes? Kind of like how some routers have a list of default logins that technicians can use. But the way routers do it is insecure, and I was wondering if there are better ways to implement this sort of access control. EDIT: Here's a possible solution I came up with. Generate a list of passwords for a given time window, say a month, with a different password for every day. This list would exist in the software in encrypted form. Maintenance technicians would have access to this list, and its use would be logged so we know when to block access should unauthorized personnel gets a copy of the list and use it to log in. Periodic updates would renew the application's password table.


Problem regarding DRY principle and Polymorphism

I have a class that is 99% identical to its counter part. Sample code goes below:               public abstract class BaseClass     {         void Method1() { }         void Method2() { }         void Method3() { }         public void MainMethod(List<Object1> listObject)         {             Method1();             Method2();             Method3();             Method4();         }              abstract internal void Method4();          }          public sealed class DerivedClass : BaseClass     {         internal override void Method4()         {             throw new NotImplementedException();         }     }          public class BaseClass2     {         void Method1() { }         void Method2() { }         void Method3() { }         public void MainMethod2(List<Object2> listObject)         {             Method1();             Method2();             Method3();         }          }      As You can see that BaseClass and BaseClass2 are almost identical with Method1 ... Method3. Is there a better alternative that can be used to minimize duplication of code. * * * I initially started this polymorphism as an encouraging stuff, I have over 11 derived classes on BaseClass, and because of the second implementation of MainMethod2, I am stuck with duplication of code. I just cannot think of any clever way to get out of it. * * * **Update:** So this question is potentially containing two parts: **1. How to avoid duplication of code?** I solved this by using Composition successfully as suggested by wonderful answers below. **2. How to avoidleaky abstractions?** With this I am still struggling...


Forcing users to use Javascript

This is more of a business / ethics type of question that incorporates programming principles. So I as a developer will be selling a database driven web application to a local college university. I am currently working on the program and I coming up across a couple issues that would be easily worked with using javascript. Now I know some people do not use javascript at all so I wanted to know would forcing the usage of javascript (for the user interface only not the sites functionality) be wrong in an ethical / professional / business aspect? - I can't really find much information on this. My way of thinking about it is, that since it is a intranet application that the college is actively wanting and understand the features that come with the application it shouldn't be a problem right? * * * I just want to state that currently the app is not intensively javascript, but a lot of things that would be "easier" with javascript or just make the UI look better are not there. I also want to stress that the functionality will be PHP based and not dependent on Jquery.


ASP.NET deployment code?

I have a question regarding uploading an asp.net website to a real web sever. What type of files will be uploaded is it ASP.NET files or is it assemblies? To be more clear if someone got an access to my ftp and downloaded all the files will he be able to edit those files?


When you write wrappers for APIs how do you handle usage errors? Do you assume that the user uses it right and write the wrapper such that it makes the call to the server and let the server return the error? Or do you check for the missing parameters and return an error? If yes, how do you convey the error? a string or an error code?


Technical reason of why you need to use Class::static_method() instead of Class->static_method() in PHP

I'd like to know if there's a technical reason of why PHP's designers decided to invoke a static method using `Class::static_method()` instead of `Class->static_method()` (like any other method). Does the syntax change reflect any technical requirement? I'm asking this because the syntax for every single other language I know to invoke a method is always the same, despite it being static or not.


How to deal with a teammate who rather has his design ideas over good ideas

We have a situation in our team in which one member prefers his own ideas no matter what problems it has. When confronted with issues about a specific design he made - this teammate can get very protective and does not see the problems. In a result, this is a serious Software design issue for our team, because in the end some of the teammate's design will fall through to the end-design, and it will damage our software. Should we confront the teammate about his overall behaviour? Should we go the boss and tell him we can't deal with it and it's hurting our design?


What services exist for finding someone specific to then run your own peer to peer software with?

If you give people peer to peer software (such as a web sockets application if the peer to peer part gets implemented, but could be anything) the first step for some kinds of applications is to find a specific person and try to connect with them. If neither of you has a URI (and knows what it is) you need a third party to handle finding each other and verifying your identities. After that the third party isn't needed because you go peer to peer. I could of course write that third party software and put it up on a website, but then I would have to write that third party software and put it up on a website (or a server that isn't a website if that's how I want to do it). Does anyone offer this service? Ideally as a website and of course ideally free.


DDD – A rookie’s unanswered questions

I’ve decided to use DDD in one of my pet projects to find out what the fuss is about! Let me start off by saying that this (DDD) is the way software SHOULD be written, I’ve seen some strange patterns and conventions but DDD is really the most natural way of writing code. Interesting points that I noted started with DDD:   * I can now dream about code without being reminded of constraints set upon us by databases Persisting data now takes the backseat when developing a complex system (This might come back to bite me)   * I feel a lot closer to the business and business problem at hand   * Discussions between you and the client is now done on their neutral ground   * Discussions between developers are in line with the code   * I learned to love refactoring (You better make peace with that right now) Question 1: Is an entity allowed to make repository calls? For instance, if you need to validate that a certain field is unique in the system, should you write a domain service or can the entity make a call to the repo? Question 2: What is the best practice for validating a new entity? Should you have a Validate() function, or can the validation be done in the constructor? Your thoughts on this?


Job interview for Trainee Programmer, how to increase chances of success?

I have my first programming job interview today (in a few hours!) and would like some advice.      **The job title is Trainee Programmer and it is for a secure printing company.** I have found a lot on the internet about programming interviews, but since this is a Trainee role I have no idea what to expect. I know that the company prefers Java and C#, and I have a little knowledge of them, but my main language is C++. **I would like:** * Some pointers on what to expect from this Trainee interview. * Tips on how to improve my chances.


Is the List interface a leaky abstraction?

If I have a variable containing a `List` it could contain objects of a lot of different types e.g. `ArrayList` or `LinkedList`. The difference between a `LinkedList` and an `ArrayList` is pretty big. The big O behavior of the methods differs greatly. For example sorting the `List` and then using it to do binary searches is perfectly ok for an `ArrayList` but would not make sense with a `LinkedList`.


When to use interfaces (unit testing, IoC?)

I suspect I've made a schoolboy error here, and am looking for clarification. A lot of the classes in my solution (C#) - dare I say the majority - I've ended up writing a corresponding interface for. E.g. an "ICalculator" interface and a "Calculator" class that implements it, even though I'm never likely to replace that calculator with a different implementation. Also, most of these classes reside in the same project as their dependencies - they really only need to be `internal`, but have ended up being `public` as a side- effect of implementing their respective interfaces. I think this practice of creating interfaces for everything stemmed from a few falsehoods:- 1) I originally thought that an interface was necessary to create unit test mocks (I'm using Moq), but I've since discovered that a class can be mocked if its members are `virtual`, and it has a parameterless constructor (correct me if I'm wrong). 2) I originally thought an interface was necessary to register a class with the IoC framework (Castle Windsor), e.g.               Container.Register(Component.For<ICalculator>().ImplementedBy<Calculator>()...      when in fact I could just register the concrete type against itself:               Container.Register(Component.For<Calculator>().ImplementedBy<Calculator>()...      3) Using interfaces, e.g. constructor parameters for dependency injection, results in "loose coupling". So have I gone mad with interfaces?! I'm aware of the scenarios where you would "normally" use an interface, e.g. exposing a public API, or for things like "pluggable" functionality. My solution has a small number of classes that fit such use cases, but I wonder if all the other interfaces are unnecessary, and should be removed? Regarding point 3) above, won't I be violating "loose coupling" if I was to do this? **Edit** :- I'm just having a play with Moq, and it seems to require methods to be _public_ and virtual, and have a _public_ parameterless constructor, in order to be able to mock them. So it looks like I can't have internal classes then?


Github Organization Repositories, Issues, Multiple Developers, and Forking - Best Workflow Practices

A weird title, yes, but I've got a bit of ground to cover I think. We have an organization account on github with private repositories. We want to use github's native issues/pull-requests features (pull requests are basically _exactly_ what we want as far as code reviews and feature discussions). We found the tool hub by defunkt which has a cool little feature of being able to convert an existing issue to a pull request, and automatically associate your current branch with it. I'm wondering if it is best practice to have each developer in the organization fork the organization's repository to do their feature work/bug fixes/etc. This seems like a pretty solid work flow (as, it's basically what _every_ open source project on github does) but we want to be sure that we can track issues and pull requests from ONE source, the organization's repository. So I have a few questions:   1. Is a fork-per-developer approach appropriate in this case? It seems like it could be a little overkill. I'm not sure that we need a fork for every developer, unless we introduce developers who don't have direct push access and need all their code reviewed. In which case, we would want to institute a policy like that, for those developers only. So, which is better? All developers in a single repository, or a fork for everyone?   2. Does anyone have experience with the hub tool, specifically the pull-request feature? If we do a fork-per-developer (or even for less-privileged devs) will the pull-request feature of hub operate on the pull requests from the upstream master repository (the organization's repository?) or does it have different behavior? **EDIT**   I did some testing with issues, forks, and pull requests and found that. If you create an issue on your organization's repository, then fork the repository from your organization to your own github account, do some changes, merge to your fork's master branch. When you try to run `hub -i <issue #>` you get an error, `User is not authorized to modify the issue`. So, apparently that work flow won't work.