title: How to manage client expectations when working with a BDD type framework?

text: I've recently been investigating SpecFlow and can see the value of it for writing client/stateholder specs which can show a feature's progress however I'm nervous of introducing them to a client... Imagine a feature:               Given I'm on the "MyAccount" page        And I enter "Liath" into the "Name" textbox     When I click "Save"     Then my username should be "Liath"      We write these features, show the client a set of red icons and set the developers to work. If our developer completes the happy path then the icon will go to green and the client will see that feature is complete. However our developer knows that they've still got to consider things like:   1. Checking the username to see if it's in use   2. Checking the username for profanity   3. Handle errors from the database   4. Some form of validation to ensure the username uses only valid characters Clearly if a client sees a row of green lights they will be reluctant to continue paying for the rest of the development, it will look like we're trying to stretch out the work. What is the value of these tests as a progress indicator if they indicate work is completed long before it is? What techniques would we need to use to give a more accurate example of progress?


title: replacement for fanfold paper printouts

text: Back in university, we were able to print "unlimited" printouts on wide fanfold paper, (perhaps 128 characters wide or maybe more). I could then unfurl the printed code out across the desks or the room and get a great overview of my code, draw circles and arrows and a paragraph on each one in the wide margin, see if this code matched that code, tweak variable names by seeing their brethren, etc, and I loved it. Right now I'm using xcode for iOS programming, but the question comes up no matter what editor I've used: how can I get a good code overview that's bigger than my screen?


title: Framework for developing front-end with back-end as REST

text: Currently I'm developing the back-end of a PHP application using Recess Framework. I'm almost done and I now need to do the front-end. I have many alternatives and I prefer a CMS. The alternatives in my knowledge are Drupal or Wordpress. The problem is that I've never used Drupal and Wordpress(or any better). Thus I don't which one to choose to develop the app to interact with the REST interface.Can you help me in choosing the best CMS for interacting with the REST interface


title: Predicting advantages of database denormalization

text: I was always taught to strive for the highest Normal Form of database normalization, and we were taught Bernstein's Synthesis algorithm to achieve 3NF. This is all very well and it feels nice to normalize your database, knowing that fields can be modified while retaining consistency. However, performance may suffer. That's why I am wondering whether there is any way to predict the speedup/slowdown when denormalizing. That way, you can build your list of FD's featuring 3NF and then denormalize as little as possible. I imagine that denormalizing too much would waste space and time, because e.g. giant blobs are duplicated or it because harder to maintain consistency because you have to update multiple fields using a transaction. Summary: Given a 3NF FD set, and a set of queries, how do I predict the speedup/slowdown of denormalization? Link to papers appreciated too.


title: Should I be worried if I solve a lot of my problems the same way?

text: I really enjoy programming games and puzzle creators/games. I find myself engineering a lot of these problems the same way and ultimately using similar technique to program them that I'm really comfortable with. To give you brief insight, I like to create graphs where nodes are represented with objects. These object hold data such as coordinates, positions and of course references to other neighboring objects. I'll place them all in a data structure and make decisions on this information in a "game loop". While this is a brief example, its not exact in all situations. It's just one way I feel really comfortable with. Is this bad?


title: Should I create a new open project to replace an existing one?

text: Recently I was looking at an open source project to contribute to however after going through the ugly code base (which seems to break quite a bit) and reading some things about the current maintainer I decided it would be a good fit for me. Right now my thinking is to just start a new project with the same goal but using a different set of technologies that I think fit the problem better, the only reason stopping me is avoiding second system effect given the fact the system is live and works. I could contribute to the other project and in doing so avoid essentially creating two different solutions to the same problem or I could solve the problem the way I think it should be solved and then see which system gets more traction. Is there some prior art to these circumstances that I should be aware of when considering this decision?


title: Value of frameworks for mobile web applications

text: **Longer version, see below for the TL;DR** As a developer with a strong background in the development of "classic" web applications I have been thinking about mobile web application architectures. One question that I cannot really seem to answer is: why do you need a framework like Sencha Touch (maybe even jQuery mobile, although it seems way more lightweight)? Let me elaborate on this: For me, mobile web apps seem highly similar to "classic" web apps with client side MVC. OK, you need to be extra careful when it comes to efficient DOM manipulations, transfer of (static) resources, offline support and a few more things, but apart from this, the only notable difference seems to be the user experience. Users are expecting typical mobile widgets that preferably behave like the native ones. For this reason, I am thinking that frameworks and libraries for client-side MVC, that are used for "classic" web apps, are also sufficient for mobile web apps and that the only necessary addition is a set of mobile-like widgets. **TL;DR** What is the value of frameworks for non-trivial mobile web applications (think enterprise-level with years of development...) over existing frameworks for "classic" (desktop) web application development? What about "classic" web application frameworks + mobile widget sets?


title: Discussions of simplicity

text: Recently at my company we've had a bit of a debate about abstraction vs. simplicity. One school of thought I'd characterize as "DRY and abstraction can do no harm," and leads to code like this:               def make_foo_binary(binaryName, objFiles, fooLibsToLinkAgainst)         make_exe_task(binaryName, objFiles.ext('.o'), fooLibsToLinkAgainst)     end      and this:               class String         def escape_space             return self.gsub(' ', '\ ')         end     end      My point of view is that creating an abstraction like this, that's only used in one place, makes the code less readable, since you're replacing a function call that the reader is familiar with (gsub) with another that they've never seen before (escape_space), which they'll need to read if they want to understand how the code actually works. The replacement is essentially described in English ("escape space") and english is notoriously vague. For example, without looking at the definition, you don't know whether it escapes all whitespace, or just the space character. There's lots of writing that sings the praises of DRY and abstraction. **Is anybody aware of sources that describe abstraction's limits? That sing the praises and discuss the pragmatics of keeping code simple?** Edit: I can find texts that encourage simplicity in life or in (English) writing, e.g. Thoreau's "Simplify, Simplify!" or Strunk and White's "Vigorous writing is concise." Where's the equivalent for programming?


title: Abstracting away the type of a property

text: In Python luckily most of the times you don't have to write getters and setters to get access to class properties. That said sometimes you'll have to remember that a certain property is a list or whatnot and a property would save you there by abstracting the type and providing a setter to add something to such list for example rather than exposing the list directly. Where do you draw the line between exposing the type directly or wrapping its access in a property? What's the general "pythonic" advice?


title: "As" Naming Convention

text: I'm experimenting with a naming convention I've devised and am seeking opinion. It involves the use of an "As" infix, and at this point I am envisioning it in the context of JavaScript, C# and C++ coding to assist with clarity of data format/contract when dealing with conversions or multiple representations of the same inherent data or object. Examples:               // ex 1. receive and convert user input.     string userInput = "123";     float userInputAsFloat = float.Parse(userInput);     int userInputAsInt = (int)Math.Round(userInputAsFloat);          // ex 2. prepare an object for json transport.     Dictionary<string,object> packet = new Dictionary<string,object>();     string packetAsJson = packet.ToJson();          // ex 3. interface with a component from various angles.     IUnknown foo = MyObjectFactory.CreateFoo();     IVisualizer fooAsVisualizer = (IVisualizer)foo;     ILocator fooAsLocator = (ILocator)foo;      Thoughts for/against? Does this convention have a name?


title: conventions for friend methods in Perl

text: Perl doesn't support a friend relationship between objects, nor does it support private or protected methods. What is usually done for private methods is to prefix the name with an underscore. I occasionally have methods that I think of as friend methods. Meaning that I expect them to be used by a specific object, or an object with a specific responsibility, but I'm not sure if I should make that method public (meaning `foo` ) or private ( `_foo` ) or if there's a better convention? is there a convention for friend methods?


title: Should java developers know about garbage collection algorithms?

text: I have been recently asked in an interview if I know about any garbage collection algorithms. I knew what garbage collection is but I never really thought about learning about garbage collection algorithms since as a developer I never had to worry about it and the Garbage collector does all the hard work for me. Do you guys think that Java developers should know about garbage collector algorithms? If yes can you tell me which ones should I look into?


title: What can I do? How would you react? HELP!

text: I'm trying to lead a software team that is falling behind. One of the main problems is that whenever something is mildly difficult, I end up having to assign it to myself. I had one other developer with moderate skills and half an intern. Unfortunately, the other developer's skills do not include design. So I begged my boss for one of the guys on one of the other teams, he's been working here longer than I have (5 years). He can't compete with me on design OR the language we use, but I thought he was the most competent besides myself. Today he gave me a piece of code that did something not in the least bit dissimilar to:               object const& my_class::get_object() const      {        return *std::unique_ptr<object>(new object());     }      He asked me if that was a problem! I said the only thing I could think of, "Yes. That's a problem." Then he comes over to my desk asking me how to fix it!! I said, "Use an object that survives the call of the function." Then he starts freaking out, "Yeah, but how, the only thing I can think of is to make a member variable." I was a bit busy at this time because I was already trying to stuff in extra work I had to take over for the other guy on the team because he couldn't figure it out...I told the guy to go away because I was busy and to go figure it out himself. Then he leaves in a huff talking about how it's not his fault if he screws things up. He's been freaking out since he came on the team and I don't think it's getting better. I feel like I'm drowning here. WTH can I do? What was the right way to deal with that? Would it have been more reasonable to go help this guy who's been writing C++ for 7 years figure out how to correctly return a reference to an object that isn't destroyed the moment it's returned? I feel like that's just ridiculous to have to do and wonder how the hell I'd get anything done that way. Sometimes I think they're doing it on purpose but that seems to me to just be whack...but then again, so does the question I was just asked today. This isn't some kid sitting at home trying to figure out his first program, having his brain blown by pointers.


