title: Why shouldn't classes be designed to be "open"?

text: When reading various Stack Overflow questions and others' code the general consensus of how to design classes is closed. This means that by default in Java and C# everything is private, fields are final, some methods are final, and sometimes classes are even final. The idea behind this is to hide implementation details, which is a very good reason. However with the existence of `protected` in most OOP languages and polymorphism, this doesn't work. Every time I wish to add or change functionality to a class I'm usually hindered by private and final placed everywhere. Here implementation details matter: you're taking the implementation and extending it, knowing full well what the consequences are. However because I can't get access to private and final fields and methods, I have three options:   * Don't extend the class, just work around the problem leading to code that's more complex   * Copy and paste the whole class, killing code reusability   * Fork the project Those aren't good options. Why isn't `protected` used in projects written in languages that support it? Why do some projects explicitly prohibit inheriting from their classes?


title: Approach to learning .NET?

text: After a few years writing good ol' straight, archaic, homely C/C++, I'm finally going to give in and learn .NET. I'm looking for the best way to become .NET-competent quickly. I use VS2005 C/C++ Express and I see there's a CLR choice in the "new project" wizard. I _think_ that must be a way into the world of managed code. Is that a reasonable entry to .NET? Do I have to learn C# or some crazy stuff instead? Or maybe [shudder] CLR is just the first baby step into .NET?


title: Dive into Field of Information Security?

text: For a fresh graduate with quite a bit of development (mainly web) background - what is the easiest way to break into the security field? Are certifications a necessity? Is it possible to get intern jobs doing this kind of stuff? Thanks


title: Where can I obtain the specification for Distributed Relational Database Architecture?

text: I'm developing a DBMS that should be able to connect to IBM DB2 via the DRDA protocol. I found a DRDA reference manual that mentions "DRDA Implementation Programmer's Guide, SC21-9529" as a publication about DRDA, and seems that this manual is exactly what I was looking for. The problem is, I am unable to find it on the net. Where can I obtain this document or another comparable document that explains implementing DRDA?


title: Are Subject specific programming books a good idea

text: I have a friend who is starting graduate studies in a psychology. Part of what he is learning is building testing apps for trials. He purchased a book that was supposed to be vb for psychologists after reading though it I found that it was not a very good programming book and espoused what I think of as bad practices. I instructed him to buy a standard learning vb.net book from a known publisher. So the question is there any good reason why standard methodologies of programming shouldn't be applied to certain disciplines.


title: How Client Side Programming Works

text: I'm not coming from web-development at all, but am looking to build a web application. So far, I've looked into all the server-side stuff (for example, I think my stack will be Linux + node.js + ExpressJS + MongoDB), and have learnt a lot! At this point, I'm comfortable setting up an HTTP server, routing requests, using RESTfull interaction with a database, and serving dynamic HTML using an HTML template engine like ejs or Jade. I even looked into Websockets as a means for establishing a TCP connection to add fast user interaction without page refreshing. Now I'm looking to do pretty stuff; add graphs, tabs, ect to my web- applications! I've looked into things like Dojo, JQuery, CanvasJS, AngularJS ect, and all them seem cool. Problem is, now that I think of it, I have no idea how client-side programming works. For example, in AngularJS I may find something like:                  <head>         <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>         <script src="components.js"></script>       </head>      What is this saying? Does my server actually replace `"components.js"` with the actual `"componennts.js"` code before transmitting the response? What's going on with the `https://ajax...` source? Does the browser, (or the server?) actually have to go to this url, and retrieve code? As I said, as far as I'm concerned, the server responds with an HTML document composed of ASCII characters. What then, is actually running on the client side, and how does it get this code? (i.e. on V8 or whatever).


title: Why do technical/programming phone screens focus on inheritance?

text: I've noticed that in most technical phone screens, programming questions tend to focus on inheritance. For instance:   * If a class is intended to be inherited, what should you do with the destructor? (Answer: make it virtual)   * What's the deal with public/private access?   * What's "protected" for?   * Etc. etc. It strikes me that there are more meaningful questions to ask these days. And, IMHO, reliance on inheritance as the primary design solution to an OO problem is a bit problematic. Am I wrong? Is knowledge of inheritance quirks the best way to assess technical skill? EDIT Commenters have asked me to explain in more detail why I think reliance on OO- based questions is problematic. Let's see... Basically, my thinking is that there are plenty of cool, non-OO questions you could ask. For instance:   * (C++) What's the difference between a map and a multimap?   * (C++) What are the two different kinds of things you can use as template arguments?   * (C#) What's an extension method?   * (Perl) What restrictions, if any, exist on the number of arguments a function can take?   * (Python) What are the different ways you can use import, and what are the consequences of those tactics? I submit that the above questions are also pretty decent weed-out questions. So my question for this forum is: Why don't phone screeners ask questions like those above?


title: Should I create a use case diagram for each screen?

text: In projects with many use cases, it's valid to create different use case diagrams, one for each screen? Or I shouldn't guide myself on the GUI of the software to make this, why? As a clarification, the software does already exist, and I'm just documenting it for my undergraduation final project.


title: Is it necessary to add the default case while using switch cases?

text: During a recent code review I was asked to put `default` cases in all the files wherever `switch` block is used, even if there is nothing to do in `default`. That means I have to put the `default` case and write nothing in it. Is this the right thing to do? What purpose would it serve?


title: josephus revisited - to get execution sequence

text: I was reading this Mathworld page on the Josephus problem: http://mathworld.wolfram.com/JosephusProblem.html from what I understood, once we get the _place in execution sequence_ we can apply _inverse permutation_ (which seems simple) to get the order of execution. But I could not make out how to compute the _place in execution sequence_ , given `n, k` i.e, for `n = 4, k = 2`, how to arrive at `{4, 1, 3, 2}` I am mostly interested in _implementing_ the solution (I've done the usual circular-list based etc), but if there are better ways, I want to try/understand.


title: Is the meaning and usage of the term "ROM" different in different devices?

text: **ROM - Read Only Memory**   Does this term mean _the memory which **should only be read** and not written to_ , **or** _the memory which **can only be read_** ?   "ROM in PC's and laptops are usually seperate chips in the motherboard where BIOS is present (Please correct me if I am wrong) . Can they be overwritten (I guess we can) ?   When we consider an android phone , it gets really confusing . What is the difference between ROM and "internal memory" in an Android phone ? It seems the same .


title: Advantage of monitoring file change using Windows API rather than manually

text: I developed a Windows software about an year ago. Part of it was to monitor few configuration files for manual changes by user and if any of these change restart a particular service. So, I used the simplest approach. I load them as a string in memory and after few seconds, I read the latest file and compare it with the one in memory. Since, the files are very small (less than 500KB), the program doesn't consume much memory. I am using that application since it is developed and have not experienced any performance problem due to that. But, few days ago I noticed that the program ranks at highest for `I/O Read Bytes` in task manager. After few hours of uptime of PC, the `I/O Read Bytes` by this program become significant higher than the rest of processes. So, My question is should I worry about high value of `I/O Read Bytes`. Is this have some downside effect (maybe on Hard Disk) that I am missing. Is implementing the functionality of monitoring file changes using Windows API have some benefits that are worth the effort required to implement it?


title: How to get the most out of an annoying project

text: I was recently assigned a task of managing a small project. The project has some technological aspects but the job is mainly doing managerial things: scheduling, making sure people do what they are suppose to, going to a lot of meetings, etc. Basically, it's not how the average programmer or even a team leader would like to spend his time. Since I am not going to sneak out of this, I have found myself wishing I could teleport myself to some point of time after the project has ended. After pondering about it some more, I reached the conclusion that **I hate working like that** and I can't allow myself to work on a project that makes me think this way. **I have to make the most out of this project.** So my goal is to make the most out of this unwanted project. How do I do that? I thought about writing every day a "What I have learned today" list, that will help me see clearly that I am learning from this and not wasting my skills. Do you have any recommendations on what can I do?


title: How to introduce your team to functional style of coding?

text: I have a situation where most people in my group come from an object oriented programming background with little to no understanding of functional programming. Not even basics like closures. Any suggestions about what might be a good way to introduce them to functional coding style? A lot of coding that we do can be shortened if we do the functional way for our specific cases. I have already given couple of presentations about functional and coding paradigms. Unfortunately we don't use a proper functional programming language like Haskell (basically legacy code is in C, C++, Java) so we have to do whatever is there with these.


title: <<access>> and <<use>> in UML Component diagrams

text: How to decide if have to take the `<<access>>` or `<<use>>` notation for "-->" arrows in Component diagrams written in UML?


title: New grad with my first programming job lined up: What is the advice you wish you had at this stage?

text: I am a new grad with what appears to be my first job lined up (1 solid offer, another place still courting me, so not sure exactly what I will be doing yet). What advice do you wish you had when you started out? In terms of making the best impression? In terms of making sure to get the best reviews? In terms of setting oneself up for the best career growth?


title: Constructing a Deterministic Finite State Automaton for a given Regex

