title: Why do projects opt to stay on an older version of the .NET Framework?

text: Why do projects opt to stay on an older framework version of the .NET Framework? For example, staying on .NET Framework version 3.5 which was released in 2007 instead of upgrading to the latest 4.5.1 version? Jon Skeet's Noda Time also targets .NET 3.5. Why?


title: when to load partial views

text: When creating a website, when should you load partial view and when should you do a complete page refresh? I was looking at github's site and noticed that pretty much the only place they do partial loading is in a project's folder area. I could see a couple places where they could have but didn't(tab navigation: feed, your actions, ...). But, Google plus does partial loads for search, and clicking on any of the header navigation buttons (pictures, games, circles, ...). Why would you not do partial loading if the main container stays the same and the content is the only thing that is changing?


title: Is there something like Diaspora written in PHP?

text: I am looking for an open source social networking platform. Diaspora is perfect, except it is not written in PHP. Is there a project like Diaspora written in PHP?


title: Software Development - Project, 1 Programmer - What if hit by bus?

text: The company I am currently working for has me developing a bunch of internal mission critical software. I have one other person that works for me but he's more of a testing guy and not really a developer. The company is concerned about some of these projects and what happens if I am hit by a bus. How does the company pick back up after something like that when there is only one person that knows the code base. One person that knows the current status of the project. I explained that with my documentation and with the documentation with in the code that they would really only need to hire another programmer that understands the languages that were used and that they could be up to speed pretty quickly. They suggested an outside firm that might be "kept up to date" on a monthly basis that could "take over" in the event something happened. I just don't see how this could be helpful beyond paying someone for the sake of paying them. Worse I envision a day a month being wasted discussing the project with this consulting firm. I see how this could be helpful I just don't see it as anymore helpful than hiring a programmer after my untimely demise. Thoughts? Similar situation and how its currently being handled where you work?


title: What are the business benefits of Ruby/Rails to tell a client?

text: I'm programming Ruby. I'm programming Rails. It's zen, it makes fun and it's cool. But what are the real technical and foremost business advantages of Rails, I can tell a client? I know the implementation details should be aligned on the requirements of a project. But if I'm honest, if someone says: "Hey, why not using a wordpress and a little bit customized template? It's much cheaper!", I don't have enough good arguments for Rails. Especially for smaller and mid-scale projects. So, what do you tell your clients, when you think they should use Ruby/Rails?


title: Why was Java chosen for Android?

text: Why was Java chosen for Android, instead of something like C++? While I certainly am no expert, I have heard that Java uses quite a lot of memory and I would presume that low memory usage would be quite important on mobile devices. Is there any real advantage to using Java instead of a language like C++ on a mobile device?


title: How do you avoid name similarities between your classes and the native ones?

text: I just ran into an "interesting problem", which I would like your opinion about: I am developing a system and for many reasons (meaning: abstraction, technology independence, etc) we create our own types for exchanging information. For instance: if there is a method which is called SendEmail and is invoked by the business logic, it way have a parameter of type OurCompany.EMailMessage, which is an object which is completely technology independent and contains only "business relevant data" (for instance, no information abut head encoding). Inside the SendEmail function, we get this information from our EMailMEssage object and create a MailMessage (this one is technolgy specific) object so it can be sent over the network. As you can already notice, our class has a very similar name to the "native" language class. The problem is: this is exactly what they are, email messages, so it is hard to find another meaningful name for them. Do you have this problem often? How do you manage it? Edit: @mgkrebbs just commented about using fully qualified names. This is our current approach, but a little bit too verbose, IMHO. I would like something cleaner, if possible.


title: History of Associative Array?

text: In quite a lot of modern scripting languages (e.g. Perl, Python, Ruby, PHP, Lua, JavaScript), associative arrays are supported as a primitive or first- class data type (with various names like map, dictionary, hash, etc.) in a very convenient syntax, making convenient data-driven paradigms possible. Which language first adopted such a design? And how has this design evolved?


title: Filling array with numbers from given range so that sum of adjacent numbers is square number