title: how to convince manager to allow stack overflow

text: At my company we have strict limits on internet use. I often must use the poor mobile interface only for StackOverflow. However, the site is very useful for work. How do I convince a manager to un-block StackOverflow? Is there a summary of benefits available online for managers to look at?


title: Does a high correlation between burning out and programming exist?

text: Yesterday I asked a question about burning out. It did receive a high number of comments and answers and left me thinking if programmers are more prone to burning out than other professions. I'd be specially interested in academic studies, if any. Example of questions about burning out here on Programmers.SE: Burned out on programming and given up? What to do when coding begins to feel boring, like it is all just more of the same? What are advisable career options for a burnt-out programmer? There's also a burnout tag. Do you believe there's a high correlation between burning out and being a programmer, or at least, a correlation higher than burning out and other professions?


title: Best Practices To Create Error Codes Pattern For an Enterprise Project in C#

text: I'm working on an enterprise project which will be deployed in many SMBs and Enterprises.   The support for this project would be struggling and so I want to create a coding pattern for errors ( _Like HTTP status Codes_ ). This will enable help desk people to refer to documents and troubleshoot the problems as soon as possible. **What are the best practices and recommendations to do this?**   Any help to do this will be useful.


title: Using SSIS, any good tutorials

text: I was look for a good resource to learning SQL Server business Studio and in particular SSIS packages, any sugguestions?


title: Starting Linux Programming

text: I am a long time .NET developer and I have worked with Mono but I now want to start programming for Linux, what would be a good source to start native Linux development?


Is it ever a good idea to hardcode values into our applications? Or is it always the right thing to call these types of values dynamically in case they need to change?


title: If your unit test code "smells" does it really matter?

text: Usually I just throw my unit tests together using copy and paste and all kind of other bad practices. The unit tests usually end up looking quite ugly, they're full of "code smell," but does this really matter? I always tell myself as long as the "real" code is "good" that's all that matters. Plus, unit testing usually requires various "smelly hacks" like stubbing functions. How concerned should I be over poorly designed ("smelly") unit tests?


title: In ASP.NET MVC3 controllers, where do you instantiate your DataContext?

text: In your ASP.NET MVC 3 applications that use a DataContext or DbContext, where do you instantiate your data access object? Here is a non-exhaustive list of where I've seen it done:   * Individually within each method of the controller   * In the controller's constructor   * As a property (lazy-initialized) of the controller   * In an ActionFilter, shoved into ViewBag   * In Global.asax Application_BeginRequest   * In an HttpModule  I can't identify a clear front-runner amongst all of those. What's worse, whenever I start a brand-new project, I tend to change it up, _just because_. Does anyone have any battle-tested advice?


title: REST & Grails- A solution in search of a problem?

text: Over the past week, I've been struggling to adapt a Grails application to use the REST architecture. Problem is, I've had nothing but trouble throughout. For this application, the choice between using XML and JSON literally came down to a coin flip. Neither format offered much over the other, so I went with XML. Writing the URL redirects and the controller methods was relatively easy and got me interested. The problems came when actually doing stuff with the new controller functions. Specifically, two major issues came to light First, the list view of an object works with the regular CRUD method. Adapting to REST required executing a query to get all objects, count them up and render the output as both HTML and XML using the withFormat method. HTML view shows absolutely nothing in the way of listings, but the XML tree shows up when I comment out the HTML section in withFormat. So I know that part's working. Secondly, what to do when a premature end of XML file exception comes at you when its the machine creating the XML in the first place? At this point, to me at least, REST seems like more of a solution in search of a problem. It essentially co-opts the HTTP functions for its own use, when controller redirects seem to work fine. Is it a scalability adaptation?


title: Should we use Entity Framework?

text: We currently have the following stack :   * VS 2005   * Web forms   * SQL Server 2005   * IIS 6 We are planning on transitioning to this :   * VS 2010   * MVC and Web Forms   * SQL Server 2008   * IIS 7 My question is, when we move to MVC with VS 2010, should we use Entity Framework( or another ORM), a micro ORM (like Massive), or just plain SQL? All the tutorials I've read about VS 2010 are all geared towards using Entity Framework for data transactions, but is that going to be around for the foreseeable future (5+ years)? If it matters, our client's applications can have anywhere from 10 - 1,000 active users.


title: Is the creation of brand new software generally a major part of most programming jobs?

text: I have worked in software development for over 10 years now, and it's dawning on me that I rarely get to create anything "new". I realize that "new" is a vague term, but I would define it as anything from an obvious new large-scale project to a new large feature in an existing project (say something that would require some thought into its design, and that might take 2 weeks or more to complete). Maybe a rough guideline is something is new if it requires a written spec. I think most programmers know what I'm talking about - you're in the zone, writing a ton of code at a fast pace. Anyway, thinking back to what I've done, I'd estimate that less than 10% of my time is spent on "new" work. There are things like "adapt this existing system to work in this new environment", which certainly requires a lot of planning, but the actual coding and "new stuff" comes down to making tiny changes in many places throughout the code. Likewise for small feature requests - if I know what to do, these can often be finished in under an hour, and if I don't, it's just a lot of reading code and figuring out what to do (which frustrates me because I learn much better by doing, not by reading). In general I feel like I am not really creating anything most of the time. I kind of assumed that this was the case at most places - a new product would come out rather quickly and at that point everyone would be excited and banging out the code at a fast pace, but then once live it moves into maintenance mode, where few of the subsequent changes would be considered "new & creative". Am I wrong? Am I accurately describing most programming jobs, or do most programmers feel like they are often creating new things?


title: BDD/TDD vs JAD?

text: I've been proposing that my workplace implement Behavior-Driven-Development, by writing high-level specifications in a scenario format, and in such a way that one could imagine writing a test for it. I do know that working against testable specifications tends to increase developer productivity. And I can already think of several examples where this would be the case on our own project. However it's difficult to demonstrate the value of this to the business. This is because we already have a Joint Application Development (JAD) process in place, in which developers, management, user-experience and testers all get together to agree on a common set of requirements. So, they ask, why should developers work against the test-cases created by testers? These are for verification and are based on the higher-level specs created by the UX team, which the developers currently work off. This, they say, is sufficient for developers and there's no need to change how the specs are written. They seem to have a point. What is the actual benefit of BDD/TDD, if you already have a test-team who's test cases are fully compatible with the higher-level specs currently given to the developers?


title: Injecting properties/settings into an application

text: In applications that I write at work, I often need to have an external properties/settings file so that certain parameters can be configurable after the application is deployed with the end-user. The file will usually be text or XML and I will usually be implementing in C++ or Java. In the past, I have created Singleton classes to manage the injection of these properties/settings into my application. The class would be initialised with the path to a file, be hardcoded with the property keys it is looking for in the file, read it in and store all the attributes. Other classes in the application would then perform a call such as `propertySingleton::getInstance().getMyParameter()`. The more I read and learn about software engineering, and design, the more this approach feels clumsy and inherently wrong. I was wondering if anyone had to perform similar tasks, and how they would approach this in a well-thought object-oriented fashion?


title: Session Flash vs TempData C# MVC 3

text: A little background. A developer I used to work with insisted on disabling Tempdata and using Session Flash for passing data in the return view. Question is, is there any advantage to doing it this way? using a flash message is great for returning data to the user but I've had headaches with passing data from one post to the next with tempdata disabled. Is there any problem with using flash and tempdata together or is this a major coding faux paus?


title: Round Table - Minimum Cost Algorithm

text: Problem Link - http://www.iarcs.org.in/zco2013/index.php/problems/ROUNDTABLE > It's dinner time in Castle Camelot, and the fearsome Knights of the Round > Table are clamouring for dessert. You, the chef, are in a soup. There are N > knights, including King Arthur, each with a different preference for > dessert, but you cannot afford to make desserts for all of them. > > You are given the cost of manufacturing each Knight's preferred dessert- > since it is a round table, the list starts with the cost of King Arthur's > dessert, and goes counter-clockwise. > > You decide to pick the cheapest desserts to make, such that for every pair > of adjacent Knights, at least one gets his dessert. This will ensure that > the Knights do not protest. What is the minimum cost of tonight's dinner, > given this condition? I used the Dynamic Programming approach, considering the smallest of `i-1` & `i-2`, & came up with the following code -               #include<cstdio>     #include<algorithm>     using namespace std;          int main() {     int n,i,j,c,f;     scanf("%d",&n);     int k[n],m[n][2];     for(i=0;i<n;++i) scanf("%d",&k[i]);     m[0][0]=k[0]; m[0][1]=0;     m[1][0]=k[1]; m[1][1]=1;     for(i=2;i<n;++i) {                      c=1000;                      for(j=i-2;j<i;++j) {                                         if(m[j][0]<c) { c=m[j][0]; f=m[j][1];}                      }                      m[i][0]=c+k[i]; m[i][1]=f;     }     if(m[n-2][0]<m[n-1][0] && m[n-2][1]==0) printf("%d\n",m[n-2][0]);     else printf("%d\n",m[n-1][0]);        }      I used the second dimension of the `m` array to store from which knight the given sequence started (1st or 2nd). I had to do this because of the case when `m[n-2]<m[n-1]` but the sequence started from knight 2, since that would create two adjacent knights without dessert. The problem arises because of the table's round shape. Now an anomaly arises when I consider the case - `2 1 1 2 1 2`. The program gives an answer 5 when the answer should be 4, by picking the 1st, 3rd & 5th knight. At this point, I started to doubt my initial algorithm (approach) itself! Where did I go wrong?