text: I have a couple of exam questions for my compilers class and wanted to check if my solutions are correct. The first question is: > Consider a language in which numbers start with an optional minus sign, > followed by one or more decimal digits, followed by an optional decimal > point. If the number contains a decimal point it is followed by one or more > further decimal digits. Express the syntax of numbers in this language as a > regular expression. And for my answer: > ("-")? ["0"-"9"]+ ("."["0"-"9"]+)? The second question is: > Construct a deterministic ﬁnite state automaton for recognising the numbers > as described in Question 1 And my answer is: ![Diagram of finite automaton](http://i.stack.imgur.com/vfFf8.png) Where state 2,4,5 and 6 are terminals. Are these solutions correct? I am unsure of what the DFA should look like and it's differences to an NFA. Thanks !


Can IndexedDB be used in offline hybrid android apps? I have tried the [example presented in this post,1 while it is working in my laptopn on Google Chrome, it is not working inside the WebView in my android app. The HTML part of the app is loading fine inside the webview but the javaScript part containing all Indexeddb stuff is not getting executed at all. What's wrong?


title: Storing data offline with javascript

text: My question is about storing data offline and potentially whether I will need to bring in an outside programmer or could this be learned within a few weeks? The website I am working on will have an interface where users will login and go through a series of quizzes in the form of checkbox, drop down menus, and others. Each page/quiz area could have 20-100 total checkboxes in a series of 3-5 rows because of the comprehensive nature of course. This I can do - I know how to code the quiz and return a correct or incorrect answer based on each individual checkbox and present a cumulative score (ie: you got 57% correct). The issue lies in the fact that I would like to save the users results and keep them informed of their progress. When they complete all of the quizzes, I would like to have a visual output of their performance in each area. Storing the output from their results offline is where I think I may run into a problem with my lack of coding experience. I would also like to have a sidebar with their progress of each section (10-15) with a green percentage completion bar or a % correct which would draw from this. I have never had to code something that stores information like this offline - so back to my question - would it be better to learn the language needed or bring in a coder/developer for the back end stuff.


title: Fostering a time period where everyone can try any ideas to make software run faster?

text: Sometimes software performance tricks are found from a methodological and thorough search. Sometimes it requires divergent thinking and courage to try crazy ideas. Sometimes an idea is just the beginning that needs to be followed with a lot of hard work. How to foster a time period where everyone can try different ideas to improve the performance of the software we're working on? Everyone on the team has at least several months of experience with the software and are very good at it. Do you agree that divergent thinking will help find ways to improve software performance? Why? Why not? What techniques will enable us to quickly try out an optimization idea? Is fast coding speed necessary for getting good results from the try-out? Finally, how much "time" should be allocated to ensure good results without creating the possibility of slacking off? Is experimentation necessary to prove that "a faster way to do something" exists? (Added 2011-06-07) Related:   * What are your strategies to improve the level of your team in a clever way ?   * When do code hacks become bad? ( **For bounty purpose only** -2011/06/07 the team size is 2-4 developers, no dedicated QA. All code, unit test and performance test done by developers. Because of the nature of the project, profiler result is useful in showing proportional execution time even if it does not reveal a single bottleneck.)


title: Feasibility Study Format on SDLC

text: Is there a specific format for a feasibility study in SDLC? If so, do you know any sources where I can find more information about this? or can you show me at least an outline of what it should contain?


title: Why is there no facility to overload static properties in PHP?

text: ## Intro PHP allows you to overload method calls and property accesses by declaring magic methods in classes. This enables code such as:               class Foo {         public function __get($name) { return 42; }     }          $foo = new Foo;     echo $foo->missingProperty; // prints "42"      Apart from overloading instance properties and methods, since PHP 5.3.0 we can also overload `static` methods calls by overriding the magic method `__callStatic`. ## Something missing What is conspicuously missing from the available functionality is the ability to overload _static properties_ , for example:               echo Foo::$missingProperty; // fatal error: access to undeclared static property      This limitation is clearly documented: > Property overloading only works in object context. These magic methods will > not be triggered in static context. Therefore these methods should not be > declared `static`. As of PHP 5.3.0, a warning is issued if one of the magic > overloading methods is declared `static`. ## But why? My questions are:   1. Is there a technical reason that this functionality is not currently supported? Or perhaps a (shudder) political reason?   2. Have there been any aborted attempts to add this functionality in the past? Most importantly, the question **is not** "how can I have dynamic static properties in userland PHP?". That said, if you know of an especially cute implementation based on `__callStatic` that you want to share then by all means do so.


title: SQL Query helper/builder?

text: We have a flex based front end, that talks via JDBC to some databases.   Part of the GUI has some forms that let the users construct Queries in SQL to pull back records from the database.   However, we get a lot of support tickets that relate to incorrect SQL being tapped in, and a general lack of SQL knowledge so that they struggle with creating queries. It would make more sense if we could have some sort of validation like a SQL Query builder.   Currently we do have a 'Test SQL' command that validates if it returns a valid result from the db, but I would like to take this further and have something that lets you build queries. Has anyone seen any good examples on how to achieve this within a Flex based front-end? (or even non-flex, just to give us some design ideas). Let me know if you need more details via comments. \--Edit--   Just for some background, here is a link to what the GUI currently looks like.   Its a wizard based forms approach, of which entering SQL is a part of: ![enter image description here](http://i.stack.imgur.com/ruHTO.jpg) Id prefer to see more options here for building the SQL with perhaps some sort of 'SQL calculator'? Or open to other suggestions - this also ties in with UX.


title: What Special characters should one allow for a Phone Number?

text: So I am designing a webpage which will be used for global users, includes users from Canada, US, India, UK etc. I need to apply validations for this phone number field, but I'm not sure the best way to go about this. Some of the valid formats I can think of are:   1. 1800123456 (India)   2. use of "-" in US phone numbers I am a bit confused about what special characters I should allow a user to enter (eg.`- / ()`). How have others solved this in the past?


title: Best place to learn Component Object Model

text: I need to learn COM for my current project. I am a noob and I haven't been able to find good starting points for COM. I have been looking into MSDN and googling... I did find some interesting articles on codeproject.com, but I am not satisfied. Why do we use COM ? Why does it exist ? In what places does it exist ? ..... and so on .. So, will you please tell me where can I find answers to these questions ?


title: Deferred Open Source licensing

text: Are there established models for releasing an initially proprietary piece of software under FLOSS conditions after a defined period or a certain point of time? The main problem here is that all parties involved must be able to trust that the Open Source licensing will actually take place at the defined time and no party can further defer or cancel this process. Clearly such a model has its problems, for example it's problematic to deal with contributions from "outside", legally and technically. Ghostscript is a prominent example where a deferred model has been used and abandoned. However, if certain parties involved will insist on keeping the software proprietary, at least for a certain period of time, then the only options are a deferred Open Source licensing model or no Open Source licensing at all. I think I read about services that serve as trusted parties who take care of Open Sourcing the software. However, I was not successful in spotting any of those.


title: What are some concepts people should understand before programming "big" projects?

text: A person new to programming may be able to make a good small program. However, when starting to work on anything bigger than a small (think 1 C source file or Python module) program, there are some general concepts which become much more important when working on "big" (think many Python modules or C files) programs; one example is modularity, another is having a set aim. Some of these may be obvious to people who went to school to learn programming; however, people like me who did not go to programming classes sometimes have to learn these things from experience, possibly creating failed projects in the meantime. ================================================== Please explain what the concept is, and why the concept becomes more important for big programs than by small programs. Please give only 1 concept per answer.


title: Is it a good idea to implement OpenID services in internal and/or customer applications?

text: I've been discussing with my colleges about logging in by using your OpenID account, Google account etc. in our customers CMS and/or the internal systems we use, as we've had a few requests regarding this from both existing customers and new. What are your approaches on this? Is this a bad idea? Especially for our customers, in their customized content management systems? I really think it can be a major security issue, but would a normal login, provided by us, in the reality, be as much of a security risk?


title: Getting non-programmers to understand the development process

text: When starting a project for a company that's not primarily a programming company, one of the expectations is that there's a finished product at the end free of all bugs and does everything needed right away. However, that's rarely the case. What are some ways to manage expectations and explain to non-programmers how software development differs from other types of product development?


title: Programmer student-tutor program

text: I know "hi's" and such are not wanted on questions, but in this case an exception may be made (IMHO). Hi! I am a 16 years old and in my 4/6th year of pre-university education. Programming, math and algorithmics is my hobby and I enjoy it so much I have no doubt I will make it my job. In fact, I enjoy it so much that I spend pretty much all my free time one it, learning fast. However, I stumble upon one big problem: I have no teacher. On my school we have what we call "Informatica" (dutch), computer science in english. The level of this class is very low though, to the point I know more than the teacher. I occasionally buy books on programming, but english is not my mother tongue and sometimes I just waste hours or a day because I'm not familiar with a word (I wasted weeks before I understood the verb "to iterate over", something we don't have in dutch). Another thing is I have to learn everything myself. I had to teach myself what compiling, linking, libraries, including, etc, etc is. That took me **a lot** of time. Thank god there is stackoverflow. When I was completely stuck on something I could ask there and it would usually be solved within an hour. But I get stuck like every hour on something small every proffesional would sigh and shake it's head and explain it within 5 seconds. Now I would love it if there exists some free student-tutor program that assigns you with a _mentor_ or someone that you occasionally can chat/email with (on IRC, MSN, I don't care) asking your questions. So my question, do you know such program? (Or perhaps if you'd like to do it, who knows?) I'm sorry for my english if you spot any mistakes, I learned it all by myself too :) (once again the level of the english class at school is really basic)


title: Google Apps Script pulling user information

text: I am trying to create a spreadsheet that pulls the following information for each of the users in our domain:   * Name   * Email Address   * Mobile Phone Number (Saved in "Mobile")   * Department   * Title   * Extension Number (saved in "Work")   * Google+ Profile Image URL I'm pretty new at scripting and JavaScript so I'm having some trouble with the special, specific fields. I'm using this Google Reference page for help, but I need help with the phone numbers and organizations information. I can pull `user.phones` and `user.organizations`, but all the data that comes together is messy. I also know that I can get the Google+ Profile Image URL by using `profile.image.url` if I define a variable for `PlusDomains`.               function listAllUsers() {         // set spreadsheet       var ss = SpreadsheetApp.getActiveSpreadsheet();            // set sheet       var sheet = ss.getSheets()[0];            // set range       var range = sheet.getRange(3, 1);            // clear range       range.clear();               var pageToken, page;       do {            page = AdminDirectory.Users.list({       domain: 'test.org',       orderBy: 'givenName',       maxResults: 500,       pageToken: pageToken       });      var users = page.users, auserInfo = new Array();           if (users) {       for (var i=0, len=users.length; i<len; i++) {         var user = users[i];         Logger.log('%s (%s)', user.name.fullName, user.primaryEmail);         auserInfo.push([user.name.fullName, user.primaryEmail, user.phones, user.organizations]);       }       } else {       Logger.log('No users found.');       }      pageToken = page.nextPageToken;      } while (pageToken);            // set values to sheet       sheet.getRange(3,1,len,4).setValues(auserInfo);            }


title: Why was Python's popularity so sudden?

text: Python first appeared in 1991, but it was somewhat unknown until 2004, if the TIOBE rankings quantify anything meaningful. What happened? What caused the interest in this 13 year old language to go through the roof? Is there a reason that Python wasn't considered a real competitor to Perl in its first decade of existence? Is there a reason that Python didn't continue in relative obscurity for another ten years? I personally think that Python is a very nice language, and I'm glad that I'm not the only one. But it doesn't have corporate backing or a killer feature that would explain a sudden rise to relevance. Does anyone know the story?


title: What is the general format of a Software Design Specification?

text: I'm trying to document a piece of software I wrote in detail. An SAS is too high level and doesn't cover the API. I found several examples of an SDS online, but I don't see a trend in their format. I'm wondering if there are some general guidelines to writing a Software Design Specification or what the best approach is?


title: Open Source Service Discovery

text: I'm trying to wrap my head around this article on OSS service discovery and I'm having a tough time seeing the forest through the trees. In that article, the author poses the main problem for service discovery: > The problem seems simple at first: How do clients determine the IP and port > for a service that exist on multiple hosts? But I'm not even sure what this means/implies. When talking about service discovery, what exactly are we talking about here? Is this like, if we want to connect to a database, we might need a host and port number defined somewhere, like:               host=mydatabase01.example.com     port=9300      ??? Is this what the author is talking about, and is what is implied by "service discovery"? If so, wouldn't the (obvious) solution be to just put a web service in front of everything? That way, clients don't care about what specific host/port they're connecting to, they just make RESTful calls to, say, `http://my-data- service.example.com`. It can't be this simple, as that article goes on to talk about things like ZooKeeper and Eureka, which seem to be very complex beasts. I'm clearly missing something; if so, can someone provide a specific, **concrete** use case of what is meant when we talk about "service discovery"?


title: Evaluate math expressions without a stack

text: How do you evaluate arbitrary math expressions using temporary variables instead of a stack? What I'm talking about is translating an expression into an array of simple operations- each that change one variable based on the second argument. An example list of operations might be:               =     +=     -=     *=     /=      Notice how each operation changes the first argument. (none of them "return" anything) Here's a simple expression: (I have postfix with depth written under it as well)               x=2+a*(b+c)     x 2 a b c + * + =     0 1 2 3 4 3 2 1 0               x=c     x+=b     x*=a     x+=2      Notice how you don't need temporary variables. Here's an expression that requires a temporary variable:               x=a*(b+c)+d*(e+f)     x a b c + * d e f + * + =     0 1 2 3 2 1 2 3 4 3 2 1 0          x=b     x+=c     x*=a     tmp=e     tmp+=f     tmp*=d     x+=tmp       I can't seem to figure out an algorithmic solution for obtaining these sets of operations. Needing temporary variables seems to have something to do with lower-precedence operators that have the result of higher-precedence operators as arguments, but I can't tell. I feel stupid... The way seems right in front of me but I can't see it. Obviously you could do it the "easy" way; AKA, make a temporary variable to store the result of each operation so no operations are destructive to anything but what you put before the `=`, but that's bad and I don't like it. How can you get the "algorithm" for an expression in simplest form? EDIT: Due to my own ambiguity, I must clarify that a stack is allowed in _translation_ , but not in the end psuedo-language I'm producing.


title: How do you break down a new project with an existing mega PHP site?

text: I've got to dive into a very large PHP site and have my first client meeting today. All they gave me so far was the URL. How do you guys go about gathering/structuring/documenting and preparing for a new project in a PHP environment? What things do you ask for up front? PS - I know there are other general questions about this but I want a PHP- flavored one, including tools (even if universal) and approaches. Thanks!! I'm excited but also scared.


title: How do you manage passwords in your team for db with multiple env and security constraints?

text: I don't want any tools, but more methods to help us manage our passwords. I know this question has been closed, but I think this one, even if it's related, is more a programmers problem than a super user problem. We are using some database schema, each with a password. These schemas exist in our 4 different environments (DEV, TEST, INTEGRATION, UAT) There are corporate rules about passwords, so we need to change them often. Wrong passwords result in locked accounts. This happens quite often and takes countless hours to be solved by dbas... The rules are also quite drastic about how to change a password. No re-use, some word forbidden... The result of this setting is a very often unusable database for our dev. And lots of frustration too. Do you know any 'deterministic' way of creating passwords that can help us to avoid total mess?


title: Where can I learn about how programs handle file systems like NTFS?

text: I'm writing a program to handle the xbox 360's STFS files. I'm encountering all sorts of problems about how to keep track of used vs unused blocks, reading non-sequential files, etc. These aren't so much problems with the structure of STFS - it's just another file structure - but I don't know how I should do certain things. I thought I would find a plethora of information on how file systems like NTFS and Fat32 are read by programs, but I'm only finding resources on how to work with the file systems using pre-made software and not so much how to make such software. Here is a reference for STFS: http://free60.org/STFS


title: On access scans and Visual Studio

text: Where I work McAfee On Access scan is enforced to be on for all our machines. Visual Studio 2010 isn't exactly the speediest program at times but combining a large website, several build configurations and mercurial repository files in a project folder results in a very large number of small files, many of which get scanned when being read or written. I'd like to try and ask our IT department to add some exceptions to help speed VS up but that will likely not be an easy task. What recommendations do you have for the minimum list of exclusions I could give that would give the most noticable improvements?


title: Can you make a build in one step?

text: From the joel test: > Can you make a build in one step? I've got to say I can't. I'm currently working on a web app that has a spreadsheet list of items that must be carried out in order to deploy. So my question is **how can I automate this**? Does it have to be organisation wide? Tips/techniques?


title: How do you KISS?

text: The KISS principle is a highly quoted design mantra. The aim of this principle is to stamp out unnecessary complexity on a project. This is a good thing, saving time, energy and money. It can lead to a relatively stress free implementation and a simple, elegant, maintainable end product. A lot of discussion on KISS provides mechanisms to simplify requirements, design and implementation. Things that spring to mind include: avoid scope creep; simple obvious design and code; minimal run-time dependencies; refactoring to maintain simplicity; etc. However there are a lot of implicit things that we do to KISS. Examples: small team sizes; minimal management layers; tidy desk; mastery of a single IDE; clear concise error messages; scripts to automate/encapsulate tasks; etc What KISS practices do you apply? How have they benefited you? I'm especially interested in non-obvious practices.


title: How is C/C++ more difficult to decompile than C#?

text: See top answer here: _Obfuscation at source-code level more effective than obfuscators?_, specifically "Code it in a language so not easy to decompile such as C/C++" I'm looking to write a new application that will be sold for $500 per license, so I'd like to prevent decompilers. Should C# be avoided, or is using an obfuscator sufficient to prevent this sort of thing?


title: What pitfalls and gotchas commonly occur when beginning with Parallel and Concurrent Programming with C?

text: It roughly three weeks I will be taking a Parallel programming class that is taught using C for the assignments. I have a fairly strong interest in the subject at present and my C skills aren't terrible but I feel like I need to brush up on C as the last class I had that actively required programming in it was 8 months ago. I took an Embedded Systems course in the spring so I understand the concept of deadlock, semaphores and the "shared data" problem. It was primarily iOS programming code wise so my C skills haven't seen loads of use from that context either. If I had to guess as to an area of especially stringent re-study I would select pointers and memory allocation as that seems to be the primary challenge. I believe the class covers MPI and OpenMP so I may take a look at those in advance. Am I on the right track or am I missing something entirely?


title: Introducing new topics to co-workers

text: I've been trying to introduce topics such as unit testing, dependency injection, inversion of control, etc... to co-workers. I've given mini lectures, demonstrations, and have suggested these topics during lunch and learns. Reception has generally been positive and people do see value in such topics. Even though they seem attracted to these topics, adoption has been very low. When I talk to them about it, the answer is generally along the lines of: > I'll try it next time. I just want to get this project out the door. I have a feeling it's because most of what they have seen are just lecture type demonstrations and they do not have any hands-on experience. What can I do to help nudge them along? I don't want to "force" them into writing code if they don't want to, because it may seem like "homework" and it may leave them with a bad impression. Our projects generally do not leave time for experimentation, so people tend to shy away from new technologies. This doesn't leave room for developers to try and incorporate new things during the development phase. Are there any fun or interesting exercises (solo or team) that allows them to have more hands-on experience with these topics? I'm hoping to find something that would peak enough interest so that they are willing to schedule an hour of their day to work on something neat, or peak enough interest so that they'll investigate on their own time.


title: When do you use a class instead of a record when you do not want to use mutable fields?

text: I'm imagining a situation where you are creating an F# module in a purely functional style. This means objects do not have mutable fields and are not modified in place. I'm assuming for simplicity that there is no need to use .NET objects or other kinds of objects. There are two possible ways of implementing an object-oriented kind of solution: the first is to use classes and the second to use records which have fields of functional type, to implement methods. I imagine you'd use classes when you want to use inheritance but that otherwise records would be adequate, if perhaps clumsier to express. Or do you find classes more convenient than records in any case?


title: Chromebook - is it interesting for Programmers?

text: Google announced the chromebook yesterday (11 May 2011). While this is surely a nice thing, I have no clue whether it was interesting to buy one for a (non- javascript)-programmer. What do you think? Will there be, for instance, a Java IDE in the cloud? A command line, even?


title: What is the relationship between the command line, the OS and the microprocessor?

text: I'm not totally clear on how using the command line differs from working through the OS' interface using an editor for example. Obviously the UI is different but I want to understand how the command line interacts with the kernel and microprocessor, and how this compares to how kernel interfaces with the OS' GUI. I know I'm missing several layers of abstraction but would be grateful for someone to explain this.


title: What's the best way to do a Proof of Concept shootout?

text: In preparation for a new release of software our company maintains, I've been working on what I believe to be a really good approach to solving our scalability issues. I have every intention of putting together a proof of concept to validate the design on paper will actually do what I want. When I briefed it to the team, the boss had a counter proposal, inspired in part by the way I described the problem areas. The boss also accepted my proposal to do two proofs of concept to evaluate the alternatives. So, what's the best way to work through the proof of concept shoot out? We have both objective and subjective criteria that we are using to evaluate the solutions. I'd like to make sure we are comparing apples to apples with these fairly different approaches.   * We have requirements for throughput and size. In short, we know we need to process a certain number of objects per second and maintain that rate for an hour.   * We need to evaluate scalability (both by adding more cores and by increasing the number of objects)   * We need to evaluate ease of development (subjective)   * We need to evaluate how easy it is to understand the algorithm (subjective) I have my theory about which way things will lean, but I don't want that to influence my results. Any input on how to maintain objectivity in this process, and things I might need to consider would be greatly appreciated.


title: How do I get people to contribute ideas for my .NET library?

text: I maintain a LGPL library for rapid development of large scale .NET applications, It's a general purpose class library containing functionalities that are used at the DAL and BLL level. So, in practice, it's a library focused towards server-side/middle-tier developers - it doesn't have any shiny or trendy stuff and as such I don't expect it to ever become majorly popular. However, I would really like to expand the library and get more ideas for possibly useful functionalities to add. Larger, more user oriented libraries have a ton of users and a ton of ideas. How do I get more people to contribute ideas for my more _niche_ library?


title: Using CSS classes as decorators - a good pattern?

text: I've been building a web-app with a fairly complex GUI - many small elements alongside eachother and within other elements that need various behaviours (dragging, clicking, but context-sensitive). My code tends to work like this: _controls start out as html tags_               <li>      _then I add classes to the tag_               <li class = 'static passive included'>      _some classes might be for css styling to affect appearance_               .static {background: blue; float: left;}      _while others are acted upon by jQuery to give behaviour for the associated DOM events_               $("#container").delegate(".passive", function {onclick : //do-stuff})      and others might be picked up by normal javascript when scanning the document, eg. collect the text values of all nodes with the 'included' class. So certain DOM elements are GUI objects which implement classes definted through a combination of css and jQuery. My question is, is this a good way to work? And also are these really 'decorators' - they certainly 'add additional responsibilities to an object dynamcially' but I'm not sure about that term. Finally, do you use this pattern in your own sites?


title: Why isn't anyone talking about parallel compilation for .Net?

text: Builds are slow and take time. We can get MSBuild to parallelize them, but only on a single machine, not across a cluster. Why hasn't anyone come up with clustered build solutions in the .Net space? I know such solutions exist in the C++ space (e.g., IncrediBuild, Electric Cloud, etc.) but we .Net developers are forced to build huge solutions on individual machines. Anyone know if there's some unsolvable technical difficulty in this? Just curious.


title: Handling changes to data types and entries in a database migration

text: I'm fully redesigning a site that indexes a number of articles with basic search functionality. The previous site was written about a decade ago, and I'm salvaging about 30,000 entries with data stored in less-than-ideal formats. While I'm moving from MSSQL to MySQL, I don't need to make any "live" changes, so this is not a production-level migration issue so much as a redesign. For instance, dates are stored the same as tags/subjects about the articles, but in strings as "YYYYMMDDd" (the lowercase d stands for "date" in the string). Essentially, before or after I move from the previous database format to a new one, I'm going to need to do a lot of replacement of individual entries. While I understand how to do operations with regular expressions in non-database issues, my database experience isn't robust enough to know the best way to handle this. What is the best (or standard) way to handle major changes like this? Is there an SQL operation I should be looking into? Please let me know if the problem isn't clear--I'm not entirely sure what kind of answer I'm looking for.


title: Which relationship is more natural?

text: Have a quick question on how to best structure something for my Java project: I'm a user. I can work at one or more places. At those workplaces, I have one or more roles. For each of these roles, I work a shift. I either came up with: My workplaces have shifts, my shifts have exactly 1 position (what position did I work when I worked my shift? It varies day to day..) or Workplaces have positions, each position has shifts I think the 2nd is more natural but keep going back and forth / unsure of what has more of an advantage both now and for the future. It's hard for me as I can argue both I guess? Thanks!


title: Best way of validating Class properties

text: ## Background: I have a CSV file, which I need to ready and validate each element in each row and create a collection of a class, having valid data. i.e CSV File looks like:                  EmpID,FirstName,LastName,Salary         1,James,Help,100000         2,Jane,Scott,1000         3,Mary,Fraze,10000      Class looks like:               public class Employees     {         public int EmpID { get; set; }         public string FirstName { get; set; }         public string LastName { get; set; }         public string Salary { get; set; }         public string ErrorReason { get; set; }     }      Here are the validations required for each field:   * EmpID:     * Its a mandatory field, hence cannot be null or empty     * It should be only an integer     * It should be not more than 2 digits     * It should be present in database (query that database and check if an employee exits with this empid.   * FirstName (same validation for LastName):     * Its a mandatory field, hence cannot be null or empty     * It should be only alphabets.     * Not more than 30 characters are allowed    * Salary:     * Its a mandatory field, hence cannot be null or empty     * It should be a decimal.  To achieve this, here is my approach:   1. Read CSV file row by row   2. For each element i.e EmpId, FirstName... etc **do the required validations by calling individual methods having validation logic.** eg: public bool ValidateIsDecimal(string value) { } public bool ValidateIsEmpIdExists(string value) { } etc   3. If valid, fill corresponding property of "Employees" class.   4. If NOT VALID, fill "ErrorReason" property, with appropriate reason as to what caused the validation to fail.(eg: Required filed was missing or datatype is not decimal etc)   5. Add this Class to Employees collection (eg: List) So, my question is, is this the right approach, or is there any other better/cleaner way of validating class properties.


title: Front-end structure of large scale Django project

text: Few days ago, I started to work in new company. Before me, all front-end and backend code was written by one man (oh my...). As you know, Django app contains two main directories for front-end: /static - for static(public) files and /templates - for django templates Now, we have large application with more than 10 different modules like: home, admin, spanel, mobile etc. This is current structure of files and directories: FIRST - /static directory. As u can see, it is mixed directories with some named like modules, some contains global libs. ![static dir](http://i.stack.imgur.com/CPwzo.png) one more: ![static dir second](http://i.stack.imgur.com/LMEED.png) SECOND - /templates directory. Some directories named like module with mixed templates, some depends on new version =), some used only in module, but placed globally. ![templates dir](http://i.stack.imgur.com/pztlm.png) and more: ![templates dir 2](http://i.stack.imgur.com/XNEO6.png) I think, that this is ugly, non-maintable, put-in-stress structure! After some time spend, i suggest to use this scheme, that based on module- structure. ![enter image description here](http://i.stack.imgur.com/tSjPa.png) At first, we have version directories, used for save full project backup, includes: /DEPRECATED directory - for old, unused files and /CURRENT (Active) directory, that contains   production version of project. I think it's right, because we can access to older or newer version files fast and easy. Also, we are saved from broken or wrong dependencies between different versions. Second, in every version we have standalone modules and global module. Every module contains own /static and /templates directories. This structure used to avoid broken or wrong dependencies between different modules, because every module has own js app, css tables and local images. Global module contains all libraries, main stylesheets and images like logos or favicon. I think, this structure is much better to maintain, update, refactoring etc. My question is: How do you think, is this scheme better than current? Can this scheme live, or it is not possible to implement this in Django app?


title: What to do when your company doesn't encrypt passwords

text: **Background** I'm been contracted to help a company maintain their server. I work on some minor PHP projects but also look over performance issues and recently, scan logs for hackers. These guys have been running their server for some time and have what I would call a legacy application on its last legs. It uses magic quotes, global variables (which allows `$id` to be overwritten by `$_GET['id']`), use .htaccess as their only security in some instances, you name it. A security and programming nightmare. We have been hacked in the past, mostly with SQL injections, which would run `SLEEP(99999999)` commands and act as a DOS-attack. Luckily they didn't run "little bobby tables", ![http://xkcd.com/327/](http://i.stack.imgur.com/OSBpv.png) XKCD: http://xkcd.com/327/ So I re-wrote their vulnerable SQL statements from `mysql_query()` (not mysqli) to PDO transactions. I'm also analyzing the queries for `SLEEP` and `UNION`, which we don't use but the injections have. So far, so good. **Latest Issue** Recently we've been told records are changing in the DB for users, such as their e-mail addresses to ones presumably made by spammers. I noticed their columns didn't have a `last_modified` column, so we weren't able to even know when they were being changed, let alone by who. I added that column, but that's barely a first step. When I was looking in to this table, I noticed the passwords weren't salted nor even hashed, just saved as plaintext. **Client Communication** How can I approach them about the entire situation, as a contractor, without flailing my arms like a madman? Any advice? I was thinking a calm approach of,                   ISSUE #1             Synopsis             Why this is an issue             What can happen if this is not fixed             Suggested fix              ISSUE #2             Synopsis             Why this is an issue             What can happen if this is not fixed             Suggested fix


title: Webservics: Rationale behind portType and binding in wsdl

text: In a wsdl we define the operation name, input and output in the portType element; later on in binding we define operation, input and output again. What is the rationale behind this? why define them twice? I understand in binding we define the encodingStyle and other attributes, so what is the need of portType?


title: Is learning different programming languages from different categories good?

text: I have read some posts regarding learning different programming languages or not. Most of the answers indicate that learning more than one programming language increase our horizon as a programmer and we can learn different ways of solving similar problems. However, some also suggest that learning more than one languages of same type doesn't help much. My question is that does it then mean that we should learn different languages but of different categories as well? Should we learn one or all great languages of each category to increase our programming knowhow?


title: Should a method in a class be aware that the class has "loaded" a variable?

text: So I have the following code, which connects and then binds to an LDAP server. The question is in the first method.                 public function getUsers() // This is the method in question       {         if( $this->connect()->bind() ) {           ldap_query(self::$connection) // Here, should it be aware that class succesfully loaded              // the connection, or should the bind() method return the resource?         }       }            public function connect()       {         self::$connection = ldap_connect($this->host);         if( ! self::$connection ) {           throw new \CHttpException(503, 'No se puede establecer una conexión con el servidor '.$this->host);         }         foreach( $this->options as $option => $value ) {           ldap_set_option(self::$connection, constant($option), $value);         }         return $this;       }            public function bind()       {         $ldapbind = ldap_bind(self::$connection, $this->username.'@'.$this->domain, $this->password);         if( ! $ldapbind ) {           throw new \CHttpException(503, 'No se puede enlazar con el servidor: '.ldap_error(self::$connection));         }         return true;       }


title: Is there any way of getting attributes of an audio file?

text: Let's say you have an .mp3 file. A few of the attributes I would like to find out is like the bass, when the bass is loud, quiet, strong, soft and when it is all those things. Is there any way of doing this or is there anything similar to this? EDIT: also I'm not bothered about which code, I'm just interested in what is the easiest way to do this


title: How is C++ in QT different from the standard C++ libraries?

text: I want my app to be able to manipulate images and create watermarks and also needs to run on both windows and mac. Hence I've been investigating QT. Does QT ship with all the libraries I will need to achieve that? or will I have to get other standard C++ libraries? If so is it worth doing the project in QT?


title: Why declare variables close to where they are used?

text: I have heard people say that variables should be declared as close to their usage as possible. I don't understand this. For example, this policy would suggest I should do this:               foreach (var item in veryLongList) {       int whereShouldIBeDeclared = item.Id;       //...     }      But surely this means the overheads of creating a new `int` are incurred on every iteration. Wouldn't it be better to use:               int whereShouldIBeDeclared;     foreach (var item in veryLongList) {       whereShouldIBeDeclared = item.Id;       //...     }      Please could somebody explain?


title: How to talk about anonymous methods/lambdas

text: I realised the other day that I don't know how to talk about anonymous methods. It's easy enough to talk about named methods (`The X method takes a Y1, Y2 and Y3`) and classes (`The X class has A, B and C methods`), but it's harder with anonymous methods. **How does one go about talking (and writing) about them**? From the number of parameters they take, to the types of those parameters to the method signature? * * * For this anonymous method signature, how would you read it aloud?               int -> int -> bool -> double      I would say `"int, int, bool to double"`. What about calling it? How would you read this?               (A ,B) => A*B;      I would say `"A B goes/is to A times B"`.


title: Is Dijkstra's algorithm an appropriate solution to this signal routing problem?

text: I'm in the process of developing a signal management and routing module for an integrated audiovisual system and am designing it with the intent of being as flexible as possible across different signal distribution networks. The intent of the module is to handle routing across a number of stacked matrix switchers1 and handle necessary format conversion. The best solution I've explored at this point is to map out the network to a graph with discrete vertices for each signal type supported by the switchers and which are then joined via nodes representing the video processors that handle format conversion. ![Example graph](http://i.stack.imgur.com/TDXC9.jpg) _Colours represent signal formats._ _Round nodes are either switchers, sources or sinks._ _Square nodes are video processors which perform format conversion._ From there I can use an implementation of Dijkstra's algorithm to identify the path that has to be formed in order to get input X to output Y. This should allow the data about the input / output configuration of all the switchers and processors to be passed in and the module adapt accordingly. Is this an appropriate solution or is there an alternative approach that may be worth investigating? 1 aka 'crossbar switch', a video router with M input x N outputs that supports one-to-many connections. Each phsyical device may handle multiple signal formats and may or may not be capable of performing any format conversion. **edit:** As mentioned by Péter Török, the graph will not necessarily be a tree, the diagram is a simple example to illustrate the idea. When implemented in the 'real world' multiple paths may exist which offer varying levels of definition (DVI > VGA > component > composite) which I was planning to represent with edge weighting. **edit 2:** Here's an slightly more comprehensive example with directivity indicated and showing a network consisting of two signal types. The initial example has been modified slightly so that each input and output on a device is defined as a discrete node as this will provide the data required to control matrix routing / input selection. ![Example 2 - two signal types, stacked switchers](http://i.stack.imgur.com/zcgcs.jpg)


title: Fixing a push to the wrong branch

text: I committed and pushed some changes to the wrong branch. I found a way to fix it, but it seems overly complicated. Is this really the easiest way?   1. on the branch that you made your changes, type `hg parent`   2. run `hg diff -r <parent> -r <with_changes> > patch.diff`   3. `hg up <proper_branch>`   4. `hg import --no-commit patch.diff`   5. `hg ci -m 'committing changes to proper branch'`   6. `hg up <bad_branch>`   7. `hg parent` to find previous changeset on this branch that is good   8. `hg ci --close-branch -m 'closing bad branch'`   9. `hg up <last_good_changeset>`   10. add a space or other minor change   11. `hg ci -m 'making tip'`   12. `hg push` Something to that effect anyway. I did it in a slightly different order; I made the good changeset the tip again, and had to do a force commit because it creates a new head, then had to run               hg heads `hg branch`      To find the bad branch again, then close it. Now it still shows the bad changeset as the "tip" because I closed it _after_ I "re-tipped" the good branch, but when updating to that branch, I guess it takes the most recent non-closed head? Seems like quite a ridiculous process to fix such a simple mistake. Is there any easier way to do this? Why not?


title: Continuous Integration Feedback Cycle

text: How long should the Continuous Integration process take (i.e. compiling classes and running unit tests + integration test)? On my current project it takes about 30 minutes, is that OK? What's the ideal length of build time? Integration tests take most of that time, if the 30 min is too long what can be done here? What's the impact of having the build complete in 30 min?


title: Subscript binding and array categories

text: I am learning "Programming languages principles" and there is a lot of information about stuff which make up a programming language . Unfortunately every material I came across until now has a lot of technical jargon involved and is very difficult to understand (Atleast for a beginner sincerely trying to understand the topic on his own by reading the material) . Can anyone explain me the "Subscript binding and array categories" in general .. The classification says there are five kinds of arrays -   1.Static array   2.Fixed stack-dynamic array   3.Stack dynamic array   4.Fixed heap dynamic array   5.Heap dynamic array This is what I could understand from the definitions (almost on every article on this topic I came across) . **Static array -** subscript ranges are _statically bound_ and storage allocation is static.   I understood that the space for the array is allocated in memory at compile time (before run time) . **Fixed stack-dynamic array -** subscript ranges are _statically bound_ , but the allocation is done at _elaboration time during execution_.   Now I didn't understand anything . What is meaning of the _italicized phrases_ **Stack-dynamic array -** the subscript ranges are _dynamically bound_ , and the storage allocation is dynamic “during execution.” Once bound they remain fixed during the lifetime of the variable.   I dont understand what is meant by being 'bound' ? I should be able to understand the remaining two definitions if I understand these three . I know I am asking a lot .   Thanks :) Here's a link I recently came across which I find useful for this topic . Anyone interested in this topic , check it out . :)


title: Why is accessibility important?

text: It seems to be quite a big thing right now and experience with converting web sites to be more accessible seems to be a common criteria for jobs. My question is, why is it important? Is it a legal issue? Can I get sued if my web site does not comply with some accessibility standard? If so, what law would I be breaking? Is it a moral / ethical issue? Should all people whether they're semi blind or they're using pentium 2's to browse the internet should be entitled to access the right information? Is it a user ability issue? Are there enough users in these minority categories that it's worth investing the time to cater for these users. Is it a maintainability issue? Are applications that are more accessible generally easier to maintain? Or is it something altogether different?


title: Passive ways to learn new technology?

text: Recently, having purchased a smart phone, I discovered podcasts. It's great, cause I spend time commuting and usually that time would be a waste. Admittedly, it's fairly light stuff, mostly news and opinions. I don't think I could concentrate probably if they tried to explain through code samples etc. But I find even just knowing the existence of some new tech or maybe even just recognizing some new jargon is of benefit, at least it gives me a start if I decide to look further into it. What's more, it's enjoyable and easy. So I'm wondering, can anyone think of any other passive ways to learn or know about new technologies that doesn't take much effort and preferably can be done in your "dead" time?


title: Unit of work/repository pattern with dependency injection advice

text: I'm developing a series of repository classes and a UnitOfWork class (plus its IUnitOfWork interface of course). I'm using Castle Windsor, which injects dependencies via constructors. My business tier has classes such as "CustomerBusinessLogic", with methods like RetrieveCustomer, SaveCustomer, etc. These in turn use the UOW to perform the database operations. I'm struggling to find how/where the BLL class should get an instance of the UOW. It doesn't feel right injecting it into the ctr, as a unit of work is exactly that - a unit of work! I think an individual method (LoadCustomer, SaveCustomer) should be responsible for instantiating the UOW for the lifetime of its operation. However doing this means resorting to a service locator, which is an anti-pattern. Suggestions welcome!


title: A new name for unit tests

text: I never used to like unit testing. I always thought it increased the amount of work I had to do.   Turns out, that's only true in terms of the actual number of lines of code you write and furthermore, this is completely offset by the increase in the number of lines of useful code that you can write in an hour with tests and test driven development. Now I love unit tests as they allow me to write useful code, that quite often works first time! (knock on wood) I have found that people are reluctant to do unit tests or start a project with test driven development if they are under strict time-lines or in an environment where others don't do it, so they don't. Kinda like, a cultural refusal to even try. I think one of the most powerful things about unit testing is the confidence that it gives you to undertake refactoring. It also gives new found hope, that I can give my code to someone else to refactor/improve, and if my unit tests still work, I can use the new version of the library that they modified, pretty much, without fear. It's this last aspect of unit testing that I think needs a new name. The unit test is more like a contract of what this code should do now, and in the future.   When I hear the word testing, I think of mice in cages, with multiple experiments done on them to see the effectiveness of a compound. This is not what unit testing is, we're not trying out different code to see what is the most affective approach, we're defining what outputs we expect with what inputs. In the mice example, unit tests are more like the definitions of how the universe will work as opposed to the experiments done on the mice. Am I on crack or does anyone else see this refusal to do testing and do they think it's a similar reason they don't want to do it?   What reasons do you / others give for not testing?   What do you think their motivations are in not unit testing? And as a new name for unit testing that might get over some of the objections, how about jContract? (A bit Java centric I know :), or Unit Contracts?


title: Working machines of developers - in what ways are they usually standardized or restricted?

text: My boss wants to introduce new guidelines for the computers in our company. This means that the software environments will be completely standardized with a predefined set of tools. The goal is that all machines are completely reproducable and exchangable. I'm wondering what the guidelines for developer's computers are in large companies, such as Google or Microsoft, especially companies which are certified according to some standard (e.g. ISO 9001). Do they allow developers to install software from the internet if they need it for some small task? (e.g. a code compare tool, CygWin, Windows Service Packs) or do they really want all needed tools in a fixed, predefined environment where all proposed changes must be discussed with a system administrator first?


title: Managing a website with version control?

text: The small website I built a long time ago is starting to pick up a little and I'm starting to run into problems with making changes. Originally, all the pages were .html and I would edit and test them offline to make sure everything worked. Then I realized how helpful php includes were, so I changed everything to .php and used includes. Without apache, I could no longer test offline, so with Filezilla, I would choose the "view/edit" option on files that were already on the server, edit them, and then have them uploaded again. This is what I've been doing so far and it's worked pretty well for the most part. I just save the temp file that filezilla creates, and let it upload it back to the server. Yesterday, I realized that one of the javascript files I had worked on the day before had been replaced by an empty file. This was something to do with sublime text keeping the non-existent temp file open/filezilla uploading an empty file - I'm not really sure what happened, but it shouldn't have been able to happen. And now, I need to change the design of the site, and doing that one page at a time would be noticeable, so I need to do it offline first. I would like to use version control and install apache so that I can completely test my site offline, but there are a couple problems I have with this. The first is that I have a Forum on the site. I could install mysql and export the tables, then import them offline, but then, while people are making posts on the website, the offline copy becomes out of date and I can no longer upload that back to the server. I also have some Python scripts on the site using WSGI. My webhost's settings are very specific, so if I wrote python scripts offline and ensured they were working, I wouldn't know if they were going to work online. Should I edit everything offline and upload it all back to the server when it works? What happens if a php or python script executes one way on my local machine than on the server?


Does an Open Source license exist that allows me to retain rights to revoke usage of software/source at any time, for any reason, and without warning? I want to allow others to use my software and source code for free but at the same time, I want the ability to revoke rights to usage if I don't agree with the ways that the software and/or source is being used.


title: How I could update a DB table using a POCO class bound in a DataGridView

text: I try to explain better using an example:   * I create the class Product with attibutes like that:              private string _ProductCode = "";     [DisplayName("ProductCode")]     public String ProductCode     {        get { return _ProductCode; }        set { _ProductCode = value; OnPropertyChanged("ProductCode"); }     }        * the class Product implements the interfaces: INotifyPropertyChanged, IEditableObject   * I create the class ProductList that has the following property:              public List<Product> Products { get; set; }        * I bind the class Product in a DataGridView control using the DataSource property              MyGridView.DataSource = ProductList.Products;        * I have the table **ProductListTable** on db SqlServer that has more column than the class **Product**   * When I push the button "Save" on my form I'd would like to save the ProductList on ProductListTable I'm really confusing about the way to follow ... I have to use Link 2 Sql, Entity Framework? I'm searching for something simple for a small project, but using POCO classes for rapresenting the data layer. Now how I should proceed for linking class to DB table?


title: Should I write an integration test that verifies rate limits?

text: This test would call a web service over and over for about a minute to confirm that a particular response code is returned, notifying us of our rate limit being reached. Not only is it a very slow test, it doesn't confirm much of anything, and wastes resources. I feel that this is like confirming that chugging a bottle of vodka will kill a human. Do we really need a test for it?


title: What's a good approach for updating millions of rows independently?

text: I have a MongoDB database with millions of users in collection. An aggregation function returns millions of results with the following format:               Array ( [_id] => Array ( [user] =>       MongoId Object ( [$id] => 52050d48e654f6342c002d42 )         [send] => 1         [open] => 1         [click] => 2 )      Now I need to update corresponding user with the new values (open/send/click) and for each of them add a flag, based on how the values compare with variable X. How would be a good approach to it without looping through results (this means loading GB of data in memory and doing millions of updates/finds) Thanks!


title: Best way of learning Python + GUI when coming from .NET

text: I've been developing applications in **C#** / **VB.NET** for about 3-4 years ( **.NET Framework** v2.0, 3.5, 4). I have also developed some command-line applications or scripts in C, and Python under Linux. Sometimes I need to develop my applications in another languages, like **Python** , but the ~~problem~~ thing is that lots of those applications require a GUI. Maybe not a too complex one, but it does require some windows with _buttons_ , _text boxes_ , _list boxes_ ,... What books/tips/tutorials do you suggest me to start working with that language and be able to deploy my deliverables not only in **.NET**? **Note:**   Learning python is not the big deal here, because I already know the basic of it. I just want to focus on the GUI. _Maybe this question should be onUI instead of here? If so, please, migrate it :)_


title: Why is Quicksort called "Quicksort"?

text: The point of this question is not to debate the merits of this over any other sorting algorithm - certainly there are many other questions that do this. This question is about the name. Why is Quicksort called "Quicksort"? Sure, it's "quick", most of the time, but not always. The possibility of degenerating to O(N^2) is well known. There are various modifications to Quicksort that mitigate this problem, but the ones which bring the worst case down to a guaranteed O(n log n) aren't generally called Quicksort anymore. (e.g. Introsort). I just wonder why of all the well-known sorting algorithms, this is the only one deserving of the name "quick", which describes not how the algorithm works, but how fast it (usually) is. Mergesort is called that because it merges the data. Heapsort is called that because it uses a heap. Introsort gets its name from "Introspective", since it monitors its own performance to decide when to switch from Quicksort to Heapsort. Similarly for all the slower ones - Bubblesort, Insertion sort, Selection sort, etc. They're all named for how they work. The only other exception I can think of is "Bogosort", which is really just a joke that nobody ever actually uses in practice. Why isn't Quicksort called something more descriptive, like "Partition sort" or "Pivot sort", which describe what it actually does? It's not even a case of "got here first". Mergesort was developed 15 years before Quicksort. (1945 and 1960 respectively according to Wikipedia) I guess this is really more of a history question than a programming one. I'm just curious how it got the name - was it just good marketing?


title: Sum of divisors of numbers of the range ~ 10^6

text: I was trying to find the sum of divisors of numbers upto 106. The test cases are like of the order of 105. I have done some pre processing like               int divisors(int num)     {         int sum=0;         for(int i=1; i*i<=num; i++)             sum += (num%i)? 0 : ((i*i==num)? i : i+num/i);         return sum;     }      Is there any better method to do the same. Should I also make an array of prime numbers or something like that?


title: What diagram would be the best to describe the situation

text: I am working on a software integrated with the hardware component. I need to create a simple diagram to express that:   1. Certain activity runs in a cycle (the device continously monitor a temperature)    2. When the temperature deviates from the baseline and remains so for 10 seconds, a function is called I am writing a high level document and I am not sure how to capture this - UML diagrams do not seem to be suitable..but maybe an activity diagram?


title: strategies to keep tabs of memory leaks in non memory-managed languages

text: When it comes to non memory managed languages such as C, C++ or Fortran (my case), it becomes increasingly difficult to keep track of memory allocation/deallocation, especially when ownership must be shared. I implemented refcounting for my objects, but this makes it even more complicated as there's no place where an object gets deallocated. Every reference decrement is a potential deallocation point. So it's now more and more difficult for me to track down memory leaks. I was wondering about some established techniques to deal with memory management in non-memory managed languages, apart from valgrinding your way around. **Edit:** I am more interested in active programming strategies (which are general).


title: Logistics of code reuse (OOP)

text: One of the driving points behind OOP is code reuse. I am curious about the actual logistics of this and how others both in team or solo handle it. For example lets say you have 5 projects you have worked on and between them you have a ton of classes that you think would be useful in other projects. How do you store them? Are they just in the normal project repository or do you break out the relevant classes and have them (as now copies) in another unique source repository that only houses code pieces that are intended to be reused? How do you go about finding or even knowing that there is a good piece of code out there that you should reuse? It's easier if your solo because you remember that you have coded something similar but even then it becomes kind of a stretch. If there is some way that you are storing these pieces of code do you then also have them indexed and searchable by tag or something. I fear that it just boils down to some tribal knowledge that you just know that for situation A i need solution B and we have a good piece of code that already can help here. A bit verbose but I hope you get what I am aiming at. If you think of a better way to make the question clearer please have at it :) TIA!


title: What should I do when my code smells?

text: I'm a novice programmer and often when I'm working on my own projects, I always get the feeling that the design of my code is not the best it could be, and I hate this feeling. I end up spending time looking things up, but then I become overwhelmed easily with many details, such as design patterns to choose from and when to use an abstract class or an interface. Am I supposed to try and learn a little bit of everything at once?


title: What non-theoretical, practical programming language has no reserved keywords?

text: I have been searching for a _practical_ programming language that has no reserved keywords but I haven't had any luck finding one. I am working on a programming language for my own edification and entertainment and I haven't needed to include any keywords yet, that is what led me to my search and the question: I don't see convenience to the compiler writer as being important to the end user of the language. Computers are powerful enough now days to be able to infer meanings from context. No more than a writer needs to label nouns, verbs and such when writing a novel, why should a programmer have to label functions and variables with `function x() {}` or `set x = 1` or `var x = 1` etc; when I can infer from the context of the statements that it is a function declaration or an invocation or that a label is an assignment to a value or a reference to that labels value? Here is a concrete example of what my current parser is doing, no need for reserved keywords to support common things that would normally have a bunch of _noise_ like `func` or `function` or `dec` or what not. _Function Declaration_               sum3(a,b,c) -> a + b + c.      _Function Invocation_               x = sum3(1,2,3).      _Anonymous Function Named x_               x = (a,b,c) -> a + b + c.     y = x(1,2,3).      **I would like to know why are keywords that important to a successful programming language?**


title: Have you worked at a place which did not mandate annual employee evaluations or like?

text: Samuel Culbert thinks that they are evil. http://online.wsj.com/article/SB122426318874844933.html I tend to agree - there is nothing worse than for someone creative (let's assume I am) to be judge on a 5-point system and to be stored away in HR department. However, I am not sure how many companies actually followed his advice. Have you ever worked at a place which never required one?


title: Software license for a publicly funded institution

text: This is probably something that should go to the legal department -- presuming they have any inklings about software licensing -- but what software license should I use against code developed for use at a publicly funded institution (in the UK)? Specifically, it's internal-use code for various university systems. I believe it should be open source -- and feel that the MIT license would be most appropriate -- but I have a feeling that certain proprietary procedures and policies, that might be revealed by the code, _may_ be restricted. ("May" in italics, because I'm not 100% sure: As a publicly funded body, I am under the impression that anything that doesn't conflict with the Data Protection Act 1998 should be made available under the Freedom of Information Act 2000.) This is largely moot, because the source won't be published publicly. (Although, presumably, if anyone requests it, then that's allowed; providing sensitive information is redacted.) However, I'm interested to hear others' thoughts on the matter.


title: Moving business logic from services to classes?

text: I have a Grails application with a number of services that are starting to get very large. The flow in the majority of my service methods is   1. Database read (Returns DBCursor from MongoDB)   2. Iterate through the cursor and perform some operations.   3. Return results from operation. I'm beginning to consider moving the logic in Step 2 out to Groovy classes in order to clean up my code base and allow for unit testing. However reading some guidelines they state that the majority of the logic should go in services. Is moving this logic out to Groovy classes going aghainst best practices?


title: Does Implementing a New Function Imply A New Major Version?

text: I am currently developing a new library for RESTful web requests in Puredata, and am about to release version 1.0.0. This version will not implement all HTTP verbs, only GET, PUT, POST and DELETE. In the next version, this library will most likely include the other HTTP verbs for RESTful requests, PATCH, HEAD, OPTIONS, CONNECT, TRACE. I am using Semantic Versioning for the version numbers. In the specs it says: > Minor version Y (x.Y.z | x > 0) MUST be incremented if new, backwards > compatible functionality is introduced to the public API. It MUST be > incremented if any public API functionality is marked as deprecated. It MAY > be incremented if substantial new functionality or improvements are > introduced within the private code. It MAY include patch level changes. > Patch version MUST be reset to 0 when minor version is incremented. > > Major version X (X.y.z | X > 0) MUST be incremented if any backwards > incompatible changes are introduced to the public API. It MAY include minor > and patch level changes. Patch and minor version MUST be reset to 0 when > major version is incremented. Now, I am unsure what to after implementing the remaining verbs: On the one hand, the functionality is backwards compatible, as the already implemented functionality does not change. On the other hand, the functionality is changing, as issuing a HEAD request will not result in an error message on the console, but in an output. In the first case, only an increase to the minor version is needed, in the second case, the major version must be increased. What is the correct interpretation in this case?


title: Dealing with management that does not see value in improvements that are not immediately visible to the user

text: I can understand schedule pressure. You want to please your users, as they are the lifeblood of the company. However, it is also true that certain changes will make everything easier down the road. Unfortunately, management in my organization has an instinctive resistance to such changes and this resistance is so strong that it gets in the way of long-term improvements. For example, Apple recently introduced Automatic Reference Counting for iOS programs. This is a major improvement over the manual retain/release calls one previously had to use. The code is easier to write and easier to maintain. The changeover itself is likely to produce some crashes. But once those are worked out, the number of random weird crashes is likely to go down. I recently mentioned to my boss that I wanted to switch to automatic reference counting. His response was that he wanted to concentrate on visible improvements. It is likely that this response was in turn driven by pressure he is getting from above him - and probably right from the CEO. There are a lot of similar examples. The common thread is that something needs to be fixed but the short-term costs of the fix outweigh the short-term benefits, where "short term" is defined as "within the next few weeks." How should I handle the situation? EDIT: Thanks for the responses. Keep 'em coming. Because it is relevant to my situation, I should make it clear that my manager and the CEO are both programmers -- though the CEO may by now have forgotten what this is like. Apparently their programmer sides have been overwhelmed by other pressures.


title: Licensing OS code, is it possible to protect certain blocks of code?

text: I'm working on a piece of code which is free to use, but when a license code (or serial key or any other term like that) has been bought will remove some advertising. The code will be freely available as open source, probably under a GPL license, but of course I would rather not have people messing around with the code that verifies the license code with an external provider. Is there any way to legally protect this piece of code from being modified, or at least from being distributed after being modified, keeping the rest of the code "open"?


title: Which commit should close a Github issue when multiple commits are responsible?

text: I want to close issues in Github via my commit messages, but I'm not sure which commit should contain the magic "Closes #XXX" string when multiple commits are responsible for closing the issue. Specifically, I'm wondering if the last commit on my feature branch (always merged with `--no-ff`) should close the issue, or if I should close it via the merge commit that sort of "summarizes" the entire feature branch? Is there a standard way of doing this, something endorsed by the Git community?


title: Using a variable in a Global context in webapps

text: In a webapp, I have a scenario where I need some kind of global context (Static like) for few variables, _for the current thread only_. If there are 3 different concurrent users, then I expect three corresponding global context variable for the 3 separate threads/sessions. Using a Static variable makes its scope global for all the threads. Is there a way in which I can achieve this?


title: Adding new features to an old application

text: I wrote a .NET Windows application using framework 3.5. At that time, 3.5 was very new and I had knowledge of framework 2.0 only. Due to deadline, I didn't use any new features of version 3.5 and delivered the application. There was no time. It is now two years and the app. is running fine, but my clients have requested new features. There is a major scaling needed. The new code that I wrote so far uses many new features of .NET 3.5 and I am concentrating on reducing the new code size. The problem is that the new classes that I want to write are sometimes creating redundant methods for doing the same thing. I am not disturbing the old code. How to manage? If I replace old classes with new ones, it risks functionality and need thorough testing again. If I don't, the project size is increasing.


title: Are "skip deltas" unique to svn?

text: The good folks who created the SVN version control system use a structure they refer to as "skip deltas" to store the revision history of files internally. A revision is stored as a delta against an earlier revision. However, revision N is not necessarily stored as a delta against revision N-1, like this:               0 <- 1 <- 2 <- 3 <- 4 <- 5 <- 6 <- 7 <- 8 <- 9      Instead, revision N is stored as a delta against N-f(N), where f(N) is the greatest power of two that divides N:               0 <- 1    2 <- 3    4 <- 5    6 <- 7     0 <------ 2         4 <------ 6     0 <---------------- 4     0 <------------------------------------ 8 <- 9      (Superficially it looks like a skip list but really it's not that similar - for instance, skip deltas are not interested in supporting insertion in the middle of the list.) You can read more about it here. My question is: Do other systems use skip deltas? Were skip deltas known/used/published before SVN, or did the creators of SVN invent it themselves?


title: Multiple parameters vs single parameter(object with multiple properties)

text: I have an Entity `Student` with following properties - (`name`, `joinedOn`, `birthday`, `age`, `batch`, etc.) and a function `fetchStudents(<params>)`. I want to fetch students based on multiple filters. In my method I have two ways to pass filters.   1. Pass all filters as params to the method   2. Make a class StudentCriteria with filters as fields and then pass the object of this class While working in java I always go with the second option but recently I'm working in php and I was advised to go with the first way. I am unable to figure out which way is better in maintaining the code, reusability and performance wise. Thanks.


title: how to integration dynamic web fields and forms

text: I'm trying to find a way to design backend that will be handling customized web forms creation on the fly. Once created those forms will be injected to part of the existing web pages. I've created dynamic forms successfully but I'm unable to figure out how I can integrate these newly created forms or custom fields into my web pages to handle like posting data to some restful api most probably, or some unified interface that can handle all of the custom forms/fields? I'm using backbonejs for my client side and for dynamic forms I'm using backbone.form plugin to create custom forms and fields on the fly. I'm persisting this on server. I've figured this part after a lot of RnD. I can show these forms and newly added fields to my already built forms on front end using backbone and presisted schema and data. But problem is, there can be multiple forms and many fields; think of it as multi tabs. I need to device a workaround in a way that all of my forms can post data to some unified/common/generalized server route where I can manipulate it.


title: How to store pdf files to MySQL and then list, open them using C#

text: I'm creating a c# employee management system app, I've created a form for Employee files and I don't have any idea how to store pdf files to mysql and then list and open them with c#.


title: Continuous Integration / Deployment: Test on commit, pull request, or what?

text: I read about CI/CD, loved it, but I'm having trouble with the details as everything I read was high level. Some authors seemed to suggest that there couldn't be any failing commits on the repository (or master branch?), so a programmer that is delivering bad code would be stopped and he wouldn't be able to create a big mess. He would be forced into fixing his code so that the tests pass. Others mentioned that the trigger would be the pull requests, not the commits. I haven't used pull requests a lot to be honest, and besides aren't they something external to git? They aren't part of git AFAIK, but part of services like github, bitbucket, etc., so I wasn't sure if I should bind my workflow to something like that. Any thoughts on this will help me greatly. Please also mention which tools you are using, eg: Jenkins, Buildbot, etc. None of the tools I have tried were very friendly IMO. The docs and examples were lacking or tied to certain technologies like java, or services like github. I even considered building my own, it shouldn't be too hard to get the basic functionality. Right?


title: How to create contracts in python

text: I am currently learning Python (from Java) and have a question on contracts. _Example: an application defines an interface that all plugins must implement and then the main application can call it._ In Java:               public interface IPlugin {        public Image modify(Image img);      }           public class MainApp {        public main_app_logic() {           String pluginName = "com.example.myplugin";           IPlugin x = (IPlugin) Class.forName(pluginName);          x.modify(someimg);          }     }      The plugin implements the interface and we use reflection in main app to call it. That way, there's a contract between the main app and the plugin that both can refer to. How does one go about doing something similar in Python? And also, which approach is better? _P.S. I'm not posting this on SO because I'm much more concerned with the philosophy behind the two approaches._


title: Using PDO with MVC

text: I asked this question at stackoverflow and received no response (closed as duplicate with no answer). I'm experimenting with OOP and I have the following basic MVC layout:               class Model {         // do database stuff     }          class View {         public function load($filename, $data = array()) {             if(!empty($data)) {                 extract($data);             }                  require_once('views/header.php');             require_once("views/$filename");             require_once('views/footer.php');         }     }          class Controller {         public $model;         public $view;              function __construct() {             $this->model = new Model();             $this->view = new View();                  // determine what page we're on             $page = isset($_GET['view']) ? $_GET['view'] : 'home';             $this->display($page);         }              public function display($page) {             switch($page) {                 case 'home':                     $this->view->load('home.php');                 break;             }         }     }      These classes are brought together in my setup file:               // start session     session_start();          require_once('Model.php');     require_once('View.php');     require_once('Controller.php');          new Controller();      Now where do I place my database connection code and how do I pass the connection onto the model?               try {         $db = new PDO('mysql:host='.DB_HOST.';dbname='.DB_DATABASE.'', DB_USERNAME, DB_PASSWORD);         $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);     } catch(PDOException $err) {         die($err->getMessage());     }      I've read about Dependency Injection, factories and miscellaneous other design patterns talking about keeping SQL out of the model, but it's all over my head using abstract examples. Can someone please just show me a straight-forward practical example?


title: Is Object Oriented stuff really that important?

text: For years, I have been doing Algorithmic stuff, writing scalable data structures for internet search, for example Randomized Binary Search Trees for Auto Recommendation, BitMaps, Wisdom of Crowd based Algorithms using Graphs, writing some interesting Machine Learning Algorithms like Clustering, Anomaly Detection, working on Information Retrieval stuff and so on There is a common thing in the things that I have mentioned above. All the above stuff;each if coded in a language like C++ requires handful of classes. I mean they are interesting problems but they are not complex in terms of heavily loaded Object Oriented stuff. I have never used Inheritance, virtual stuff etc. Though I have heavily used Generic Programming, Templates and so on. I love C++ (- Bulky OO stuff, As I like what Joe Armstrong's, creator of Erlang says, In OO World if you ask for a banana you get a big jungle alongwith gorilla holding the banana). I enjoy coding in other languages like Java, Python too. Now my question is since I am enjoying the kind of projects/Algorithms I am working on do I need to really learn OO stuff, will I be a better coder/designer just by using the stuff like Inheritance, Dynamic Polymorphism (virtuals)? OR can I move to the world of Functional Programming (I have not done it till now) which attracts me more as I can just focus on tasks/algorithms and not let Kingdom Of Noun based OO stuff, has-a, is-a rule me? In short will/can OO stuff help me at all for the kind of projects/Algorithms that I have mentioned above? EDIT: One extremely interesting link to add here: http://steve-yegge.blogspot.in/2006/03/execution-in-kingdom-of-nouns.html


title: How can a programmer refine their skills in non-visual ways?

text: I feel like when I am not writing, I am reading. When I come home from my programming job I write and read software and about software. The problem is though, both reading and writing requires my eyes to be focused. That doesn't work when I'm biking, cooking shopping for groceries. Sometime I use text-to-speech programs to listen to blogs, but I feel like there could be more. What ways can a software developer learn more without requiring eye focus? How to blind coders learn the craft?


title: What steps should be taken to make sure your software is usable by disabled people?

text: I want to make sure a piece of software I am writing is usable by people with various disabilities such as blindness and an inability to use a mouse and / or keyboard. Unfortunately I have no experience with things such as screen readers or other methods that disabled people use to make using a computer easier / possible. I've never really had much experience with disabilities at all and unfortunately I don't know any disabled people who I can ask. I was wondering what other people do to make sure that their software is available to a wide range of people with varying abilities? This seems to be a subject matter that is often ignored by developers and I think it is a real shame. Edit: If anyone has any specific information related to desktop development in addition to the information already provided in the answers below I would be grateful. Particularly methods that apply to cross platform development on Windows, Mac OS X and Linux.


title: Web Development on Windows but on Linux Environment

text: I do PHP Development on WAMP but sometime it don't work properly when I upload the files to a Linux server, its involve a lot of testing and annoying. I am looking for a solution to do PHP Development on Windows but the files will be sync with Linux Server. I do not want to use SFTP/SSH clients like WinSCP to view or edit files. I was told to look at vagrant, is there any other solution?