text: **Problem:** Fill all the cells using distinct numbers from <1,25> set, so that sum of two adjacent cells is a square number. ![enter image description here](http://i.stack.imgur.com/ejYiD.png) (source: http://grymat.im.pwr.wroc.pl/etap1/zad1etp1213.pdf; numbers 20 and 13 have been given) I've already solved this problem analytically and now I would like to approach it using an algorithm. **I would like to know how should I approach these kind of problems in general (not a solution, just a point for me to start).**


title: What is a thread pool?

text: In an interview question a guy was asked to "implement a threadpool"... I've been reading on wikipedia for "threadpool" but I still can't figure out what should a guy do to solve this question (possibly because I didn't quite understand what a threadpool is in simple terms). Can someone explain me in plain english what a threadpool is and how would one answer this question?


title: Good idea to move logic out of SQL statements?

text: I'll preface this question by saying that I am very new to professional software dev. I work on a team that takes data in from other groups in my company and turns this data into reports usable by business execs. In the process of transferring and parsing data we have some SQL statements that do a lot of processing of the data. Nearly every `SELECT` uses `TRIM`, `SUBSTR`, `CAST` etc extensively to reduce fields to the proper size and format. Additionally there are a lot of special cases that are accounted for by using `CASE` statements within `SELECT`'s. The Teradata server software that we use emits remarkably cryptic error messages. As a result we do a lot of guesswork about what data is breaking which SQL statement. **My question is:** would it be a good idea to reduce these somewhat complex SQL statements to a less complex form that omits the processing and special case handling, and instead do this work in an external script or program? Does this make any sense?


title: Is the number of bugs in a section of code proportional to the # of lines ? The square of the # of lines ?

text: Are there any studies that aggregate data over a wide population of contributed code, that establish a correlation between amount of code written in a commit and the # of bugs discovered in that code ? It'd be hard to do in github without knowing whether a change was due to new functionality or a bug, but you could determine a relation between lines of code per commit and how much thrashing eventually goes on in that code.


title: Is a CPU a computer?

text: I read that a computer is made up of the CPU and the memory. I also read that the CPU itself contains a cache which is memory. So if the CPU itself contains the memory, isn't the CPU a computer? Please clarify, thanks. EDIT: I read here: http://www.dwightsilverman.com/future.htm it says: > A processor is, itself, a computer, and they now are small enough that they > are embedded in everything from car engines to toasters. Although these > processors are relatively dumb, designed to do just one thing, smarter > processors that are more versatile also are finding their way into tiny > places.


title: What were the Design Patterns of the procedural programming era?

text: Similar: How was programming done 20 years ago? OOP is quite fashionable nowadays, having its roots in Simula 67 in the 1960s, and later made popular by Smalltalk and C++. We have DRY, SOLID, many books about design patterns in the object-oriented world. _But what were the main principles in programming prior to the OOP paradigm wide adoption? And what were the major design patterns?_


title: What is a good non-technical example of a cumulative error?

text: I'm working on a report which needs to explain in non-technical terms the effects of a cumulative error, and why it is of importance to use absolute calculations. Definition of 'cumulative error' from dictionary.com: > an error that gradually increases in degree or significance during a series > of measurements or calculations; an error that grows during observation Ideally I could give **a real world example** so they grasp the concept of it without knowing about the specifics. The first one I though of is 'Chinese whispers' which is pretty well known, but I wouldn't exactly classify it as 'real world'. Does anybody know of better examples?


title: Why do CSV file formats normally use quoting instead of escaping?

text: There are a lot of variants of the CSV "standard" (or lack thereof). I've never personally see any that use an escape character (like `\`) instead of surrounding each field with double quotes. Instead of `foo,bar,"foo,bar"` it would be `foo,bar,foo\,bar`. This would be handy for situations where a file needs to manually inspected or edited by hand. When counting commas to find the right field, it seems that it would be easier to tell which ones were not field separators if they escaped instead of quoted. I don't see how it would make a difference from a parsing perspective, though. Why quote instead of escape?


title: Full Text Indexing Strategy for MS Excel Documents

text: ### Background As part of a broader application that allows users to search thousands of MS Office documents on a private network, I need to index and make searchable Microsoft Excel files. My basic approach for all document types is this:   1. Loop through the raw directories I have been given,   2. Upload the document to a network share   3. Extract some searchable text from content of the document.   4. Create a new MS SQL record with the name of the document, URL of it's location, and searchable content.   5. Use MS SQL's `Full Text` indexing on the "content" column so that end-users can search key words or phrases via a user interface. ### Problem/Question I am not sure of the most optimum approach for extracting searchable text from Excel docs. My initial thought is to loop through the doc: cell-by-cell and pull out all text and then concatenate that text together into the SQL record, but that seems to be a bad strategy as there could be several cells that are exact duplicates, cells that are only numeric, and generally other types of noise. Is there an established design pattern or strategy for case? Absent that, I welcome and appreciate any suggestions (as will future Stack Exchange users facing the same problem).


title: Is this the correct approach to an OOP design structure in php?

text: I'm converting a procedural based site to an OOP design to allow more easily manageable code in the future and so far have created the following structure:               /classes     /templates     index.php      With these classes:               ConnectDB     Games     System     User     User   -Moderator     User   -Administrator      In the index.php file I have code that detects if any `$_GET` values are posted to determine on which page content to build (it's early so there's only one example and no default):               function __autoload($className) {         require "classes/".strtolower($className).".class.php";     }          $db = new Connect;     $db->connect();          $user = new User();          if(isset($_GET['gameId']))     {                System::buildGame($gameId);     }      This then runs the BuildGame function in the system class which looks like the following and then uses gets in the Game Class to return values, such as `$game->getTitle()` in the template file `template/play.php`:               function buildGame($gameId){              $game = new Game($gameId);         $game->setRatio(900, 600);              require 'templates/play.php';     }      I also have .htaccess so that actual game page url works instead of passing the parameters to index.php Are there any major errors of how I'm setting this up or do I have the general idea of OOP correct?


title: Reconstructing a tree from depth information

text: I have a data structure that describes a tree. Nodes are ordered, with "depth" information, and knowing the order and the depth the tree can be reconstructed. I'm not entirely sure how to describe it so I'm hoping this small example will illustrate it               node #1, depth 0 // parent: none     node #2, depth 1 // parent: #1     node #3, depth 1 // parent: #1     node #4, depth 2 // parent: #3     node #5, depth 1 // parent: #1     node #6, depth 2 // parent: #5      (I added parent information in there for clarification. That's not part of the data structure.) I'm trying to write an algorithm (in JS, if that's any help) that will iterate over each node and build a tree out of the data. I'm fairly recursion is the way to go but beyond that I'm not sure where to start. Any suggestions? Edit: The way I see it, I have four cases:   1. Node has depth 0 (initial case)    2. Node has same depth as previous   3. Node has greater depth as previous (should only be previous.depth+1)   4. Node has less depth than previous Here's my pseudo-JS-code so far:               process (nodes, 0);     process = function(nodes, i) {       cur = nodes[i], prev = nodes[i-1]       if cur.depth = 0 then cur.parent = null  // case #1       else if cur.depth == prev.depth then cur.parent = prev.parent // case #2       else if cur.depth > prev.depth then cur.parent = prev // case #3       else // case #4... here's where I'm stuck.       if i <= nodes.length then process (nodes, i+1)     }


title: What is the difference/ advantage of doing double assignment?

text: Is there any advantage / is it a bad practice in Java to do the below               x = x = 5      I saw it in one of my peers code and I was surprised why he would do double assignment? Is this something that is same as `x = 5` or if `x = x= 5` makes a difference?


title: Overcome clumsiness in writing code

text: I believe this is a little related with this question: How to be a zero-bug programmer?. But I believe this is more regarding clumsiness in programming because I know it is impossible to become a zero bug programmer. Often, I write a very buggy code caused by my own clumsiness. For example in writing a currency rate conversion function, a trivial function. I can code the function that running well given the correct value. But sometime I just forgot to validate some unexpected-but-reasonable values. So are there any ways for clumsy programmer like me to write and test the code more thoroughly? **Additional** I see a lot of people suggesting to write unit test or using TDD approach. But writing unit-test not always goes well because of clumsiness isn't it? I don't because I once tried to write unit-test, but still often bumps with bugs.


title: What techniques should I use when implementing infinite scrolling on a website?

text: I am currently working on a website which implements infinite scrolling on it's search page (the results themselves coming from Elastic search) and, unsurprisingly, the more you scroll the slower things get. This is especially prominent on mobile devices, and in particular lower cost devices (which most people use). We have put a lot of work into making the site responsive on mobile devices from an HTML/CSS perspective, but inevitably as you add more items to the DOM, things slow down. I see that sites like Twitter and Facebook do a good job at avoiding this problem, but how? I am guessing it is some form of DOM garbage collection, and items are loaded not just as you scroll down, but up also, and items not in view are GC'd? Adding to the complexity, we are using the headroom.js library to have the menu needed to alter the search options always available by just scrolling up slightly, and we notice that this action gets slower and more jarred as you scroll down and have more search results to scroll through. Each search result consists of not just text, but an image also. Also, the search results are refreshed without a reload of the page, we use two way binding provided by AngularJS for this purpose (pushing search results into, and popping them out of an array which ng-repeat uses to populate the view), but I suspect that users of other libraries (such as Ember.js) face the same problem. Can somebody elaborate on how we should be approaching this? We have the infinite scrolling aspect (loading more items into the DOM as you scroll) nailed, but on lower end smart phones, things slow down quickly so I am guessing there another aspect to this problem which we have missed. I assume the trick is to only load items into the DOM that the user can see while keeping the scrollbar as is, and responding to scroll events to load the items the user was expecting to see, but how would we go about this? Are there any libraries available for this purpose? Thanks


title: Is there a recommended order to take the Oracle Java EE certification exams?

text: I recently passed the Oracle Certified Professional, Java SE 6 Programmer examination. Now, my boss would like me to take "the next step" to broaden my competence. I tried to explain that there is no equivalent Java EE 6 Programmer examination, but a number of different exams, such as Web Services, Web Components, and Enterprise JavaBeans. Is there a recommended path to follow for the various Oracle certifications in the Enterprise Edition of Java? Is it logical to take some exams prior to taking others because the content builds upon previous knowledge or are they all independent?


title: How many questions are appropriate to ask as an intern?

text: So, I just started an internship, and I'm worried that I'm asking too many questions. My mentor assigns me projects and helps me learn all the company's technologies and methodologies. However, there's so much new material for me to learn while doing this project that I have a lot of questions. I generally ask questions over instant messages or E-mail (those are the primary modes of communication for my company). I'm trying to be careful not to ask too many questions: I don't want to come off as annoying or dumb. How many questions are appropriate to ask? Once an hour? More? Less? Keep in mind, my mentor is also a fellow programmer who has his own responsibilities.


title: How Jetbrain Phpstorm IDE is working without installed java?

text: As far as I know Jetbrains PHPStorm is programmed in Java but while I don't have Java installed in my Windows 7 PC, PHPstorm is installed and working without any problem. How It's done?


title: Advantage of Solr over other DBs?

text: As far as I know, Apache Solr Lucene project is a web-app which is used for rich text searching. I just wanted to know:   * Why can't I use MySQL for that and just for rich text searching, why we use Solr?    * When all the other things can be performed using any DB ?


title: Functional or non-functional requirement?

text: I'm wondering about functional or non-functional requirements. I have found lot of different definitions for those terms and I can't assign some of my requirement to proper category. I'm wondering about requirements that aren't connected with some action or have some additional conditions, for example:   1. On the list of selected devices, device can be repeated.   2. Database must contain at least 100 items   3. Currency of some value must be in USD dollar.   4. Device must have a name and power consumption value in Watts. are those requirements functional or non-functional ?


title: REST API concepts

text: I have three questions about REST API design that I'm hoping someone can shed some light on. I've searched relentlessly for many hours but haven't found answers to my questions anywhere (maybe I just don't know what to search for?). **Question 1** My first question has to do with actions/RPC. I've been developing a REST API for a while and I'm used to thinking of things in terms of collections and resources. However, I've come across a couple cases where the paradigm doesn't seem to apply and I'm wondering if there is a way to reconcile this with the REST paradigm. Specifically, I have a case where modifying a resource causes an email to be generated. However, at a later point the user can specifically indicate that they want to resend the email that was sent earlier. When resending the email no resource is modified. No state is changed. It's simply an action that needs to occur. The action is tied to the specific resource type. Is it appropriate to mix some sort of action call with a resource URI (e.g. `/collection/123?action=resendEmail`)? Would it be better to specify the action and pass the resource id to it (e.g. `/collection/resendEmail?id=123`)? Is this the wrong way to be going about it? Traditionally (at least with HTTP) the action being performed is the request method (GET, POST, PUT, DELETE), but those don't really allow for custom actions with a resource. **Question 2** I use the querystring portion of the URL to filter the set of resources returned when querying a collection (e.g. `/collection?someField=someval`). Within my API controller I then determine what kind of comparison it is going to do with that field and value. I've found this really doesn't work. I need a way to allow the API user to specify the type of comparison they want to perform. The best idea I've come up with so far is to allow the API user to specify it as an appendage to the field name (e.g. `/collection?someField:gte=someval` \- to indicate that it should return resources where `someField` is greater than or equal to (>=) whatever `someval` is. Is this a good idea? A bad idea? If so, why? Is there a better way to allow the user to specify the type of comparison to perform with the given field and value? **Question 3** I often see URI's that look something like `/person/123/dogs` to get the `person`s `dogs`. I generally have avoided something like that because in the end I figure that by creating a URI like that you are actually just accessing a `dogs` collection filtered by a specific `person` ID. It would be equivalent to `/dogs?person=123`. Is there ever really a good reason for a REST URI to be more than two levels deep (`/collection/resource_id`)?


title: How to program for constraints/rules

text: First the background, during interviews in the past, many times I have been asked to design some or other variation of card game as programming puzzle, and I have tried to design it in OO way, but I have never been satisfied with my solutions. However it was not until recently that I realized that I had been approaching the problem from the wrong direction. Specifically I was trying to solve the problem by modeling individual card as an object. Problem with this is individual cards don't have any non-trivial intrinsic behavior and therefore are not suitable (or primary) candidate as objects. What is interesting and important about cards are rules and constraints, such as there could be only four suits, or only thirteen cards in each suit. Of course, then there are any number of rules for games. So my questions are   1. Are there any idioms/constructs/patterns to program for rules & constraints.    2. How many in 1 can be applied in conjunction with OO paradigm.


title: Rewriting code under BSD license

text: I am currently studding OpengGL with OpenGL Supebible 5th edition. I've found interested for me some C++ code that is distributed with the book (see also on google code). That code is under New BSD License. I am writing my software on C# with SharpGL wrapper and I'd like to know following things:   1. Can I rewrite that C++ to C#? **edid:** I'am interesting in using such things like GLBatch, GLShaderManager and some other thing from GLTools. Problem is that library is on C++, but I use C#.   2. How do I have to mark my source code if I put it somewhere like to my github account?    3. What disclaimer should be? Original disclaimer looks like:               /* GLShaderManager.h          Copyright (c) 2009, Richard S. Wright Jr.     All rights reserved.          Redistribution and use in source and binary forms, with or without modification,      are permitted provided that the following conditions are met:          Redistributions of source code must retain the above copyright notice, this list      of conditions and the following disclaimer.          Redistributions in binary form must reproduce the above copyright notice, this list      of conditions and the following disclaimer in the documentation and/or other      materials provided with the distribution.          Neither the name of Richard S. Wright Jr. nor the names of other contributors may be used      to endorse or promote products derived from this software without specific prior      written permission.          THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY      EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES      OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT      SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,      INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED      TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR      BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN      CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN      ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.     */      **Edit:** Should my copyright looks like after rewriting something like that?               Copyright (c) 2014, My Name          Copyright (c) 2009, Richard S. Wright Jr.     All rights reserved.          Redistribution...................


title: Commercial use for embedded system

text: I am developing a embedded system (computer + os + programs) to sell it to a company. I am confused about the licensing and the softwares I wanted to use to develop the system.So I want to know if I can use these programs free of charge and without distributing the source code for commercial use.I wanted to use:   * A linux distro o custom linux build:I thought Arch Linux   * A Web Server + PHP + MySQL: I thought XAMMP,they says that is free of charge for commercial use but I don't know if the components are also.   * A QT backend and frontend,but I don't know if I can use the LGPL version for commercial use or I need to use the Commercial License.   * jQuery (I saw that if I maintain the notice,I can use it) Thanks for your response


title: Prevent 3D model from being copied

text: So I have been messing around with thingiview since I wanted to have a 3D viewer for the models on my site. It works great and everything except one problem. It's nothing wrong with thingiview, it is the fact that since the model is loaded into the browser, that means the model could also be copied. So my question is, is there a way to prevent a 3D model file that is loaded into thingiview, which uses three.js from being copied freely. The only idea I can come up with that is copy proof is to have snapshots generated and then the user could just view the snapshots, but that sucks compared to being able to actually view the file. So any ideas?


title: What discipline does Computer Science belong to?

text: Is Computer Science science, applied mathematics, engineering, art, philosophy? "Other"? To provide background, here is Steven Wartik's blog posting for Scientific American titled "I'm not a real scientist, and that's okay." The article covers some good topics for this question, but it leaves open more than it answers. **If you can think of the discipline, how would computer science fit into its definition?** Should the discipline for Computer Science be based on what _programmers_ do, or what _academics_ do? What kind of answers do you get from people who've seemed to think deeply about this? What reasons do they give?


title: Algorithm for percentage without knowing total number

text: Suppose there are `n` lines for a hotline. Whenever a customer calls the hotline, the call is forwarded to one of the `n` lines. And I want to assign percentage of calling to each of the n lines. Suppose there are two lines and one line is assigned 60% and other is 40%, the total number of calls is 10 so the first line would receive 6 calls and second will get 4 calls. I know the percentage of calling to each line in advance but the problem is that I don't know the number of calls that would be received in a day. **How can I distribute the number of calls without knowing the total calls?**


title: Developing a feature which sole purpose to be taken out?

text: What is the name of the pattern in which individual contributors (programmers/designers) developed an artifact for the sole purpose is to serve as a diversion so that **_management can remove that feature in the final product_**? This is a folklore I heard from an ex-colleague who used to work at a large game development company. At that company, it is well known that middle management is pressurized to "give inputs" and "make changes" to the product otherwise they risk being seen as not contributing to the project. This situation have delayed many projects because of these superfluous "management inputs". In one project at the above company, the artists and developers created a supernumerary animated character that appears in every cutscene and sticks out like a sore thumb. They designed it in such a way that it can be easily removed before the game is shipped (this was when games were still sold in physical media and not a downloadable product). Obviously the management then voted to remove the animation. On the positive side, _management didn't introduced any unnecessary changes that would have delayed the project_ because they have shown that they provided constructive inputs to the product. This **_process pattern_** has a name among game programmers that work in corporates, but I forgot what was the actual name. I believe it's duck- _something_. Anybody can help pointing out the name and perhaps some rather credible reference to how the pattern develops?.


Is there a known standard data structure which is a hash table that resolves collisions using a binary tree? If so what is the name of this data structure? I imagine such a structure would be useful as it should reduce the worst case search time down to O(log(n)) compared to O(n) in a hash table, and the best case would still be O(1).


title: Why do we need URIs for XML namespaces?

text: I am trying to figure out why we need URIs for XML namespaces and I cannot find a purpose for that. Can anyone brighten me a little showing their use on a concrete example? **EDIT:** Ok so for instance: I have this from w3schools               <root     xmlns:h="http://www.w3.org/TR/html4/"      xmlns:f="http://www.w3schools.com/furniture">           <h:table>        <h:tr>          <h:td>Apples</h:td>          <h:td>Bananas</h:td>        </h:tr>      </h:table>           <f:table>        <f:name>African Coffee Table</f:name>        <f:width>80</f:width>        <f:length>120</f:length>      </f:table>           </root>      So what should `http://www.w3schools.com/furniture` hold ?


title: UML class diagram - can aggregated object be part of two aggregated classes?

text: Some sources say that aggregation means that the class owns the object and shares reference. Lets assume an example where a company class holds a list of cars but departments of that company has list of cars used by them.               class Department     {        list<Car> listOfCars;     }          class Company     {        list<Car> listOfCars;        //initialization of the list     }      So in UML class diagram, I would do it like this. But I assume this is not allowed because it would imply that both company and department own the objects..               [COMPANY]<>------[CAR]     [DEPARTMENT]<>---|        //imagine this goes up to the car class


title: Is retaining intermediate objects as member fields a good idea in this case?

text: I'm currently writing a series of classes in java that are meant to translate a regular expression (written with the formal definition, not language- specific shortcuts) into a deterministic finite automaton. To make the DFA, it first converts the regex to postfix, then to a syntax tree, then to an NFA, then finally to the DFA, which is then minimized. Should I keep a reference to each intermediary object as a member of the object it was used to create? e.g. A reference to the syntax tree in the NFA, and a reference to the NFA in the DFA? They're not publicly accessible, so are they just unnecessarily bloating the classes and the program?


title: Quantifying the advantages of a modern version control system

text: I've worked as a team lead/developer in a large financial enterprise environment for the better part of three years. Our production release process is a nightmare because it revolves around Clearcase. We have a change management group who executes all releases and who will only allow code into production that was taken from it. One of the first things I did when joining was to set my team up with Git. Everyone agreed that Clearcase was awful and was impractical for handling day- to-day source control matters. So we set up a sort of "unofficial" repository on my local machine and I wrote a script to sync our git and Clearcase repos around release time. Word of this spread to other teams and several have adopted the same process. Using git in an "unofficial" manner for day-to-day activities and "officially" using Clearcase for releases. I've become sort of the go to guy for any issues with Git. So I have a meeting this week with the SVP in change of infrastructure who specifically wants me to explain to her the merits of Git. Word apparently got to her of my frequent rants on Clearcase. If she accepts my arguments, I will have a real shot at helping my employer rid themselves of this abomination. My experience with executives tells me they a) want extremely terse explanations for everything b) are only interested in facts that involve dollar figures To a developer I can explain the merits of Git over Clearcase (or ANY other version control system over Clearcase for that matter), but I'm drawing a blank on how to do this to a technical executive without a technical background (she has an MBA and did her undergrad in geography). I feel any argument I make to her is either going to sound like technical gibberish or that I'm evangelizing my personal preferences. What I'm trying to find are concrete facts demonstrating developers work more effectively with Git, or ANY modern source control system. I think that the fact the other teams have started using Git internally is a meaningful sign, but it's still not strong enough because it can still be dismissed as personal preference. What I really need is something powerful enough to break through the "This process has worked for 20 years, why should we change it?" argument.


title: Are there areas where TDD provides a high ROI and other areas where the ROI is so low that it is not worth following?

text: Test driven development. I get it, like it. But writing tests does require overhead. So should TDD be used universally throughout the code base, or are there areas where TDD provides a high ROI and other areas where the ROI is so low that it is not worth following.


title: Do you know any studies on relation of productivity of a programmer and the workstation used?

text: I was wondering if there are any studies (formal or not-so-formal) that show correlation between a developer productivity and the workstation used to develop software. It is often heard as argument that the high spec workstations increase the productivity (or the low spec machines impact productivity to the greater extent). To me it sound reasonable, however I'd like to verify the statement with some studies if such exists. Can you help me with that?


title: What process do typical (the majority) of high level language compilers use when changing a source-code's variable name to a machine code name?

text: Do long (very long) variable names slow down the compilation of source code? I'm aware that the length of variables has 0% impact on interpretation as the compiler changes them to machine code which is always the same length. But my question is, does the speed at which the compiler vary depending on the length of variables? For example, if I have a variable name which is a million characters long, surely the compiler would struggle as for it to recognise the variable **is** a variable, it would need to read the entire thing first which would surely take longer depending on its size? To clarify, what process do typical (the majority) of high level language compilers use when changing a source-code's variable name to a machine code name? Do they find the start of the variable working from the left and then find the end working from the right, do they read through the entire variable name (one character at a time) until the end is found or do they not even look at the variable name at all and just know that the code requires a variable of type int (for example) and assign it a machine-level name instantly and then completely ignore any user-defined variable names? Note that I am a complete novice (still a student) so excuse my ignorance if I get my terms mixed up.


title: How to motivate team for knowledge sharing sessions

text: I work in a team with wide range of expertise and experience. I have been trying to introduce weekly knowledge sharing sessions. Sessions of 30-60 min length where everybody gets a chance to present something and talk about it. This will contribute in improving presentational and language skills. However, the team is not motivated towards this, either the attendance is too low or none. How to get a team work towards such an idea?


title: Sequence diagram should consist of View objects, DB objects, etc.?

text: I read many articles, and saw a lot of images and I can't answer the question whether objects of View classes or DB classes should be contained on the sequence diagram or it should be more generalized?


title: Should I create inner class here or leave as is?

text: Folks, I have two separate classes. One of them makes http requests/receives response to/from a server and the second one converts received JSON objects into my models (separate classes). I'm thinking it would be an idea to include this class for data converting as an inner class of my first class. Wouldn't my first class be extra big because of it and I need to leave everything as is or this is a good common practice to behave like that?


title: Where are the next-next-generation editors?

text: I was reading an old Coding Horror article about indentation, when I read this: > Or, maybe you're using a next-next-generation editor that treats code as > "data" and the layout (including whitespace) as a "view", making all these > concerns largely irrelevant. Exactly what next-next-generation editors was Jeff Atwood referring to?


title: How do you ascertain the quality of a potential employer's code before you take a position?

text: In my experience before you start working for a company you have no opportunity to look at the code-base (I've asked and for reasons of confidentiality everyone has always said no, I think that is fair), so during the interview process what do you think are the most important questions to ask to find out what kind of state the code is in (after all, if it's a dog, then you are going to be on of the poor unfortunates who has to walk it every day)? **UPDATE:** A check-list: Ask;   * What _they_ think of the codebase. And when you do, pay close attention to facial expressions and the time it takes for them to respond. [Anon]   * What is the company's CMM level [DPD] (and if you hear Level 5 run the other way [Doug T])   * What lifecycle they use [DPD] (And if you do hear "Agile", that's when you start asking some penetrating questions to try to figure out if by "Agile" they mean "Agile or "cowboy coding" [Carson63000])   * What tools they use to asses code quality? [DPD]   * What tools they use for development? [DPD] (Look for refactoring tools and continuous build servers)   * What source code (version control) system they use, and a good follow up is to ask why they use it. [Zachary K].   * What are their testing procedures like? [Karl Bielefeldt] (Look especially for teams that use mocking frameworks and place an emphasis on thorough automated unit testing through established frameworks like NUnit / JUnit; don't be put off by teams that don't use test driven development TDD, but be wary if they don't consider testing to be integral to and the cornerstone of solid software development. Look for teams with dedicated testers.)   * What kinds of assignments are given to new developers? To experienced developers? [Karl Bielefeldt]   * How many people work on a project? [Karl Bielefeldt]   * Is refactoring allowed? Encouraged? [Karl Bielefeldt]   * What quality-related process or architecture changes are under consideration or have been made recently? [Karl Bielefeldt]   * How much autonomy do individuals have over their modules? [Karl Bielefeldt]   * Will you be developing newer projects (greenfield development) or legacy projects (brownfield development)? (Greenfield development is generally more fun and has less problems as you aren't cleaning up with someone else's mistakes).   * Is the employee turnover rate is high in the organization or the team? (This often indicates lower quality of code) [M.Sameer]   * Some programming problems of your own; but avoid seeming like a jerk. [Sparky]   * How do the developers collaborate and how is knowledge shared amongst the team? (This should match your personality; I would say a mixture of solo and pair work is probably best, with the ratio matching your social needs)   * How close their database is to 3rd Normal Form (3NF), and if it deviates where and why? (If they say "3NF???", leave. If not, and there might be good reasons for it not, then find out what they are). **NOTE:** I've accepted Anon's answer because after about a week the community thinks that it is the best one - I think this suggests that it is just something that you somehow need to develop a sixth-sense for. But, I think everyone has had something valuable to say.


title: How does freelance job operate?

text: I want to find a freelance job, but I've never done any freelance work before. I want to know what the process involves. Can you please answer the following questions?   1. If the programmer finds a suitable freelance job, how can they apply, and how will the future employer evaluate the programmer's abilities?   2. How does the programmer deliver their work?   3. How does the programmer receive money? What if the employer and the employee are in different countries? How do they pay?   4. Do you really read the agreement when signing an account on a freelance website?   5. Any pitfalls? Under what circumstances will the employer not pay after the work is done?


title: Multi MVC processing vs Single MVC process

text: I've worked fairly extensively with the MVC framework cakephp, however I'm finding that I would rather have my pages driven by the multiple MVC than by just one MVC. My reason is primarily to maintain an a more DRY principle. In CakePHP MVC: you call a URL which calls a single MVC, which then calls the layout. What I want is: you call a URL, it processes a layout, which then calls multiple MVC's per component/block of html on the page. When you compare JavaScript components, AJAX, and server side HTML rendering, it seems the most consistent method for building pages is through blocks of components or HTML views. That way, the view block could be situated either on the server or the client. This is technically my ONLY disagreement with the MVC model. Outside of this, IMHO MVC rocks! My question is: What other RAD frameworks follow the same principles as MVC but are driven rather by the View side of MVC? I've looked at Django and Ruby on Rails, yet they seems to be more Controller driven. Lift/Scala appears to be somewhat of a good fit, but i'm interested to see what others exist.


title: Education vs. Experience

text: I'm going through a rough time. I'm a CS student at UIUC, which I hear is one of the top schools for CS. I love computers and programming. I've been pretty much doing it my whole life. I'm a freshmen now (junior in actuality, but I was premed before I switched to CS-long story). I'm finding the cirriculum pretty hard and challenging, but of course this way you learn so much. Due to the challenging nature of this program, especially at this school, I dont always get the top scores, while others seem to have no problem. I get discouraged quickly, and say to myself something like "whatever, I know even if I dont finish this program, I will find a way to make it on my own". Of course, I only say this to make myself feel better about my situation. But I really want to graduate from here and get this degree, but I find myself losing more and more motivation by the day. For those of you that graduated with a CS degree, any tips on how to get through this? Also, what are the benefits of a CS degree? I heard that I wont even use half the stuff I learn here. Why cant I just learn programming on my own by reading books. Most companies love experience. What does it come down to at the end? Of course I would love having this degree, but getting through it is gonna be a challenge.


title: We're Subversion Geeks and we want to know the benefits of Mercurial

text: Having read I'm a Subversion geek, why should I consider or not consider Mercurial or Git or any other DVCS. I have a related follow up question. I read that question and read the recommended links and videos and I see the benefits but I don't see the overall mindshift people are talking about. Our team is of 8-10 developers that work on one large code base consisting of 60 projects. We use Subversion and have a main trunk. When a developer starts a new Fogbugz case they create a svn branch, do the work on the branch and when they're done they merge back to the trunk. Occasionally they may stay on the branch for an extended time and merge the trunk to the branch to pick up the changes. When I watched Linus talk about people creating a branch and never doing it again, that's not us at all. We create probably 50-100 branches a week without issue. The biggest challenge is the merging but we've gotten pretty good at that as well. I tend to merge by fogbugz case & checkin rather than the entire root of the branch. We never work remotely and we never make branches off of branches. If you're the only one working in that section of the code base then the merge to the trunk goes smoothly. If someone else had modified the same section of code then the merge can get messy and you might need to do some surgery. Conflicts are conflicts, I don't see how any system could get it right most of the time unless if was smart enough to understand the code. After creating a branch the following checkout of 60k+ files takes some time but that would be an issue with any source control system we'd use. Is there some benefit of any DVCS that we're not seeing that would be of great help to us?


title: Questions to ask to ensure someone understands programming? (and iOS)

text: So, I've been tutoring my friend for 2 years. Most people learn programming on their own in 3-6 months, (sans algorithms). It's confusing 'cause he'll run anywhere I tell him to, understands how to read C and C++ honestly better than the average college student, and he'll modify and repeat anything I do... but for the love of god he doesn't move on to new things and he still has test anxiety. I've recently realized he's copied and toyed with existing, but not once gained an understanding of why. I was under the impression he was learning fast because he could write it, but when you say "Make a function that takes an NSString" and he says "How?" and I say "The same way you make ANY function that takes any parameter, NSString is just a type like int" and all I hear is "No, it's an NSString, it's a special thing." and we get into an arguing match 'cause I'm like "It's just a class like any other class, you've used them for months now" and blah... I've subconsciously avoided comprehension questions because of this. Anyway, if you have him copy a program and say "Just initialize it" "Where?" "I don't care, didLoad or initWithCoder or Awake from nib, anywhere it gets initialized" and "No, it has to be exactly where you had it!" "No it doesn't!" I'm sick of this, but he won't give up. So I'm done avoiding these yelling matches and becoming a sadist from now on. I would like some help in finding questions to ask him that force him to understand what he's doing. I'd like some help and any resources I can find. CQuestions looked like a good site, but now I need some iPhone stuff. For example: *What do properties do? How are they changed? How do you change the name of the getter? *Why are Booleans inefficent? What advantage does int have over a boolean and how does the bit-shift operator help? *What does Copy do to a string? *What's the difference between a view controller and a uiview? *Write a program from memory that displays blah on screen, and flashes each view one by one. From beginner up to intermediate, hobbyist with some algebra at most. I'm just looking for resources to work with. I left in backstory so you know to "twist" the questions so he doesn't know he's supposed to init a variable here or there, but has to figure it out, and learn why it goes "here" or that "anywhere is fine as long as it's". Sample programs, anything. I'm relatively open about this because, being a programmer, I seriously doubt he's the only one who has this issue. I'd like to know how others have overcome similar. What made things "click"? for you? Did you have a hard time finding answers on Google, and how did you learn a better way to find what you were looking for? (He's so exact, he'll search for how to write a checkers program with color X and Y inside a uiview, as his search string, instead of breaking it up into components, I need help with that too, and believe it is related). This type of problem has to remind one of us of someone they know. So, Exercises to force them to think? Ways we overcame this thing in the past? I greatly appreciate any help.


title: What do you do when a client requires Rich Text Editing on their website?

text: As we all know by now, XSS attacks are dangerous and really easy to pull off. Various frameworks make it easy to encode HTML, like ASP.NET MVC does: > `<%= Html.Encode("string"); %>` But what happens when your client requires that they be able to upload their content directly from a Microsoft Word document? Here's the scenario: People can copy and paste content from Microsoft word into a WYSIWYG editor (in this case tinyMCE), and then that information is posted to a web page. The website is public, but only members of that organization will have access to post information to a webpage. What is the best way to handle this requirement? Currently there is no checking done on what the client posts (since only 'trusted' users can post), but I'm not particularly happy with that and would like to lock it down further in case an account is hacked. The platform in question is ASP.NET MVC. The only conceptual method that I'm aware of that meets these requirements is to whitelist HTML tags and let those pass through. Is there another way? If not, is the best way to let them store it in the Database in any form, but only display it properly encoded and stripped of bad tags? > **NB** : The questions differ in that he only assumes there's one way. I'm > also asking the following questions:   >  1\. Is there a better way that doesn't rely on HTML Whitelists?   >  2\. Is there a better way that relies on a different view engine?   >  3\. Is there a WYSIWYG editor that includes the ability to whitelist on the > fly?   >  4\. Should I even worry about this since it will only be for 'private > posting' (Much in the same way that a private blog allows HTML From the > author, but since only he can post, it's not an issue)?   > **Edit #2** : > If suggesting a WYSIWYG editor, it must be free (as in speech, or as in > beer). **Update** : All of the suggestions thus far revolve around a specific Rich Text Editor to use: Only provide an editor as a suggestion if it allows for sanitization of HTML tags; and it fulfills the requirement of accepting pasted documents from a WYSIWYG Editor like Microsoft Word. There are three methods that I know of: 1\. Not allow HTML. 2\. Allow HTML, but sanitize it 3\. Find a Rich Text Editor that sanitizes and allows HTML. The previous questions remain (1-4 above). * * * ### Related Question > Preventing Cross Site Scripting (XSS)


title: Should strategy objects have state?

text: I have an application object that needs to validate some data. The particular validation algorithm isn't known until runtime, so I pass a validation object to it, using the strategy pattern. The application might need to reuse the validation object; for example, it might need to perform two validations simultaneously. So ideally, the validation object wouldn't contain any state; it would be purely an algorithm. But what if the validation algorithm itself needs some state? For example, it might need to keep a list of validation errors. What's a good approach in this situation? It seems like overkill to create a factory just for this specific validation object. (Assume this is in a language like Java or PHP.)


title: Will hosting documents on AWS reduce our load?

text: Due to partnerships, we are required to host our website through our partner company. However, we had an idea that perhaps we could offload the document storage to an AWS document server. The thinking is that we could serve the html from our server, and serve any large document files from the AWS server, which would greatly reduce our bandwidth load. Having never used AWS, can I simply provide a relatively secure AWS URL to the browser which will pull the document from AWS and bypass our web server altogether?


title: Micro-services and data replication

text: I am building a new application and was reading about micro-services architecture. The architecture itself makes lot of sense from a development, deployment and life cycle management point of view. However one issue that came up was with regards to how to handle master data. For example, I have 2 apps - say Sales app and a Ticketing app. Assume that both of these apps are built as own micro-services. However both of these apps, when deployed (assuming that they are deployed separately say Sales uses MongoDB and Ticketing uses MariaDB), would need to have access to the same master data instances e.g. Accounts, Products. This would mean that there would be a owner app for a given master data entity (e.g. for Accounts it might be the Sales app) and an interested party (e.g. Ticketing app would need to have information about Accounts). There are multiple ways in which this can be achieved: \- Data replication from master to interested party \- Synchronous read from interested party to master (sync dependency is not recommended by the micro-services architecture paradigm) \- Own centralized repository Also even within Accounts, there can be a core part which is common for both Sales and Ticketing (e.g. account name, address etc.). However some aspects of the Account might ONLY be relevant for Sales and others ONLY relevant for Ticketing. Any thoughts / best-practices / opinions regarding any of the above mentioned options ?


title: Best Version Control Habits For Solo Developer?

text: I'm a sole developer at my work and while I understand the benefits of VCS; I find it hard to stick to good practices. At the moment I'm using git to develop mostly web apps (which will never be open sourced due to my work). My current workflow is make lots of changes to the development site, test, revise, test, be happy and commit changes, and then push the commit to the live site (so if I'm working on a big new change; I may only commit once a week; but my IDE has a good undo history for uncommitted stuff). Basically, I'm only using git when switching between machines (e.g., work dev computer to home dev computer or to live machine), but during the day I don't really see the benefit. This leads me to have long laundry lists of changes (and I have trouble finding good msg for each commit; and whenever I'm in a rush - I tend to leave crappy messages like 'misc changes to admin and templates'). How often should I be committing? Should each one-line change get a commit? Should I commit before any test (e.g., at least for syntax/compiling errors and then have to totally undo it; as the idea didn't work or the message is a lie)? Should I make sure I commit each morning/afternoon before I stop working for dinner while its still fresh? What I am missing out on by having bad VCS habits?


title: What to look for in Startup employees

text: I am an engineer but don't have a computer science background. I am proficient with Python, Django, use Mongo and know a bit of C++ / C#. Dabble with NGinx here and there. My weekend project, a nifty webapp, just saw explosive growth. And am looking to expand the team. What should I look for in potential hires beyond the obvious (code samples etc) ? Should I hire someone who wears many hats and bigger pay or break it up into smaller roles?


title: Jumping around to work on different features when you get stuck, is it a source of project failures?

text: On personal projects (or work), if one gets stuck on a problem, or waiting to figure out a solution to the problem, if you jump to another section of your code, don't you think it will be a good reason your application will be buggy or worse yet never get completed? Assuming you are not using git and code each feature to a specific branch, things can get out of hand since you have 3 different features you are working on, and you have unresolved issues in each. So when you get done to work, you get stressed out because you have these hanging issues and half-baked code lingering about. What's the best way to avoid this problem? (if you have it) I'm guessing using something like git and creating a branch per feature is the safest way to avoid this bad habit. Any other suggestions?


title: Should use of VSS be a dealbreaker in an employment offer?

text: I've been reading some of the horror stories about VSS recently, and it seems like a poor choice for anyone to continue to use. This is sort of a two-part question:   * Are there any objectively good reasons to use VSS?   * If not, should it be a dealbreaker for employment? I only have personal experience with one company presently using VSS (in my pre-developer days, so I didn't use it), and the culture there was extremely reactionary and adverse to change. I don't want to project my experience with this company on other organizations if there are legitimate reasons for using VSS these days, but I can't think of any reason other than being stuck in a rut that a place would use VSS 7+ years after support was dropped when it seems that there are relatively painless migration options.


title: Testing activities carried out in an OO development project

text: Does anyone know the testing activities carried out in an Object-Oriented development project that uses an incremental approach to development and delivery?


title: What kind of JavaScript design pattern is that?

text: In our workplace we use simple ajax library for getting page data and submitting changes to server ,on certain occasions we do need to change the forms fields values ,now we know that fields can be of any type (dropdown , textbox and radiobuttons etc) and one of the most annoying and tedious task I find was remembering various fields id so could do the manipulation (the task can exceed for few days,so I had to keep the ids in notepad) ,then I made this design pattern for easy working with the fields.                function FormFieldsManager() {                 var FormMgr = {                     txtGradeName: function (txt) {                         if (txt) {                             $('#txtGradeName').val(txt);                         }                         else {                             return $('#txtGradeName').val();                         }                     },                     txtGradeDesc: function (txt) {                         if (txt) {                             $('#txtGradeDesc').text(txt);                         }                         else {                             return $('#txtGradeDesc').text();                         }                     },                     ddStatus: function (txt) {                         if (txt) {                             if (isNaN(txt)) {                                 $("#ddStatus").val(txt);                             }                             else {                                 $("#ddStatus")[0].selectedIndex = txt;                             }                         }                         else {                             return $('#ddStatus :selected').val();//selected value: A                         }                     }                 };             return FormMgr;             };      In order to use that function,I just call the method and I could navigate the form fields and I get full JavaScript intellisense.               var form = FormFieldsManager();     form.txtGradeName('Software Developer');//to set the field value     form.txtGradeName();//to get the field value      **So my questions are,**   1. What specific design pattern is this?   2. What suggestion for improvement you guys can give? **PS:** I like to call it jsPageObject :)


title: How does API design differ from general web application development design?

text: If I was working on a web application designing and writing an API how does that differ from a general web application development? What things would I need to consider and take into account? Are there any standard processes to follow when creating an API that could be used by thousands of clients?


title: How to select drawing system when requirements not yet known?

text: We're developping an application for 2D data processing and display. At the moment data is displayed by converting each point to a color depending on intensity, so in rather low level code. This works well. A new feature is displaying a grid and a bunch of lines that can be moved with the mouse on that image. As usual when new technologies are going to be picked, I made a little demo to test some things out: using the current data plot, a line is drawn on top that can be moved up/down with the mouse, and at the same time there is text displaying the cursor coordinates. I tried some different ways: using a Canvas, using a somehwat lower level DrawingContext and using the low level WriteableBitmapEx api. To me, there was no real difference in ease of coding nor display speed. Yes the Canvas option had a couple of lines less code than the others, while I had the impression the lower level options were somewhat faster to display. But no huge differenes making me pick one immediately. So the problem now is: I have no idea how to select the most suitable system for the job, but it is a very important decision to make since the graphical part of the app will likely continue to grow. Needless to say it would be a small disaster if we pick A now, and in one year we figure out B would have been way better. Normally I'd select the fastest or most convenient option, or look at future requirements and use the system that seems to fit best, but in this case there is simply not enough difference, and future requirements are not exactly known: for now we think it's sufficient if we can draw lines, circles and some text, and update speed is not that important. However the application is in it's early stage, so is the underlying hardware and there are less than 100 customers. That however, might change rapidly. And so can requirements. Question is simple: what to do? Some options I've been thinkig about:   * pick one that 'feels' best (WriteableBitmapEx but probably just because I have an affinity with lowlevel stuff)   * pick the one with the least amount of code (Canvas, also seems very easy on the UI level with effects and mouse events and what not)   * make a more extensive demo so differences become more clear pick one, but put everything behind an interface so the implementation can be swapped later (might be quite some work)


title: How do you study for MCPD?

text: my employer is encouraging us and even require us to take MCPD and get certified. They offer online ebook and practice exam from measureup.com but I get bored and tired when I read those self-paced training kit and stray away to do something else. I like the way Zed's "learning python the hard way" teach. Is there some similar book like Zed's? How do you guys study for MCPD?


title: Storing a drawn graph information in database for web application

text: Well while developing a web application that allow users to draw graphs (flow charts, ER diagram , UML, .... etc) the information of drawn items and their relation to each other and position on canvas is expressed as JSON object The question is: 1- is saving such graph in database as raw (json object text) is enough (in one field of a table) 2- or is it always required to break down the json object into logical pieces and store them into a well built database structure! option 1- other than making devilopers life easier it will eleminate the need of recreating json object from small bits and pieces of information when the user open a graph he have built and saved long time ago option 2- will have fine grain details in proper structure but will cost kind of heavy processing while opening a saved graph from Database which way is correct way to go ?


title: Why do ruby and python seem to have more community contribution than PHP?

text: In a recent blog post by Roy Osherove, it is pointed out that his switch from primarily .Net development to ruby development has seen a huge difference in community involvement and really enjoys it. The quote that spawns this question is : > there is no master overlord that dictates what you will or won’t work with. I don't spend a great deal of time working with php, but I do spend about the same amount of time working with ruby. From the time that I spend working and communicating with people who work with both technologies it seems like Ruby has the feeling Roy describes much more than PHP does. I don't deal with Python a great deal, but those I know who do all say it has a similar community feeling. This strikes me as odd since every ruby and python programmer I know tend to have learned php somewhere along the way but they have no similar feeling about the php community. I understand there are justifiable complaints with earlier versions of php, but people were still able to use it to build some very large sites and many companies use it. What separates these communities that ruby and python seem to have such a different vibe compared to php? (This question could be subjective but I'm hoping there is a solid impartial answer to explain the difference)


title: What is Google's intention to fund Firefox while developing Chrome?

text: My understanding is that Google funded Mozilla Firefox although it develops its own Chrome browser. This looks redundant. What is the motivation for Google doing this? Another potentially related question: Why did Google not unify Google Video with Youtube when it acquired Youtube?


title: What is the traditional way to maintain extensibility in a database-driven application like this?

text: I'm working on a simple application for a game in Java that allows a user to record whether they have collected a given item and how much experience it contains. This will work for multiple item types (weapons, armor) and each will have its own tab with a list of all items that qualify under it. Making changes as new types are added is not such a big deal (if a clothing slot is added, for instance), but new items are added to the game all the time in biweekly patches, and I'm not sure what the traditional/customary way to make sure the application is user-extensible without requiring me to would be. Whether that would be adding a configuration menu that allows users to add news items (new rows to the local SQLite database) or a text file with something similar, but I'm certain there's a well-accepted way to do this that I'm not aware of. I'm new to databases and ignorant of the solution, so what's the professional/futureproof way to do this?


Is it useful to learn CVS before learning SVN? Does much of that knowledge carry over to SVN or are they too different?


title: Trying to understand what Travis CI does and when it should be used

text: I am very new to Git and I am planning to contribute to some open-source project on GitHub after discovering a small error in it. Upon forking it and fixing the error, I purposed a pull request and I noticed this showing up: > Failed — The Travis CI build failed Looking into the details I discovered it was caused by `Could not find .travis.yml`, which made perfect sense since I had not signed in to Travis Cl with and add .travis.yml to the repository. This is my first time hearing about Travis CI. And it sounds pretty cool so in order to learn more about it, I looked it up on Wikipedia. > Travis CI is a hosted, distributed continuous integration service used to > build and test projects hosted at GitHub. Travis CI automatically detects > when a commit has been made and pushed to a GitHub repository that is using > Travis CI, and each time this happens, it will try to **build the project > and run tests**. This includes commits to all branches, not just to the > master branch. My current understanding of Travis CI is that what it does is automatically pushing the project upon `git commit -am ".."` and I don't quite understand some part of it.   1. By **building the project and run tests** , what tests is it going to run? And how is it going to "build" the project? (like compiling it to binary?)   2. It states that "This includes commits to all branches" - but what if I don't want to commit to all branches?   3. Is it alright if I don't use Travis Cl at all? Under what circumstances is it best to use it (or it must be used)?


title: Static analysis config and convenience scripts in source control

text: 1) Should static analysis tool config be placed in source control? This config is not needed to compile/run software and some developers can have different preferences (even within coding convention). On the other hand placing such config in source control and declaring static analysis tool as "official part of project" can encourage everybody to test his code and help keep it very consistent. This question is mostly about open source because in commercial projects you will establish strict workflow anyway. 2) Should convenience scripts (generating documentation, running analysis, running tests, deploying, generating installer) be placed in source control? Theses scripts have to be cross-platform and may not work well on every system. People may just use IDE to accomplish some of these tasks. But requiring everybody to write his own boilerplate seems somewhat stupid to me. This question is mostly about interpreted languages because when working with compiled languages this is usually achieved using build tool which is not needed to build program in dynamic languages.


title: How to define constants with PECL hidef?

text: I've recently convinced the team that we could upgrade from php5.4 to 5.5 -- but, unfortunately, it seems I overlooked that php-apc is no longer supported in php 5.5 -- which is fine and dandy, but we could use a replacement for apc_define_constants() Thus, I've heard about the wonders of hidef -- but, I cannot seem to find any documentation for it, anywhere -- I got it installed, after a bit of kajiggering, but I'm not sure what to do next... How could I go about unwrapping the various functions included in the pecl hidef package ? Or, at the very least, how can I use it to define constants?


title: Taking a course in ASP.NET

text: Soon, I'm going to take a course in ASP.NET. But "unfortunately" the course is based on ASP.NET 3.5 using Murach ASP.NET 3.5 as textbook. I'm a bit concern since the current latest version is ASP.NET 4.0. There's a chance that the course will upgrade to 4.0 next semester, should I do it now or wait until next semester for version 4.0? My long term goal is to get a MCPD WEb developer cert. Thanks


title: Sending e-mails without using an e-mail server

text: JavaMail sends e-mails using an e-mail server, typically through the SMTP interface of an e-mail provider. Is it necessary to use an e-mail server to send e-mails? I have a web site that will send e-mails and if possible I'd like to send the e-mails directly from the web site code without using an e-mail server. The JavaMail FAQ says that an e-mail server is required. Is there a way to send e-mails without using an e-mail server, either with JavaMail or another API?


title: Learning about design

text: How do you improve your ability to design your applications? Where do you get your design ideas from? (I am asking about code design - not about a specific language and not about visual appeal). When I started programming, I found Design Patterns to be very helpful. These days I mainly poke around open source projects to see what other people did whenever I need to solve similar problems. What do you do?


title: Make a change that is ignored by future merges

text: I have a git repository, and I'd like to make a "debug" branch. In the "debug" branch, I'd like to add a line:               debug = true;      But I want to make sure that any merges back to master ignore that change. Is there any way to set that up in way that doesn't require me to manually handle all future merges?


title: Our flavor of Scrum

text: In my organization we almost never finish all the stories in the Sprint, and most of the stories are finished about 80%. One reason for this, is that many times testers don't have enough time to test all the stories, and developers don't want to test. Another reason is that the teams are usually too optimistic so they commit to more than they can complete, and no one really cares about that, so they continue to do it each Sprint. Usually testing, bug fixes and last polishes remain on the task board after the Sprint is over. The R&D manager believes that its not that bad to leave some bugs unfixed or to skip some non critical implementation, because then he can have usability test for the new features faster. Nevertheless I think he would be happy if the team could finish all the testing and bug fixes, but if not that's completely okay for him as well, because there are always some stabilization (hardening) sprints at the end in which the smaller stuff will be taken care of. I'd like to ask you, what do you think about this development method (which is not pure Scrum, but a more flexible/weak version of it). Thank you.


title: Rapid code analysis

text: I have recently moved to a new company where I am tasked (in part) with evaluating the existing code base and coming up with patterns and best practices. Our development team consists of around 20 programmers and we have nearly as many projects. The bulk of the code is done in C# and SQL (Stored Procedures). Naturally, I speak to the guys writing the code. However, I need to read through the code to get a proper idea of what is going on. Given the number of projects, it is extremely time consuming; especially if you're simply trying to get a high-level view of what is going on. At the moment I am using Enterprise Architect to import the classes into class diagrams. This helps to an extent, but I guess something like a flow diagram would be more useful. I suspect team leads deal with this same problem often when it comes to code reviews. How do you manage to speed-up code analysis?


title: Validating time-limited HMACs

text: I'm exploring using HMAC style secret-key authentication with timestamp expiry, but am struggling to get my head around how you validate the timestamp portion. On the client side you would do:               my_hmac = hmac(my_secret, my_values)      Where you would have a `timestamp` field in `my_values`. On the server (where you also know `my_secret`) you would attempt to rebuild the HMACd string with the request parameters:               my_hmac_to_compare = hmac(my_secret, my_values_from_http_request)      Is it simply a case of embedding the timestamp as a parameter so it's hashed in to the HMAC string and then ensuring the timestamp is within N minutes of when we process the request? I have odd visions of having to iterate over 5 minutes worth of timestamps, rebuilding the HMAC string on the server attempting to find the needle-in-the- haystack that will generate the correct HMAC string. **Bonus question:** Is there a consensus on how you would initially transfer the secret key to a client from a server? It obviously becomes "dirty" after it goes over the wire, but in a user facing application you can't have someone pasting in an extensive secret key, especially if it's a mobile client.


title: how do you style content when querying a data structure nested n-levels deep?

text: This question has come up while writing a simple text adventure game where your character has an inventory, which can include containers that also have things in them. I want a clean way to style the inventory output, like so:               You are carrying:         a bag containing:             a ring         a backpack containing:             a loaf of bread      Currently I just include the formatting in the result returned by the query, all in one shot. For example,               DoInventoryCommand():         result = QueryInventory(...recursively checks inventory adding multiples of tabs depending on nesting level...)         print(result)      What I would like is a cleaner separation between content and presentation so that the query would just return a data structure that a separate pass could style. But how should the styling pass handle the n-levels deep data structure? Just for example, how would a styling tool like CSS handle it? Do you need to procedurally generate the CSS once you have the data structure?


title: Generating presentation elements with Javascript vs PHP

text: What are the pros and cons of generating dynamic pages with javascript vs doing it in PHP? As an example, I want to display certain records from some database in a table and I'm considering the following approaches:   1. Use Javascript to get some response in JSON from some PHP page, then dynamically build the table in Javascript.   2. Write some PHP in the page which will make the query and iterate through the result set echoing the table markup. What are the pros and cons of each approach?


title: Query Language for Java Code Analysis

text: I want to write a refactoring tool for the Java programming language. For this reason I need to do structural queries against the abstract syntax tree. Given this AST how do I get answers to the following statements:   * Get superclasses of an object.   * Give me the expression where I call a method x() on type XClass   * Is method x() is called without arguments (check overloading)   * Is method x() called anywhere in the execution path of object of type XClass (eg. is close() called anywhere)


title: How should HTML data formats be applied in everyday situations?

text: Given Google's shift towards a stronger focus on page markup data, how do the data formats used in Schema.org work alongside those for Microformats? How do these (and other specs) compliment each other and which should be used in preference in different situations? **Edit:** It seems from established content on the subject that opinion seems to be divided between those who believe Schema.org is doom, hellfire and brimstone and those who think it will ultimately be a good thing either way regardless of uptake. Both articles agree at least that the different formats can coexist happily without causing search engines undue grief. The question about how the different options might be used in specific cases still remains though.


title: Should unit test expected results be hardcoded?

text: Should the expected results of a unit test be hardcoded, or can they be dependant on initialised variables? Do hardcoded or calculated results increase the risk of introducing errors in the unit test? Are there other factors I haven't considered? For instance, which of these two is a more reliable format?               [TestMethod]     public void GetPath_Hardcoded()     {         MyClass target = new MyClass("fields", "that later", "determine", "a folder");         string expected = "C:\\Output Folder\\fields\\that later\\determine\\a folder";         string actual = target.GetPath();         Assert.AreEqual(expected, actual,             "GetPath should return a full directory path based on its fields.");     }          [TestMethod]     public void GetPath_Softcoded()     {         MyClass target = new MyClass("fields", "that later", "determine", "a folder");         string expected = "C:\\Output Folder\\" + string.Join("\\", target.Field1, target.Field2, target.Field3, target.Field4);         string actual = target.GetPath();         Assert.AreEqual(expected, actual,             "GetPath should return a full directory path based on its fields.");     }      **EDIT 1:** In response to DXM's answer, is option 3 a preferred solution?               [TestMethod]     public void GetPath_Option3()     {         string field1 = "fields";         string field2 = "that later";         string field3 = "determine";         string field4 = "a folder";         MyClass target = new MyClass(field1, field2, field3, field4);         string expected = "C:\\Output Folder\\" + string.Join("\\", field1, field2, field3, field4);         string actual = target.GetPath();         Assert.AreEqual(expected, actual,             "GetPath should return a full directory path based on its fields.");     }


title: Exit interview - what is and isn't OK

text: There's a lot of questions about hiring interviews, but the same cannot be said about exit interviews. As I'm going to embark on a new challenge in the near future, I'm going to go through an exit interview. My question is - **what should you say in an exit interview and what should you avoid?** For privacy reasons, and because this question doesn't only apply to me, I'm not going to give specifics. I'll get started - I think it's OK to complain about:   * infrastructure (i.e. hardware used)   * overtime (if it's regular)   * unreasonable deadlines But not about:   * management :)   * remuneration These are just off-the-top-of-my-head examples. My opinion is that you shouldn't burn any bridges when you leave, especially if the company you're leaving is really OK, but also remaining silent over existing issues defeats the purpose of the feedback - maybe some of the suggestions or complaints will be considered and fixed. I hope this is the right place to ask this :)


title: UML representation of specific factory pattern

text: I have to create an UML class diagram from the following example code (Perl). I don't think that the standard factory pattern match in my case or I don't understand it correctly. I don't have `AbstractFactory` and `ConcreteFactory` but a single `Factory`. What does this example looks like in UML class diagram? **Edit** : This is only a very flat and simple example. The real application has many "Types" with totally different workflows. The class diagramm is to get an overview over the hole structure. Not realy for internal workflow like sequence diagrams does.               package Module::Factory;     sub new { bless { type => $_[1] }, $_[0]; }     sub create {         my( $self, $name ) = @_;         my $object = "Module::Types::$self->{type}"->new( $name );         return( $object );     }          package Module::Types::Test1;     sub new { bless { name => $_[1] }, $_[0]; }     sub test {         my( $self ) = @_;         say "Hello, $self->{name}.";         return( $self );     }          package Module::Types::Test2;     sub new { bless { name => $_[1] }, $_[0]; }     sub test {         my( $self ) = @_;         say "Bye, $self->{name}.";         return( $self );     }          # even more Module::Types::TestN packages...          package main;     foreach my $type ( qw( Test1 Test2 ) ) {         my $factory = Module::Factory->new( $type );         foreach my $name ( qw( World John Peter ) ) {             my $object = $factory->create( $name );             $object->test();         }     }


title: AJAX event, prevents other page actions

text: Here's a fairly average scenario, using JSF as an example, but this same concept I have observed in ASP.NET, Apache Wicket, and other frameworks with ajax capabilities.               <h:inputText id="text1" value="#{myBacker.myBean.myStringVar}" styleClass="goodCSS">         <f:ajax event="change" listener="#{myBacker.text1ChangeEventMethod}" update="someOtherField" />     </h:inputText>          <h:selectBooleanCheckbox id="check1" value="#{myBacker.myBean.myBoolVar}" />      Let's suppose that the 'text1ChangeEventListener' is essential to 'someOtherField' and perhaps toggles its disabled attribute, or changes its available options, based on the value of 'myStringVar.' The particulars aren't important, let's just accept that for some reason we need an ajax call when the 'text1' value is changed. So Jane User is working her way down the form. She arrives at the 'text1' field and types some value. The cursor focus is still in the text field, as she moves her mouse to the 'check1' box and clicks. It appears to her that nothing has happened. She clicks again, and this time the checkbox highlights and the icon indicating a selection appears in the box. Jane has to do several entries in the form today, and sees this happen every time, and it becomes very frustrating for her. Likewise, Jeff Admin is also perusing this form, and begins to type in 'text1.' He then realizes he doesn't really want to enter this data, and so moves his mouse to the "cancel" button elsewhere on the page, and clicks. Nothing seems to happen. Jeff clicks again, and after confirming he really does want to cancel, is returned to the home page. Jeff scratches his head. The problem is simply that the first thing the system does after 'text1' looses focus is run the listener and perform the ajax operation. It may only take a fraction of a second, but still, you can click other buttons all you want, but until that ajax has finished, everything else is ignored. I've spent the morning searching and reading, and it seems no one else has even noticed this. I could find not one article, blog, past question here or at SO, or anyting that addresses this obvious and glaring deficiency in ajax. So first of all, am I truly alone in thinking this is a big problem? Second, does anyone have a solution?


title: Configurable tables in sql database

text: I have the following tables in my database: Config Table:               ======================================     Start_Range | End Range | Config_id           10           |        15        |      1     ======================================      Available_UserIDs               ==========================      ID | UserID | Used_YN   |                1 |   10      |        t          |       1 |   11      |        f          |       1 |   12      |        f          |       1 |   13      |        f          |       1 |   14      |        f          |       1 |   15      |        f          |     ==========================          Users         ==========================          UserId | FName | LName  |                      10     | John    |    Doe    |         ==========================      This is used in a reservation system of sorts... which lets an administrator specify a range of numbers that will be assigned to users in the config table. Once the range has been defined, the system then populates the Available_userIDs table with all the numbers in between the range, and sets the Used_YN flag to false As users sign up, they grab the next user_id number that's not in use... and reserve it. Then the system adds a record to the Users table. Once the admin has specified a range, it is possible that they can change it. For example, they can start with 10-15... and then when the range is used up, they should be able to specify another range like 16 - 99. I've put a unique constraint on the Available_UserIDs table, as well as on the Users table - to ensure that UserIds can't be duplicated. My questions are as follows:   1. What's the best way to prevent the admins from using a range that's already in use? I thought of the following options:  \-- check either the Users table to see if the start range or ending range numbers are being used. If they are, assume that all the numbers in between are in use too, and reject the range. \-- let them specify whatever they want, try to populate the Available_UserIDs table. If there are duplicates, just ignore that specific error message from the database and continue on.   2. How do I find gaps in the number ranges? For example, if they specify 10-15, and then 20-25, it'd be nice to be able to somehow suggest on my web page that 16-19 is currently available. I found this article: http://stackoverflow.com/questions/1312101/how-to-find-a-gap-in-running-counter-with-sql But it only seems to return the first available number... so in my example above, it would only return the number 16.  I'm sure there's a simpler way to do things that I'm overlooking!


title: Virtual machine for a high level programming language vs an operating system

text: It struck me recently that a virtual machine for a high level programming language is very much like an OS. It manages resources, e.g. stack, heap, etc. similar to how an operating system manages resources and if the programming language supports threads then the virtual machine also does time-sharing and context switching similar to how an operating system does it. How far can this analogy be taken? Why is that we don't have a bare-metal implementation of the JVM? It seems like all the pieces are there so what exactly is the reason such things are not more prevalent?


title: How would one build a relational database on a key-value store, a-la Berkeley DB's SQL interface?

text: I've been checking out Berkeley DB and was impressed to find that it supported a SQL interface that is "nearly identical" to SQLite. http://docs.oracle.com/cd/E17076_02/html/bdb- sql/dbsqlbasics.html#identicalusage I'm very curious, at a high-level, how this kind of interface might have been architected. For instance:   * since values are "transparent", how do you efficiently query and sort by value   * how are limits and offsets performed efficiently on large result sets   * how would the keys be structured and serialized for good average-case performance


title: Implementing `let` without using a macro

text: I'm learning Lisp, and I've just gotten to `let`, which I don't quite understand (the implementation of). A common definition for it is given in terms of `lambda` as a macro. However, nowhere have I seen that `let` **must** be implemented as a macro or in terms of `lambda`. Is it possible to define `let` without using a macro or `lambda`? I know it can be implemented as a primitive, but I want to know whether it can be implemented **in Lisp** without creating a macro -- by creating a special form or a function.


title: Should programmers prefer making wide libraries or thin libraries?

text: For classes and functions, it is clear cut: each should do only one thing. For libraries though, this is less clear. If you have a library with collections, it might have multiple collections. It might have useful functions like sorting, which aren't strictly collection based but users would expect. Each of these results in a 'wider' library. On the other side is having a library for the specific collection type and/or with little built-in functionality. If you want a queue, it gives you a queue. If you want to sort that list, then the library lets you do that yourself. What is the best practice here (if any)? I can see arguments for each side.


title: Behavior Driven Development and Unit Testing in Python

text: We might be interested in starting to incorporate a unit test suite to our project, which is coded in Python (and it uses Redis, PostgreSQL and some third-party libraries, if that bears into the solution). The benefits we want to achieve are:   1. Once the project is up to speed, we want to be able to specify new behavior quickly and efficiently, to help improve communication and team productivity. Read: **We want BDD, but have already started coding without it**.   2. Excellent textual support (i.e. the tests can be read almost as natural text), so as to make it **easier to write and read tests**.   3. Ability to **automatically run tests** (at the very least, to be able to include the running in a Bash script or something like that). We use Windows and Linux for development, and Linux servers, so Linux support is our primary requirement.   4. **Integration with github**. I don't know if it is possible, but I've seen some projects in github which have a "Passing" or "Failing" status on them and it would be great to have that for our project. What are good tools / libraries that can help us do this, and, most importantly, what are good ways to incorporate BDD into a Python project? Thank you very much! Any suggestions are appreciated.


title: Combinatorial explosion of interfaces: How many is too many?

text: I'm a relative newcomer to OOP, and I'm having a bit of trouble creating good designs when it comes to interfaces. Consider a class A with N public methods. There are a number of other classes, B, C, ..., each of which interacts with A in a different way, that is, accesses some subset (<= N) of A's methods. The maximum degree of encapsulation is achieved by implementing an interface of A for each other class, i.e. `AInterfaceForB`, `AInterfaceForC`, etc. However, if B, C, ... etc. also interact with A and with each other, then there will be a combinatorial explosion of interfaces (a maximum of n(n-1), to be precise), and the benefit of encapsulation becomes outweighed by a code- bloat. **What is the best practice in this scenario?** Is the whole idea of restricting access to a class's public functions in different ways for other different classes just silly altogether? One could imagine a language that explicitly allows for this sort of encapsulation (e.g. instead of declaring a function public, one could specify exactly which classes it is visible to); Since this is not a feature of C++, maybe it's misguided to try to do it through the back door with interaces?


title: What should a domain object's validation cover?

text: I'm trying to figure out how to do validation of domain objects that need external resources, such as data mappers/dao Firstly here's my code               class User     {         const  INVALID_ID = 1;         const  INVALID_NAME = 2;         const  INVALID_EMAIL = 4;         int    getID();         void   setID(Int i);         string getName();         void   setName(String s);         string getEmail();         void   setEmail(String s);         int    getErrorsForInsert(); // returns a bitmask for INVALID_* constants         int    getErrorsForUpdate();     }      My worries are about the uniqueness of the email, checking it would require the storage layer. Reading others' code seems that two solutions are equally accepted: both perform the unique validation in data mapper but some set an error state to the DO `user.addError(User.INVALID_EMAIL)` while others prefer to throw a totally different type of exception that covers only persistence, like:               UserStorageException     {        const  INVALID_EMAIL = 1;        const  INVALID_CITY = 2;     }      What are the pros and cons of these solutions?


title: Is it OK to return HTML from a JSON API?

text: On my current project I am responsible for the implementation of a service which involves the consumption of newly created RESTful APIs, documented as solely supporting JSON. The client consistently makes requests with the accept header of 'application/json' and content-type of 'application/json'. However some endpoints send a response with a content-type of HTML, even a HTML body. To me this is clearly the wrong approach and can never be justified. Throughout the project this same practice has been applied across two different vendors and two different services. I found myself having to justify why the services needed to be changed. The vendors stated that the client should cope with this and even my REST library of choice has been questioned (RestEasy) because it doesn't cope with this by default 'out the box'. This has been a major point of frustration. I can't find many references to back up my argument, I assume this is because the point is mute as it's so obvious. The question is am I missing something? I'm I being pedantic about this? Is it OK to have a JSON API that doesn't have a content-type of application/json in this scenario? References would be appreciated. How do you resolve this situation from a commercial point of view?