title: Pros and Cons of Facebook's React vs. Web Components (Polymer)

text: What are the main benefits of Facebook's React over the upcoming Web Components spec and vice versa (or perhaps a more apples-to-apples comparison would be to Google's Polymer library)? According to this JSConf EU talk and the React homepage, the main benefits of React are:   * Decoupling and increased cohesion using a component model   * Abstraction, Composition and Expressivity   * Virtual DOM & Synthetic events (which basically means they completely re-implemented the DOM and its event system)      * Enables modern HTML5 event stuff on IE 8     * Server-side rendering     * Testability     * Bindings to SVG, VML, and `<canvas>` Almost everything mentioned is being integrated into browsers natively through Web Components except this virtual DOM concept (obviously). I can see how the virtual DOM and synthetic events can be beneficial today to support old browsers, but isn't throwing away a huge chunk of native browser code kind of like shooting yourself in the foot in the long term? As far as modern browsers are concerned, isn't that a lot of unnecessary overhead/reinventing of the wheel? Here are some things I _think_ React is missing that Web Components will care of. Correct me if I'm wrong.   * Native browser support (read "guaranteed to be faster")   * Write script in a scripting language, write styles in a styling language, write markup in a markup language.   * Style encapsulation using Shadow DOM      * React instead has this, which requires writing CSS in JavaScript. Not pretty.   * Two-way binding


title: If most of team can't follow the architecture, what do you do?

text: I'm working on a greenfields project with two other developers. We're all contractors, and myself and one other just started working on the project while the orginal one has been doing most of the basic framework coding. In the past month, my fellow programmer and I have been just frustrated by the design descisions done by our co-worker. Here's a little background information: The application at face value appeared to be your standard n-layered web application using C# on the 3.5 framework. We have a data layer, business layer and a web interface. But as we got deeper into the project we found some very interesting things that have caused us some troubles. There is a custom data access sqlHelper type base which only accepts dictionary key/valued entries and returns only data tables. There are no entity objects, but there are some massive objects which do everything and then are tossed into session for persitance. The general idea is that the pages (.aspx) don't do anything, while the controls (.ascx) do everything. The general flow is that a client clicks on a button, which goes to a user control base which passes a process request to the 'BLL' class which goes to the page processor, which then goes to a getControlProcessor, which at last actually processes the request. The request itself is made up of a dictionary which is passing a string valued method name, stored procedure name, a control name and possibly a value. All switching of the processing is done by comparing the string values of the control names and method names. Pages are linked together via a common header control that uses a combination of javascript and tables to create a hyperlink effect. And as I found out yesterday, a simple hyperlink between one page and another does not work because of the need to have quite a bit of information in session to determine which control to display on a page. My fellow programmer and I both believe that this is a strange and uncommon approach to web application development. Both of us have been in this business for over five years and neither of us have seen this approach. My question is this, how would we approach our co-worker and voice our concerns and what should we do if he does not want to accept the criteic? We both do not want to insult the work that has been done, but feel that going forward will create a nightmare for development. Thanks for your comments.


title: Developing a mobile application, how to show help if it contains too much data?

text: I am developing a mobile application which has many functionality, and I am pretty sure that the design will confuse the user about how to use some functionality so we decided to include some help as we can see them regularly in desktop applications, but later we found that the help text is too long. We don't think that one screen is enough to describe what a user can do. Moreover the project itself is subjected to evolve based on beta stage and user reports. After a lot of thinking and meetings we have decided three options to show the users what they can do.   1. Create the website or blog, so we can let the users know what they can do with this application, the advantage is that it can provide us a good source of marketing, but for that they have to access the site while most part of the application can be used while being offline in earlier versions.   2. Create a section in the application called demos to show the same thing locally, but we are afraid that it will increase the size, that we think can be avoided (and we are planning to avoid if there is any option)   3. Show popups, but we discarded this thinking that pop ups annoys user no matter what the platform is. I want to know from community that which option will you choose, we are also open to accept other ideas if you have.


title: Is it possible to perform mutual exclusion of threads without OS support?

text: I suppose you could adapt distributed mutual exclusion algorithms (Ricart/Agrawala, etc), but aside from these more exotic approaches, are you required to use primitives provided by the OS in order to achieve mutual exclusion? For example, in C# you would use something like lock:               lock (myobject)     {         // Do something     }      Lock then uses a condition variable provided by the operating system (I think?). From everything I've read about monitors, they all rely on certain sections of the monitor implementation being executed atomically. And the only way (that I can think of) to guarantee that is if the kernel explicitly made it so. Is this right?


title: Should sales staff interfere in application analysis and design?

text: We're working on a kind of CMS, a fast, hosted, centralized website builder like Weebly. We also use Scrum development model. But there seems to be some problems here. Our sales manager always come to us, complaining about the design of the application, or UI elements, or stuff like that and hinder development process by making re-works again and again. Examples are:   1. Why do you have item actions like delete and edit in grid items? Just have list actions as a toolbar on top of grids. No item action.   2. Why red color? Use green. That's what people like.   3. Use tree for contents, not grid. My question is really simple. Is it considered productive, or even normal for sales staff to interfere in application analysis and design?


title: Object Orientation done right with PHP

text: I've started to work with web development using PHP as server side programming language. In that time I didn't know the benefits of object orientation and had a hard time trying to write more maintainable code (for instance, spliting presentation from logic, and etc). After some years I knew about ASP.NET MVC and I gave it a try. I've learned how to work with the .NET plataform using C# programming language and I really found awesome how better structured my applications could be using good object orientation (dependency injection for instance was something that when I saw it for the first time I thought: "that's everything I always needed"). The point is that although I'm happy working with ASP.NET MVC, I still need in some projects to work with PHP, however I was wondering if it's possible to bring all the benefits from object orientation to PHP. I didn't find a way to do so on my own because for instance, PHP is not strongly typed so that it becomes a little complicated to make use of dependency injection as I've learned when working with ASP.NET MVC. Also, many of the things I've learned when working with MVC in ASP.NET although very cool and useful I didn't find a way to do the same in PHP. Now here comes the question: does anybody know about resources to learn how to take benefits of all that cool things from OOP to PHP? I'm interested in any resources: books, tutorials, videos, etc. Thanks very much in advance, and sorry if this question is silly.


title: What is the best way to discern an excellent programmer in a job interview?

text: In the setting of an interview: What is the best way to reliably identify when somebody is an **excellent programmer**. By this I mean he is one of those that is 10-15 times more efficient / rapid / better than his peers towards the lower end of the spectrum. Many of us have heard of the FizzBuzz Problem as a way to weed out the weak ones. Certainly, taking 5-10 minutes to solve that problem is a serious indicator that an applicant is a weak candidate. I posit that a good indicator is being able to solve that as quickly as you can write. This doesn't seem sufficient, though. Is it maybe something like giving him a moderately complicated buggy program, and seeing how fast he can grok it and identify all the problems with it?


title: Accessing the history of a `ref` in Clojure

text: The documentation for ref shows a :max-history option and states that "refs accumulate history dynamically as needed to deal with read demands." I can see that there is history at the REPL, but I don't see how to find previous values of a ref:               user=> (def the-world (ref "hello" :min-history 10))     #'user/the-world     user=> (do               (dosync (ref-set the-world "better"))               @the-world)     "better"     user=> (let [exclamator (fn [x] (str x "!"))]               (dosync                (alter the-world exclamator)                (alter the-world exclamator)                (alter the-world exclamator))               @the-world)     "better!!!"     user=> (ref-history-count the-world)     2      Presumably the-world has had the values "hello", "better", and "better!!!". How do I access that history? If it is not possible to access that history, is there a datatype that keeps a history of its values that can be queried afterwards? Or is that why the datomic database was created?


title: How can my code structure be improved?

text: I am looking for advice on the neatest way to structure my code.               class Password     {         private string cipher;              Password(string cipher)         {             this.cipher = cipher;         }              public string HashPassword()         {              }              public bool VerifyPassword()         {              }     }      The idea behind the class is to abstract away the password hashing process. The class will present two functions to the user, `HashPassword()` and `VerifyPassword()`, which will perform completely different hashing algorithms depending on the value of the `cipher` variable. Currently, I am using a set of `if/else` conditional statements within the two functions itself to determine which hashing algorithm to perform. However, it felt quite inelegant to me. Is there a better way of structuring my code?


title: Is the term 'Front-End' synonymous with 'Client-Side'? If so, is this always the case?

text: As a relatively new (self-taught) web developer, I've heard the terms _front- end_ , _client-side_ , _back-end_ , and _server-side_ quite often. To me, front-end and back-end were always synonymous with client-side and server- side, respectively. However, as I've begun working with MVC frameworks like CodeIgniter, I've come across a few instances of front-end referring to basically anything the end user sees (including server-side code), while back-end has referred to anything the end-user doesn't see (including CMSs). Client-side and server- side, to me, are much more concrete in their meanings; they have a very distinct line separating them. Front-end and back-end, on the other hand, do not. In a conversation I remember having with another web developer, he referred to CodeIgniter (in its entirety) as a front-end, and this threw me for a loop. I wasn't sure whether to correct him and say that CodeIgniter was my back-end, or if my definitions of the two terms were completely wrong. Searching for definitions of front- and back-end confused me a bit more in some respects, though they did clarify a few things. I'd just like to know where the lines are drawn between these four terms, and how they piece together in the context of web development (specifically on a LAMP stack).


title: Should I prepare to compete with a company that doesn't hire me?

text: I've been interviewing with a software company lately, and in my most recent (and final) interview I learned some more about the project I'd be working on: how it's architected, what needs maintenance, and what their primary concerns are for improving it in the future. The thing is that I've done some independent research that would be perfect for integrating into their system, but I don't yet know how they feel my interview went. Should I prepare for the possibility that I'm not hired by beginning to develop my idea, which is tantamount to a direct competitor to their product? It would be a significant time investment, but has two possible positive outcomes: I make bank on my idea on my own, or they eventually hire me anyway, giving me something to show for myself. The most likely negative outcome is the same as for any failed speculative software project: lost time that could've been spent on less risky ventures. Just curious as to what I should do. I'm a busy guy and it's important I be decisive.


title: What is the greatest design flaw you have faced in any programming language?

text: All programming languages are having their design flaws simply because not a single language can be perfect, just as with most (all?) other things. That aside, which design fault in a programming language has annoyed you the most through your history as a programmer? Note that if a language is "bad" just because it isn't designed for a specific thing isn't a design flaw, but a _feature_ of design, so don't list such annoyances of languages. If a language is illsuited for what it is designed for, that is of course a flaw in the design. Implementation specific things and under the hood things do not count either.


title: How do you compare programming job offers from companies in different countries?

text: _This isn't really a programmer-specific question, but I'm not sure of a more appropriate place, and I think the users of this site are best able to answer the question in the context of programmers._ Relocating to the US seems fairly common in the programming industry. I live in the UK, and maybe one day, I might do it too. So, if that day comes - how would you go about comparing job offers? Benefits are fairly easy to compare, but given the differences in cost of living, how would you go about comparing salaries and the quality of living you'll have? In a country where the cost of living is lower, you might be able to accept a lower salary (based on exchange rate) and still have the same quality of living. But what can you do to ensure this? In some cases, you may even take a "pay rise" in terms of exchange rate, but end up far worse off. How can you compare job offers across different countries to get an idea of the salary you would need in order to not feel you've gone "backwards"?


title: I have heard “dynamic” changing during Runtime? Whats that?

text: i heard that these(say for example Groovy) languages have the capability of changing the variable name or call methods dynamically in runtime! What you meant by **dynamic** languages? And what is the real need for changing any values during runtime? Is that doen't lead to confusion, because at runtime if you change any value(or your programming constriants change anything), then whats the need for compilation(because it decides and confirms these values will be used, then there is no meaning of changing it in dynamically)? And i know there should be something useful, so only people have introduced these concepts! I guess i'm clear about my question! And i need some brief explanation :)


title: ISTQB terminology question (Defect)

text: According to ISTQB (and few more sources + wiki ), a defect/bug is the actual cause of error in software, e.g. incorrect statement, logical or semantic error. The actual definion is: a flaw in the system or component that could lead to the failure. But what about specification bugs? I cannot relate to it. Specification bugs are quite common but if the programmer implements software according to spec with a bug, it is not his fault (IMHO). But then the definion could not apply and I am sure it must have been addressed somehow. Could you help me to understand this?


title: Visual Basic link to SQL output to Word

text: I am in need of some advice/references. I am currently trying to develop a legal document interface. There are certain fields in which I need to query out of my sql db and have those fields output into a document that can be printed. I am trying to develop a user interface where people can enter fields that will output to a document template but at the same time I need the template to be able to pull data from the SQL database. This is the reason why I think that VB might be my best choice and because it is one of the only OOP languages I am familiar with presently. Does anyone know that best way to be able to handle this type of job?? I know that you can use VBA within MS Word and have the form output variables to a word template. But, is there a way to have the word document also pull information from the SQL db? Is the best option to use VB linked to SQL and run queries to get the information from the database and then have it output to a for within VB? Is it possible for VB to be linked to a SQL db and output variables and SQL fields to a Word Template? I have looked into Mail Merge and I see that it allows users to pull data from an Access query but I dont think it would be easy to automate and it seems that users would need to have an advanced knowledge of MS Word and Access to handle this. I am not finding much useful information online so I came here. Any advice or references would be greatly appreciated. If there is a better way please let me know.


title: How to know what technologies to use?

text: I'm new grad of a SW Engineering school, and I want to create a small program. For example, the program might be a Web program, with or without a client that is not a browser (Mobile or Desktop). My question is, how do I know what technologies and languages to use? There are so many buzz words.


title: Is iterative documentation development possible, and does it deliver effective documentation?

text: I have a project for university which I won't be starting immediately, but have been thinking about for a reasonably long amoung of time. I understand that University project development isn't like industry (I'm currently an intern myself) so the situation that I'll be pointing out at the moment will probably seem somewhat ridiculous to actual software developers. ^^' The project itself requires that we document a lot of our work. So, besides delivering code, which counts toward some of the marks, we have to deliver documents including:   * A Requirements Analysis Document   * A Project Plan   * A planned list of Use Cases, Object and Dynamic Models and Acceptance Tests   * Documentation of the testing process and how successful the tests were   * Some other discussions and analyses of time usage, etc. These deliverables are to be delivered in the following manner:   * RAD first   * Followed by Project Plan, Use Cases, Models and Tests (approximately 3 weeks later)   * Lastly, the documentation of the actual program, the testing process, etc. + the actual programming itself (approximately 5 weeks later) So, from what I understand, this is really geared towards a Waterfall-style approach to the project. The only problem (in my opinion) is that this is a University project, and students already have enough pressure as it is with trying to develop projects at the end of semester during project week. I don't really want to be coding/developing/testing everything at the end of semester, when I'll be panicking with however many other assessments I have to deal with. I'd like to at least try and do some sort of iterative development cycle that means we can start coding/prototyping early, have a continuous development cycle that isn't focused on doing everything at the last minute and not have so much pressure at the end of the semester to finish this project. And now comes my actual question(s):   * Can I somehow reconcile having to deliver all that documentation with a fast, iterative/prototyping development cycle?   * Are there strategies for generating documentation in an iterative manner?   * Am I being entirely unreasonable asking this and expecting it to be do-able in University? Also, I understand that this question is extremely localised, so I'd like to ask the same questions that I asked above in terms of industry, and whether or not a lot of these kind of problems that agile processes face are different for each team or company. Anyway, sorry about how long this is, and if you have finished reading all the way down, thank you! If you could take the time to answer, I'd be very grateful! Thank you!


title: How to mock method with hard coded object?

text: I am working on an application which have multiple layers. Data access layer to retrieve and save data from data source, business logic to manipulate data, user interface to show the data on screen. I also doing unit testing of the business logic layer. The only requirement is to test the flow of business layer logic. So I use Moq framework to mock the data access layer and unit test the business logic layer with MS Unit. I am using interface programming to make the design decouple as much as possible so that unit test can be done. Business layer call data access layer through interface. I am facing a problem when I am trying to test one of the business logic method. That method does some work and create an object and pass it to data access layer. When I am trying to mock that data access layer method then it can not successfully mock. Here I am trying to create a demo code to show my problem. Model:               public class Employee     {         public string Name { get; set; }     }      Data access layer:               public interface IDal     {         string GetMessage(Employee emp);     }          public class Dal : IDal     {         public string GetMessage(Employee emp)         {             // Doing some data source access work...                  return string.Format("Hello {0}", emp.Name);         }     }      Business logic layer:               public interface IBll     {         string GetMessage();     }          public class Bll : IBll     {         private readonly IDal _dal;              public Bll(IDal dal)         {             _dal = dal;         }              public string GetMessage()         {             // Object creating inside business logic method.             Employee emp = new Employee();                   string msg = _dal.GetMessage(emp);             return msg;         }     }      Unit test:               [TestMethod]         public void Is_GetMessage_Return_Proper_Result()         {             // Arrange.             Employee emp = new Employee; // New object.                  Mock<IDal> mockDal = new Mock<IDal>();             mockDal.Setup(d => d.GetMessage(emp)).Returns("Hello " + emp.Name);                  IBll bll = new Bll(mockDal.Object);                  // Act.                  // This will create another employee object inside the              // business logic method, which is different from the              // object which I have sent at the time of mocking.             string msg = bll.GetMessage();                   // Assert.             Assert.AreEqual("Hello arnab", msg);         }      In unit test case at the time of mocking I am sending an Employee object but when invoking the business logic method, it is creating different Employee object inside the method. That is why I can not mock the object. In that case how to design so that I can solve the problem?


title: What are some examples of inverted classical inheritance?

text: Are there any examples of inheritance in languages where classes call their subclasses' methods rather than their super classes' methods? It should not behave like traditional inheritance like the following.               Parent.method = function () {         // Do things     }     Child.method = function () {         // Do things         super.method()         // Do things     }      It should instead behave like this.               Parent.method = function () {         // Do things         sub.method()         // Do things     }     Child.method = function () {         // Do things     }      Does this pattern have a name?


title: Queries in three tier architecture

text: I am wondering where should the DB queries need to be in the three tier architecture.   The first association that think is in the DAL. But then if the BL want to search for an object, the DAL need to publish methods for each possible search (Unrealistic - a lot of work). The second option, is in the BL. But then the BL need to know how the DB designed... (Encapsulation is not good) The third option, is that the DAL will publish some object like "QueryBuilder" or something similar, and the BL build the query with weak association (but still needed) to the DB. What is the best option to allow BL to do a search?


title: Help me think in C++

text: I mainly use dynamic languages. For many years I see statically typed hello world examples like               const int STACK_SIZE = 100;      And I will think "wow, I can't think like that". I understand memory management, syntax, pointers (mostly). Please let me into your brain for a second and analyze this use case with me. Let's say we have a command line application that's going to let us manage employees (exciting!). Let's just focus on adding new employees. We're a trendy new startup that's going to do a moonshot so our employee list size is going to start at 1 but we're eventually going to add 7 billion co-founders and maybe more (aliens? dogs? cats?). In ruby/python/javascript, I'd just create an array and suffer/refactor later when performance is terrible. Of course, you'd use a database in either C++ or some other language. But let's entertain this for a second. Would a C++ person break the problem down past one data structure? I think of this problem as "an array" problem. But maybe someone with more low-level experience thinks like this?   * Create a buffer to hold the list as the user adds in names, this can be fixed size   * Periodically flush the buffer to a file or something like that. Is that realistic? I understand the requirements here are contrived and vague. But let's say a C++ developer was creating this small application for themselves. Would they just use a smart pointer or something that would grow over time or would they create a `std::string*`? Let me give another example. Let's say you write a problem to loop through a file and do something with each line. Some people (including myself) start thinking with a small example file. Then later, you find that your problem can't handle large files. Whoops. Sometime I feel like lower level programmers would naturally pre-optimize out of discipline or experience to read the file in a buffer or something like that. Do you agree?


title: Understanding Data Binding for Windows Phone 7

text: I want to develop a simple app for the Windows Phone 7 platform. It's basically a vocabulary based game that involves the user moving word tiles from one area to another to score points. I want to know what is the best way of tying the UI to the game's backend? I saw the Windows Phone 7 jumpstart videos, there they touch up on Data Binding but don't really go into any depth. I'm a newbie and don't have any experience with designing the architecture for a phone app, It'd be great if someone could explain what steps I should be taking or guide me to a resource from where I could learn more.


title: Which technology for cross-platform web/desktop-based hotel management software

text: hope I am in the right place to ask this. A client, for whom I developed a group management software (in Flex) is now asking me to develop a fully- fledged hotel management software (tailored to his specific needs, that's why he does not use an existing one). However, he wants to access it on the Web and have a Desktop only version (if the internet won't work for any reason). Further more it should work on Mac and Windows. The software should be able to do some accounting, room management, template editing, creating pdfs, exporting excels, composing HTML Emails, lots of Reports etc. etc. This poses a real problem for me, as I know that most of those apps are written with .NET or similar, to have easy access to all Office components, Outlook, etc. However, we need Mac support as well. I was thinking of using Flex/Air, which would give me cross platform, web and desktop, but I am afraid that Air does not come with all the possibilities of Excel Export, Templated Editing, Outlook Integration, etc. And also the development time might be much higher than in .NET i am afraid. Any suggestions how you would tackle this problem? Thanks, Martin


title: Can "Junior" be used in a resume?

text: I don't know if "Junior" is a useful title. Can the title Jr. Developer be used in a resume? I want to be a good fit for something that is entry level, but still challenging. Examples: Jr. Web Developer, Jr. Developer, Jr. Software Engineer


title: Java's Object.wait method with nanoseconds: Is this a joke or am I missing something

text: I was checking out the Java API source code (Java 8) just out of curiosity. And I found this in `java/lang/Object.java`. There are three methods named `wait`:   * `public final native void wait(long timeout)`: This is the core of all wait methods, which has a native implementation.   * `public final void wait()`: Just calls `wait(0)`.   * And then there is `public final void wait(long timeout, int nanos)`. The JavaDoc for the particular method tells me that, > This method is similar to the wait method of one argument, but it allows > finer control over the amount of time to wait for a notification before > giving up. The amount of real time, measured in nanoseconds, is given by: >   >   >     1000000*timeout+nanos >   But this is how the methods _achieves_ "finer control over the amount of time to wait":               if (nanos >= 500000 || (nanos != 0 && timeout == 0)) {         timeout++;     }          wait(timeout);      So this method basically does a crude rounding up of nanoseconds to milliseconds. Not to mention that anything below 500000ns/0.5ms will be ignored. Is this piece of code bad/unnecessary code, or am I missing some unseen virtue of declaring this method, and it's no argument cousin as the way they are?


title: Company sends debug versions of software to clients

text: Hey, I'm a Junior Programmer working at a company. I just found out that they've been releasing a debug build of their product to clients for the past four years because the release version is broken (and has been for several years). My initial reaction was to be aghast, and I still am, but is this common? Is this not as big of an issue (both business and code-wise) as I think it is? Thanks in advance for your answer, and apologies if I've tagged this wrong.


title: Does Open Source lead to bad coding?

text: I have a thought that I tried asking at SO, but didnt seem like the appropriate place. I think that source sites like Google Code, GitHub, SourceForge... have played a major role in the history of programming. However, I found that there is another bad thing to these kind of sites and that is you may just "copy" code from almost anyone, not knowing if it is good(tested) source or not. This line of thought has taken me to believe that source code websites tend to lead many developers (most likely unexperienced) to copy/paste massive amounts of code, which I find just wrong. I really dont know how to focus the question well, but basic thought would be: Is this ok? Is Open Source contributing to that or I'm just seeing ghosts... Hope people get interested because I think this is an important theme.


title: Incremental seek on MySQL result

text: When outputting data in a large file, I try to make it a habit to incrementally output data in chunks, to prevent reading the entire large file into memory. As an example to show what I mean:               $fp = fopen('path/to/file.txt', 'r');     while (!feof($fp)) {         echo fread($fp, 8192);     }     fclose($fp);      Would this same practice be possible when fetching values from a database result? If so, how? As far as I'm aware, the ability to fetch unbuffered results from MySQL only applies to a row-by-row basis - and not per column. A basic example is shown below (I am aware that the mysql extension is deprecated - this is merely for illustrative purposes):               $q = mysql_incremental('SELECT `filedata` FROM `large_files` WHERE `id` = 1');     while (!mysql_incremental_eof($q, 'filedata')) {         echo mysql_fetch_incremental($q, 'filedata');     }     mysql_free_result($q);      A possible solution that I thought of is to combine multiple queries for portions of the file, making use of the `SUBSTRING()` function available in MySQL. I would imagine that although this might be more memory efficient, I'm wondering what the effect would be on network usage as well as disk activity?


title: What are general guidelines and advices to estimate how much you should charge for a project, being a novice freelancer?

text: I am an experienced programmer but completely new to the market. Someone wants me to do a project for them, but I do not know how much it is worth. What are general guidelines/advices for finding what a project is worth on the market? If I can ask here about this particular one, it is a HTML5 site with a login/register form and a video player that has to play a lecture video and powerpoint slides synchronized. They'll give me the video, the audio the powerpoints. I should also do some editting on the video before.


title: What are the advantages of a $ SKU of VS2012 over Express?

text: I will be using Visual Studio only for creating C#/XAML Windows Store apps. Is there any reason for me to purchase a "Professional" SKU of VS 2012 rather than just using the Express (free) "Metro apps with C#/XAML" version? The only thing I can think of is that I won't be able to use Resharper in the Express version (which I've already purchased a license for, but I use it at work, so that won't be a waste of money if I can't use it at home) - plus, I believe that even the Express SKU of VS 2012 will have similar code quality utility built in.


title: How to handle licensing of Ruby on Rails code, which contains a LGPL library?

text: My company wants to release the code for a Ruby on Rails demo app, which includes our own LGPL'd library code. It it legally kosher for me to state that the contents of the entire repo are released under the LGPL, although it includes "stock" Ruby on Rails files which are generated with every app, like `boot.rb` and `application.rb`?


title: Are there any scenarios where the 'Dispose Pattern' shouldn't be used on an Object which contains managed and un-managed resources?

text: MSDN says that to properly clean up an object which contains managed and un- managed resources, you need to implement the 'Dispose Pattern'. Given that the class implements the IDisposable interface, and overrides the Object.Finalize() method (has a destructor), **is there any reason why the compiler shouldn't automatically implement the pattern for you?** For instance, compiling:               public class Example : IDisposable     {         public void Dispose() {             //Disposing managed objects implementation         }              ~Example() {             //Disposing unmanaged objects implementation         }     }      As if it were typed as follows:               public class Example : IDisposable     {         private bool previouslyDisposed = false;              private void CleanResources(bool safeToCleanManagedResources)         {             if (!this.previouslyDisposed)             {                 _finalize();                 if (safeToCleanManagedResources) {                     _dispose();                 }                 this.previouslyDisposed = true;             }         }              public void Dispose() {             CleanResources(true);             GC.SuppressFinalize(this);         }              ~Example() {             CleanResources(false);         }              private void _dispose() {             //The contents of the Dispose() method are moved here.         }              private void _finalize() {             //The contents of the ~Example() method are moved here.         }     }      From what I understand, this should **always be safe and valid**. I can not think of any scenarios where these rules would need to be broken. I know this isn't the most pressing feature the C# team is working on, but asides from that: **Are there any scenarios where an object containing managed and un-managed resources wouldn't want to follow the 'Dispose Pattern'?** I'm talking about the compiler generating a method which functions like `CleanResources()`, and moves the `Dispose()` and `~Example()` methods to anonymous backing methods (similar to how auto-properties generate private backing fields). This would mean that any calls to `Dispose()` or `~Example()` would automatically implement the 'Dispose Pattern'.


title: Some hint to program a webservice "by subscription"

text: I have some web sites programmed, I know to do it with python and PHP basically. Normally they are simple web sites, but now I want to provide REST web services but only for allowed users (allowed by me). I saw that a lot of services uses the "KEY" and "SECRET_KEY" concepts, which seems to be what I need (if I understand it right). My suppositions are:   1. If I only do a GET service to retrieve, e.g., all my clients, without anymore, anyone can retrieve my clients without limitations.   2. I will need some KEY generator to provide keys for my allowed users, so they can use my webservices.   3. Only with a KEY is not enough: someone can steal a KEY and supplant my user (and this is the reason because exists a SECRET_KEY, right?). If all this is right, how can I make/use a system like that in my web services? Some open source example? Or maybe there are another easy solutions I'm not considering? My objective is to allow some users to use my web services.


title: conditional expressions, correct usage

text: I've recently become quite taken with conditional expressions in Python. Apparently some people consider it unpythonic and whether or not conditional/ternary expressions are even A Good Thing seems to be up for debate -- but I've been digging them lately.               x if C else y      So far I've noted there are two ways Python will appear to 'let' you use this syntax, though I only see a pointer to the first in its official docs, so I'm a little uncertain if the second method (which I've not used, yet) is considered a good practice or not. The first, being:               myvariable = x if C else y ##also, "return x if C else y"      Seems fairly common; one finds it in JavaScript and Ruby and basically any other language where you'd be impelled to drop a one-liner instead of three lines of               if C:         myvariable = x     else:         myvariable = y      However, I do see that Python will let you 'get away' with a line such as this, without assigning anything:               foo() if C else bar()      I'm a fairly new programmer, really, and so I try to hesitate implementing the wrong tool for the job. This to me looks like an interesting method for controlling the flow of a program, if not the typical way for doing so. For example, if we get the high score on Stick's Asteroid's Clone v.001:               record_score() if currentscore > highestscore else display_scores()      I find it readable (others may not) and descriptive. _However_ , in my non- exhaustive independent research of being able to use conditional expressions in a way besides assignment, I don't really see a whole lot of precedent for it. That leads me to think that one wouldn't really use it in this way in the first place, regardless of the language you're in, because it just isn't the right way to handle the state of your program. Additionally, I recognize that the difference between a 'good' implementation of this and a 'bad' one may just be to make use of `return` and reconsider the relevant code.               return record_score if currentscore > highestscore else display_scores ##and then the state machine takes over      That's fine too, but the question still stands in my mind if the suggested wording would ever be acceptable in the first place. So I ask, is it even good practice to use conditional expressions apart from assignment? Or to put a finer point on it, is it acceptable to use it as a means of controlling the flow of a program?


title: Database with version history?

text: I'm developing a game with a component-based architecture. I want to store entity descriptions in a SQLite database for compactness and convenience. Obviously the backend code is (and the database schema will be) under version control. Since important behaviour is in the database, and because multiple people will be working on it, I feel that it too should be properly versioned. So far my only solutions are:   * **Make periodic backups of the database.**   This would be out of line with the existing version control setup, and thus error-prone.   * **Dump the database to a diffable format and version that.**   This requires importing said format, which is akin to compiling, which should be avoided. I'd like cleaner alternatives within the existing setup, or a compelling reason to switch to another. Is there a nice C++ library for manipulating a text-based (i.e., diffable, and preferably not XML) database?


title: What is the preferred method for an application to get settings which should not be stored in version control?

text: Let's say an application I'm writing requires a password for something but I don't want that password to be saved in version control (so no hard-coding the password). What I've been doing is creating a file called `PASSWORD` which is read in once by the application and ignored by version control. Is there a more preferential method to handle this situation?


title: Create association between informations

text: I deployed a project some days ago that allow to extract some medical articles using the results of a questionnaire completed by a user. For instance, if I reply on questionnaire I'm affected by Diabetes type 2 and I'm a smoker, my algorithm extracts all articles related to diabetes bubbling up all articles contains information about Diabetes type 2 and smoking. Basically we created a list of topic and, for every topic we define a kind of "guideline" that allows to extract and order informations for a user. I'm quite sure there are some better way to put on relationship two content but I was not able to find them on network. Could you suggest my a model, algorithm or paper to better understand this kind of problem and that helps me to find a faster, and more accurate way to extract information for an user?


title: Is there a device still being sold that requires efficient programming? What is it?

text: **Edit:** As a lot of you have pointed out, efficient can mean a lot of things. I guess when I say that the device 'requires efficient programming', I mean that the device does not have lots of memory or a very high CPU clock rate, and therefore needs to be programmed with these limitations in mind. **Original Question:** Sometimes, to train themselves, athletes will work in higher altitude places to workout. This is because there is less air, meaning working out is much more difficult. Once athletes have gotten used to exercising in these conditions, they find doing physical work in normal altitude places much easier. I want to do this same thing, except with software development, and more specifically, game development. I want to find some system with a low amount of RAM (in the kilobytes), low CPU clock speed, and few registers. I figure learning to program games on this kind of system would be very useful in teaching me to write efficient code. Also, it would be very fun :) The systems that I have thought about programming are the old Nintendo ones; GBA, NES, SNES. But I have learned the hard way that obtaining these, then obtaining the flash cards for them are very difficult, and on the border of being illegal. So, my question is is there a crummy device that will teach me to write efficient code that is still out there and being sold? I would like it to be a _physical_ device, looking at my programs run on physical machines would be a lot more satisfying then watching it on an emulator, and also, emulators can be buggy.


title: CRM 2011 - Workflows Vs JavaScripts

text: In the Contact entity, I have the following attributes               Preferred email - A read only field of type Email     Personal email 1 - An email field     Personal email 2 - An email field     Work email 1 - An email field     Work email 2 - An email field     School email - An email field     Other email - An email field     Preferred email option - An option set with the following values       {Personal email 1, Personal email 2, Work email 1, Work email 2,        School email and Other email).       None of the above mentioned fields are required. **Requirement** When user picks a value from Preferred email option, we copy the email address available in that field and apply the same in the Preferred email field. **Implementation** The Solution Architect suggested that we implement the above requirement as a Workflow. The reason he provided was - most of the times, these values are to be populated by an external website and the data is then fed into CRM 2011 system. So, when they update Preferred email option via a Web Service call to CRM, the WF will run and updated the Preferred email field. **My argument / solution**   * What will happen if I do not pick a value from the Preferred email Option Set? Do I set it to any of the email addresses that has a value in it? If so, what if there is more than one of the email address fields are populated, i.e., what if Personal email 1 and Work email 1 is populated but no value is picked in the Option Set?    * What if a value existed in the Preferred email Option Set and I then change it to NULL?   * Should the field Preferred email (where the text value of email address is stored) be set to Read Only?      * If not, what if I have picked Personal email 1 in the Option Set and then edit the Preferred email address text field with a completely new email address     * If yes, then we are enforcing that the preferred email should be one among Personal email 1, Personal email 2, Work email 1, Work email 2, School email or Other email [My preference would be this]   * What if I had a value of helloworld@yahoo.com in the personal email 1 field and personal email 2 is empty and choose value of Personal email 1 in the drop down for Preferred email (this will set the Preferred email field to helloworld@yahoo.com) and later, I change the value to Personal email 2 in the Preferred email. It overwrites a valid email address with nothing. I agree that it would be highly unlikely that a user will pick Preferred email as Personal email 2 and not have a value in it but nevertheless it is a possible scenario, isn’t it?   * What if users typed in a value in Personal email 1 but by mistake picked Personal email 2 in the option set and Personal email 2 field had no value in it.  **Solution**   1. The field Preferred email option should be a required field   2. A JS should run whenever Preferred email option is changed. That JS function should set the relevant email field as required (based on the option chosen) and another JS function should be called (see step 3).   3. A JS function should update the value of Preferred email with the value in the email field (as picked in the option set).    4. The JS function should also be run every time someone updates the actual email field which is chosen in the option set.  The guys who are managing the external website should update the Preferred email field - surely, if they can update Preferred email option via a Web Service call, it is easy enough to update the Preferred email right? **Question** Which is a better method? Should it be written as a JS or a WorkFlow?   Also, whose responsibility is it to update the Preferred email field when the data flows from an external website? I am new to CRM 2011 but have around 6 years of experience as a CRM consultant (with other products). I do not come from a development background as I started off as a Application Support Engineer but have picked up development in the last couple of years.


title: Custom functions in a REST API

text: Looking at two of our entities `Company` and `Address`. A company has a `billingAddress` and a `profileAddress`. I'm unsure of how to implement a function to set the billing address versus the profile. Here are the options I can see:   1. Create a new address using a `POST` to `/address`. Update the company object at `/company` with `profileAddress = {/* the new id of the address */}`   2. Execute `/company/:id?function=updateBillingAddress&{/* rest of parameters go here */}`   3. Execute `/updateBillingAddress?company={companyId}&{/* rest of parameters go here */}`   4. Execute `/company/:id?billingAddress={ /* address data here */ }` The first method requires two calls and more responsibility on the part of the developer hooking up to the API. However, I'm not sure the second two methods are appropriate structure. The last one seems like it might be okay, it gives flexibility for updates without holding the responsibility of managing pointers or executing two calls.. still unsure. Has anyone seen use of methods 2 or 3 before. Are they okay to use? Why / why not? Which would you suggest to use and why?


title: Does the Head(start) pointer of Doubly Linked list points previously to the tail(last) node

text: I have one question in my mind that in case of circular doubly linked list the head pointer of the doubly linked list also logically point to the next pointer of the tail node of the linked list and tail's next pointer also point to the previous pointer of head. Please Answer me this question I am a bit confused.


title: Design application to send messages by marking circle on the map where you want to send message?

text: > Design application to send messages by marking circle on the map where you > want to send message ? This is a question that was asked of me by an interviewer. > Given a map of the world, Select the country you want to send message to by > marking the area with a circle then send the message to all the people in > that area. Visual Link to the Question : Design this application > **The approach that I told him** : > > Firstly build whole person's data (contacts , place information and all). > Then where you mark on the map, just build a cluster of that country using > Hadoop and fire the message to all the person's contact comes in that > cluster. please help me to better understand this problem, and if there is a better approach to the problem (all back-end and front-end).


title: When should one use composition instead of re-writing the functionality?

text: Say, I have a class A which has methods m1,m2,m3,m4,m5.... m100. I am making another simpler class B and I require only m2,m3 and m5 in B. Should I be ideally using compositions and put a reference of A inside of B and just delegate the functionality ? or I should just re-write[copy=paste] those 2-3 methods out of class A ?


title: Why did SVG lose to Flash?

text: There's alot of buzz going around that HTML5/Canvas will eventually be a flash killer. But upon some research I'm learning that HTML5/Canvas is just bitmap graphics. The real competitor with Flash is actually SVG. SVG was released a few years back. My question is, why didn't SVG turn out to be a flash killer?


title: Which software development methodologies can be seen as foundations

text: I'm writing a small research paper which involves software development methodologiess. I was looking into all the available methodology's and I was wondering, from all methodologies, are there any that have provided the foundations for the others? For an example, looking at the following methodologies:   Agile, Prototyping, Cleanroom, Iterative, RAD, RUP, Spiral, Waterfall, XP, Lean, Scrum, V-Model, TDD. Can we say that:   Prototyping, Iterative, Spiral and Waterfall are the "foundation" for the others? Or is there no such thing as "foundations" and does each methodology has it's own unique history? I would ofcourse like to describe all the methodology's in my research paper, but I simply don't have the time to do so and that is why I would like to know which methodologies can be seen as representatives.


title: When should I release/announce my open source library?

text: I am developing `python` library for database inspection. When is good time to announce/release it? Obvious answer is that when it's ready to be used. But I would like to get some feedback on the API, on what would be useful and act accordingly to `release early` rule. Any advice on what I should consider before releasing?


title: What's the meaning of term context in programming

text: I was looking through some Objective C docs.. and got this : > UIGraphicsBeginImageContext : Creates a bitmap-based graphics context and > makes it the current context. Also, the same term is used in Robotlegs : > (http://www.adobe.com/devnet/actionscript/articles/intro-robotlegs-pt1.html) > Context: Context is the bootstrapping mechanism that initializes dependency > injection and the various core utilities that Robotlegs uses. Dictionary meaning of context as i googled, doesnot seem to match the way it's used in programming : > con·text /ˈkäntekst/ Noun The circumstances that form the setting for an > event, statement, or idea, and in terms of which it can be fully understood > and assessed. > > The parts of something written or spoken that immediately precede and follow > a word or passage and clarify its meaning. Anybody can throw some light pls! V.


title: How to use external file comparer in MS TFS

text: I don't like ms diff that integrated into Visual Studio 2008 TFS Edition. Is it possible to change this file comparer to external one (Beyond Compare, for example)?


title: Why use REST with PHP?

text: I am developing an app in Android, i need get information from a external database in mysql and i read about Rest.. REST is using HTTP verbs GET, POST, PUT, DELETE to respectively get, insert, update, delete resources on a server. E.g. GET with url: controller/customer/{id} But why not use a simple Php ? is really necessary to use REST? i dont understand why i must use Rest if a simple PHP will do the same. Rest with php is a RESTFul?


title: How do you build debugging messages into your programs/scripts?

text: General, high-level question for people who work with code regularly. I was repurposing some old, outdated Javascript code into a Chrome extension, and to help me understand it, I wrote some quick code to help (see below). I regularly put messages in my code such as `dbmsg('Begin function loadDefaults()');` or `dbmsg('Settings saved to storage');` and the message is sent to the console. Whenever I need to debug something where the standard console messages aren't helping, I just turn on debugging. I figure this method is pretty simple and can be ported to other languages. **What other ways do you build debugging into your programs?** I'm self- taught, so I don't know the standard practices, but I'm more interested in unique ways you've found to do this sort of thing.               /** Debugging Tools      *      * Set debugMode to 1 to show error messages, 0 to hide messages.      */     var debugMode = 1;     function dbmsg(message) {         if ( debugMode == 1 ) {             var date = new Date();             var time = date.getHours() + ':'                  + date.getMinutes() + ':'                  + date.getSeconds();             console.log('DBM - ' + time + ': ' + message);             if ( chrome.runtime.lastError ) {                 console.log('DBM lastError - ' + chrome.runtime.lastError);             }         } else if ( debugMode == 0 ) {             return;         }     }     if ( debugMode == 1 ) {         console.log('Debug mode is currently ON. Each debug message is preceeded with "DBM" and the time the message was generated.');              // Listen for changes in storage         chrome.storage.onChanged.addListener(function(changes, namespace) {             for (key in changes) {                 var storageChange = changes[key];                 dbmsg('Storage key "%s" in namespace "%s" changed. ' +                       'Old value was "%s", new value is "%s".',                       key,                       namespace,                       storageChange.oldValue,                       storageChange.newValue);             }         });     }


title: DTOs matter on ASP.NET MVC JSON Action?

text: I recently came across an internal project where they were using DTOs throughout the solution, and when I sat down to implement a new MVC controller with a JSON REST endpoint I decided to use an anonymous object convention instead of declaring a discrete DTO class solely for the purpose of this API endpoint.               public JsonResult GetSomeSuch()     {         // .. do work              return Json(new {             PropA = domainObj1.PropA,             PropB = domainObj2.PropB         });     }      .. as opposed to the team convention, ..               public JsonResult GetSomeSuch()     {         // do work ..              return Json(new SomeSuchDTO2 {             PropA = domainObj1.PropA,             PropB = domainObj2.PropB         }     }          // in some other file off in some other project and folder     public class SomeSuchDTO2 {         public int PropA { get; set; }         public string PropB { get; set; }     }      Setting aside that I should have used a DTO here purely because it was already a team convention, team conventions trump best practices until team conventions change by team leadership, of which I was not yet a part. I'm not concerned about the social / team dynamic and consistency aspects so much as the technical value of details in specifically that point at which an action in C# becomes serialized to Javascript, as I have since moved on from that company. The team convention was to return only DTOs and the DTOs were managed in a completely different project (among about 50 projects in the solution), I felt that in this case perpetuating that pattern was excessive and difficult to maintain. Further, my belief is that DRY must correlate with YAGNI; only refactor when you're repeating the same thing twice, as such you would only refactor to use a DTO if that same return object structure reflecting the same context is in fact needed elsewhere, not just possibly but actually, but since this is being serialized to Javascript where it will be consumed anyway there is really no point anyway. I suppose a case can be made for DTOs as specification documentation, but when it becomes more of a maintenance chore to declare them and to look them up in their special folder in a project I would argue that there are more appropriate places and means to document the interface; indeed the anonymous object declaration seems to be documentation enough. I should also add that in our case everything was internal, this was a standalone project, so it's not like this was an externally exposed API. I was wondering if there are other angles to this that I didn't consider as to why I should use DTOs, something reasonably convincing?


title: Semantic CSS class names

text:
I always read articles that suggest to not use presentational CSS class names. Currently I'm working on a small website project. The footer on this website looks like this: ![Footer](http://i.stack.imgur.com/FTdZl.jpg) Although it's pretty simple, I'm not exactly sure how to name the class names. At the moment, I'm using this grid system, which uses class names like "one- quarter", "one-half" and so on. Easiest way would then probably be to use a HTML structure like this:

Adress
                     Lorem Ipsum
                     Lorem Ipsum

Adress
                     Lorem Ipsum
                     Lorem Ipsum

                But for several reasons I'll have to use SASS silent classes instead of using those classes like "one-quarter" directly in my HTML structure:               .classname {          @extend %grid__item;          @extend %one-quarter;          // ...     }      So I'm not sure how to name my different columns inside my footer. "footer_ _left" / "footer_ _right" are very presentational, so is "footer_ _adress" (content might change in future) / "footer_ _nav". Are there any best practices around or an article about CSS class naming in general? And I'm aware that this is mostly personal opinion, but I would still like to hear from others how they deal with it.


title: How to handle when one user deletes the object while the other has it opened in edit mode in a webapp?

text: I am developing a CRUD type web application. It is a project management system having projects, milestones, tasks, employees etc. Each employee has his/her own account to login and view the system. The problems come here:   1. If one user deletes a task while the second has it opened at the same time, the second user will get a null pointer exception if he tries edit and save, because the object doesn't exist.   2. The same problem in a bit different situation. One user has a task window opened. The second user deletes one employee. The first user tries to assign a task to deleted employee (because it is already in the list in a combobox) and gets null pointer exception.   3. If someone deletes the object and the other user tries to open it at the same time (will be a null pointer exception when trying to get an item) I am trying to leave technical details of the project because it is up to that. But if it helps, I'm using Vaadin framework based on Java. The database is MySQL. I thought two possible solutions but not sure about them:   1. Catch null pointer exception and print a general warning to the screen ("Some objects are missing...). But it wouldn't be clear for the users that exactly has happened.   2. Check every commit of the object and if it was deleted catch the exception and give more detailed explanation. But it won't help in the 3rd situation. I am really looking for any guiding points, advice, or tips you can provide on how to properly deal with these situations. Thank you in advance!


title: Best way to organize SQL queries stored in your code ? (or should you?)

text: I am sure I am not the only one who gets frustrated when they see a page of code littered with SQL queries. The ActiveRecord and other ORM patterns help mitigate a good amount of SQL used in a project, but in many cases of complex queries, the use of SQL is seemingly unavoidable. I am looking for opinions on how SQL queries should be organized with the rest of the code (or externally to it) to keep it from being scattered all over the place? One obvious idea is the use of Views, but often Views can be a source of performance issues when dealing with multiple large indexed tables, etc. **EDIT 1 - I am assuming you've already got it separated into the model layer**


title: Good books or tutorials on building projects without an IDE?

text: While I'm certainly under no illusions that building software without an IDE is possible, I don't actually know much about doing it well. I've been using graphical tools like Visual Studio or Code::Blocks so long that I'm pretty well lost without them. And that really stinks when I want to change environments or languages. I couldn't really do anything in D until someone made a Visual Studio plugin, and now that I'm trying to do more development on Mac, I can't use D again because the XCode plugins don't work. I'm sick of being lost when I see a .make file and having no idea what I'm supposed to do with a folder full of source files. People can't be compiling them one by one using the console and then linking them one by one. You'd spend more time typing file names than code. So what are the automation and productivity tools of the non-IDE user? How do you manage a project when you're writing all the code in emacs or vim or nano or whatever? I would love it if there was a book or a guide online that spells some of this out.


title: How to improve designer and developer work flow?

text: I work in a small startup with two front end developers and one designer. Currently the process starts with the designer sending a png file with the whole page design and assets if needed. My task as front end developer is to convert it to a HTML/CSS page. My work flow currently looks like this:   1. Lay out the distinct parts using html elements.   2. Style each element very roughly (floats, minimal fonts and padding) so I can modify it using inspection.   3. Using Chrome Developer Tools (inspect) add/change css attributes while updating the css file.   4. Refresh the page after X amount of changes   5. Use Pixel Perfect to refine the design more.   6. Sit with the designer to make last adjustments. Inferring the paddings, margins, font sizes using trial and error takes a lot of time and I feel the process could become more efficient but not sure how to improve it. Using PSD files is not an option since buying Photoshop for each developer is currently not considered. Design guide is also not available since design is still evolving and new features are introduced. Ideas for improving the process above and sharing how the process looks like in your company will be great.


title: Algorithm for picking reasonable min/max vals given a single value

text: I am making a simplistic in-browser IDE for some very domain-specific coding. Because I like Bret Victor's thoughts on Learnable Programming so much I thought I'd throw in some draggable numbers ala Tangle.js (click here to see what I'm talking about). My implementation is a much simpler slider input control but the idea is the same. One issue comes up however. The dragging slider needs values for min, max, and step. Since the values are user-entered I cannot hard code them. Currently I do `{min: currentValue/10, max: currentValue*5}` but this is so simplistic that it fails to make sense in a large class of cases. What I would like is an algorithm (which I imagine would be just a simple calculation) that given a value for a number would make good guesses on min, max, and step values. (Or any 2 of those since getting the third would be trivial). eg.                  fn(15) -> {min: 0, max: 35, step: 1}        fn(1.478) -> {min: -2, max: 5, step: .2}        fn(-7034) -> {min: -35000, max: -500, step: 100}      Obviously it need not and cannot be perfect but I'm wondering if anyone has an idea for an algorithm or something mathy that makes sense here.


title: Mutual exclusion over network - pattern?

text: I want to do the following: I have a number of computers. On each computer a programm will run. There is no centralized server. The program can choose by defined criteria to give another computer specified data. While doing so, the other computer should not do the same. (A sort of 2 way synchronize) Let's make an example. (C1 .. Cn are the programs running on different computers) C1 sends C2 updated data. While processing is active, C2 should not ask C1 for update something else. The idea was: C1 sends a message to C2: PauseExecution() C1 sends to C2 items to be processed (updates some data on C2) C1 sends a message to C2: ResumeExecution(). C2 sends a message to C1: PauseExecution() C2 sends to C1 items to be processed (updates some data on C1) C2 sends a message to C1: ResumeExecution(). But now the biggest problem arises. If C1 sends a message to C2 to Pause, and C22 sends at the same tiem a message to C1 to Pause, both would block. There is no centralized server / shared memory for keeping a semaphore. Is there another pattern which can be used, so that n computers will not block? So this question is about algorithmic exclusion. Or is there another workaround for this problem, if no semaphore or mutex can be used?


title: Use Cases with respect to downstream systems

text: Use cases are primarily meant for interaction between user and a system. It could be used for interaction between system and another system. The actors are primarily roles. It is easy to document the use cases for a front end application like a portal where in all the activities and role performing the activity could be defined. However if the system is an order management or provisioning system which a downstream system how could the use cases be documented? For eg: An order management application may responsible for processing orders for type new install , change of service , cancel , reschedule , suspend , restart etc.These transactions could be triggered by from different sources by different means (service call , entry placed in db which OM application polls , order placed in jms queue - however I assume these have no relation to use case). Once an order is received Order Management application might have to interact with different applications (credit check , shipping , provisioning , activation , billing etc) depending on the order type. **EDIT: ADDED MORE INFO** I have an application that receives data from an upstream application. My application consumes webservices exposed by multiple other applications in order to fulfill a task. The data flows through multiple applications before reaching the upstream system which sends messages to my application. The activities that my application does are install, disconnect , suspend, restore etc using multiple services that it consumes. When I read posts on having system as actors, the primary aim seems to be demarcating and defining the interfaces properly. In the scenario above assuming the upstream system is A, my application is B and the applications that my application consumes are C, D, and E. 1) My aplication performs install , disconnect , restrat and suspend. Are these the activities? 2) Will the primary actor be the system sending messages to my application? I can't think of this as a role and also there no interaction between the upstream application and my application after the point when my application recieves a message. 3) How can I define the external applications that my application consumes? as actor or activity? or i need not care about these in use case diagram? When you take an interaction between user and a system for shopping a product - you will list the series of interations between you and the software. However what software does internally is not specified. Here in my case , since it is a downstream system , the upstream system sends only one message and there is no series of interaction. Hence I am in a quandry as to how I should define the scenarios.


title: Reports from the front lines: VS Lab Management

text: I'm looking into Lab Management right now for our test environment for manual and automated testing. I'm just getting started on the process of putting together various servers to host/support it and then I'll be making some dummy projects and working through the process. Currently, we are using System Center Virtual Machine Manager (SCVMM) to create VMs and we build systems on them. Our workflow for manual testing is more-or-less like this:   1. Build VMs with supported platform (OS, Pre-req software, etc.)   2. Install latest build, or any build noted in a bug that we're trying to repro   3. Snapshot the VM   4. Test or Repro   5. Snapshot when bug is seen   6. Create bug in TFS, gets assigned to Dev   7. Dev usually asks to see the VM, they login and do what they need   8. While the Dev is working on a fix we write automation to perform the repro (using internal tools - this is a bit of a weak point) or move on to a different bug retest or something   9. Doc anything important that the team might need to know in the future in our wiki   10. When we get a fix, we basically return to the snapshot created in step 5 and run the automation (if it was completed - sometimes they can take time that isn't available) I was wondering if anyone else has used lab management or is currently using it in a production environment. I would like to ask those people: Test Side:   * What tangible benefits have you seen from using lab management? What's easier? What's harder? (compared to what you were doing before)   * Considering what we're using now, where can you see weak points being that lab management will help significantly?   * How does writing automation compare to any other methods you've used? Dev Side:   * Do the bugs created using lab management provide everything you need? The marketing for lab management shows lots of info auto-generated and being able to hop into a snapshot seems to help, but I can't see how you would be able to easily step through anything in a debugger without having pulled down the code base and having a dev environment setup on the VM (not likely in our case, codebase is quite large).