How to host a site in another site - with little or no coding

**SUMMARY:** All of these happens on Site A   * User visits site A   * User enter username and password   * User click on Login Button   * User authenticated on Site B behind the scene   * User is shown a page on Site A that contains his/her profile from Site B as layout/styled from Site B   * User can click links in the Profile page that links to other area in Site B Meaning: Session has to be maintained somehow I have web application where I store users' password and username. If you logon to this site, you can login with the password and username to have access to your profile. There is another option that requires you to login to my site from your site and have your profile displayed within your site. This is because you might already have a site that your clients know you with. This link is close to what I want to do: http://aspmessageboard.com/showthread.php?t=235069 _A user on Site A login to Site B and have the information on site B showing in site A. He should not know whether Site B exists. It should be as if everything is happening in Site A_ This latter part is what I don't know to implement. I have these ideas: Have a **fixed IFrame** within your site to contain my site: but I am concerned about size/layout since different clients have different layout/size for their content section. I am thinking of how to maintain session too **A webservice** : I don't know how feasible this is since the Password and ID are on my server. You may have to send them back and forth. It means client would have to code with my API. _But I am not just returning data, I have to show them a page that contains the profile details_ **OpenID, Single-SignOn** : Just guessing - but the authentication and data resides on my server. there is nothing to access on your side in this case Examples: like login into facebook within my site and still be able to do post updates, receive notifications Facebook implement some of these with IFrame e.g. the Like button *NOTE: * I have tested the IFrame option. It worked but I still have to remove my site specific content like my page Banner, Side Navigation etc. I was able to login normally as if I was actually on the site. This show my GUI but - style sheet was missing - content not styled with CSS - Any relative url won't work. It would look for that resource relative to the current server. Unless I change links to absolute - Clicking on the LogIn button produces this error: _The state information is invalid for this page and might be corrupted._ **UPDATE:** I was reading about REST webservice few days ago and I got this idea: What about the idea of **returning an XML from a webservice [REST or SOAP] and providing an XSLT (that I can provide) to display it**. Thus they won't have to do much coding?


Where can I find articles on why interruptions are bad for programmers?

I've read/heard that interruptions are bad for programmers. I've also read/heard that getting into 'the zone' is good. I don't doubt these assertions, but I'd like to educate colleagues (managers, mainly) and family members (for when I work from home) about the perils of interruptions and the productivity gains to be had from 'the zone'. So could anyone point me to articles and/or books that make the arguments well? Feel free to make those arguments here in an answer if you like. It would be helpful if there were some in there that were aimed at managers and non-programming colleagues.


How do you explain the complexity of bulk emailing to a manager?

I think we've all been there, you've been asked to write something to send bulk emails for whatever reason. It's a solved problem, theres a multitude of companies out there to handle this for you, and theres no point in catching up on their many years of single minded focus on making sure your email reaches its destination without being waylaid by spam filters. Now, I could go into a point by point talk about DKIM, SPF, ISP rate limits, content inspection, bounces, getting blacklisted, getting unblacklisted etc, but the eyes will glaze over. How do you convince a non technical manager of the issues around bulk email like this?


Who owns modifications to open-source software?

Suppose a piece of software is distributed under some permissive license, e.g. BSD. Now, I modify this software and want to distribute my derivative work. My questions:   * Who is the owner of the derivative? Is it the original author, the new author or there is joint ownership?   * Is a copyright notice (say under the original copyright) sufficient to establish the new ownership?


Generic name for types and values

In computer science, what is the abstract common name of types and values (I mean an abstract "something" that can be a type or a value) ? To be more specific:   If we have `template <typename X>` or `template <int X>` what is the abstract name of `X`?


C# Delegates are immutable - but why does that matter?

This is a followup question to this other question. **Background** Working from the MSDN Delegates Tutorial (C#), I see the following: > Note that once a delegate is created, the method it is associated with never > changes — delegate objects are immutable. And then, in the code sample, I see this (Spread out a little througout the code):               public delegate void ProcessBookDelegate(Book book);          bookDB.ProcessPaperbackBooks(new ProcessBookDelegate(PrintTitle));     bookDB.ProcessPaperbackBooks(new ProcessBookDelegate(totaller.AddBookToTotal));      **The Question** Now obviously, the way the code is written here a new delegate is created for each process. I am _guessing_ the immutability is relevant if you try to do stuff like               ProcessBookDelegate thisIsATest = new ProcessBookDelegate(PrintTitle);     ProcessBookDelegate thisIsATest = new ProcessBookDelegate(totaller.AddBookToTotal);      which should... still compile when `thisIsATest` is immutable? So what problem has Microsoft solved by making it immutable? What problems would we run into if C# 6 made delegates mutable? **EDIT** I believe the immutability will prevent this:               ProcessBookDelegate thisIsATest = new ProcessBookDelegate(PrintTitle);          thisIsATest.ChangeTheDelegateInABadFashion();          someFunction(thisIsATest); //This function works as normal                                //because the delegate is unchanged                                //due to immutability      but the immutability will NOT prevent this:               ProcessBookDelegate thisIsATest = new ProcessBookDelegate(PrintTitle);          thisIsATest = new ProcessBookDelegate(ChangeTheDelegateInABadFashion());          someFunction(thisIsATest); //This function works weird now because                                //it expected the unchanged delegate      Am I correct in this understanding?


How to test a random feature in MS Excel/WORD/PPT

Interviewers often ask questions about testing a random feature in Excel, Word, Notepad etc.. I am someone who will be interviewing for a SDET position and has a SDE background not specifically SDET background. I am extremely interested in testing though so applied for a SDET position. So how should one go about testing a random feature in a software, especially word/excel/notepad kind of software? Exploratory testing? What about a feature like File-> open dialog in word/Excel/ How to tackle such interview questions? What is an interviewer specifically looking for in an experienced candidate when he/she asks such questions?


Is there a way to help streamline your typical developers discussions?

Often, my colleagues and I run into specific problems, for example what's the best way to deploy this, or would this or that technique be a good one to use, or just "hey, have you seen that new thing". However at the moment this communication goes via mail, or skype, or twitter, and a lot of information becomes hard to find very quickly. Is there a service or methodology to keep this kind of information ordered and traceable?


Best method in PHP for the Error Handling ? Convert all PHP errors (warnings notices etc) to exceptions?

What is the best method in PHP for the Error Handling ? is there a way in PHP to Convert all PHP errors (warnings notices etc) to exceptions ? what the best way/practise to error handling ? again: if we overuse exceptions (i.e. try/catch) in many situations, i think application will be halted unnecessary. for a simple error checking we can use return false; but it may be cluttering the coding with many if else conditions. what do you guys suggest ?


How can I view github tasks which are not assigned to a person?

On the main Issues page, you can click `Everyone's Issues`, or `Assigned to me`. If you want to view the tasks assigned to a particular person, you can click the `search` icon, and on the left choose the `assigned to anyone` drop-down, then choose from a list of assignees. But how to I list all the items which are not assigned to anyone?


Is there a canonical book for CMS design patterns and concepts?

I've been trying to understand the fundamentals of content management systems: I've looked into APress's _Pro ASP.NET 4 CMS_ , but it dives into implementation, dedicating a lot of time to technologies and not core principles. Is there a book out there that's the de-facto standard for describing best practices, design methodologies, and other helpful information about content management systems? What about that book makes it special?


Appropriate uses of fall-through switch statements

When is it appropriate to use a fall-through (classic) switch statement? Is such usage recommended and encouraged or should it be avoided at all costs?


Why are pointers not recommended when coding with C++

I read from somewhere that when using C++ it is recommended not to use pointers. Why is pointers such a bad idea when you are using C++. For C programmers that are used to using pointers, what is the better alternative and approach in C++?


How to learn Java web application development?

I’m planning on making a Java web application using Amazon Web Services Elastic Beanstalk. AWS Elastic Beanstalk basically provides PaaS on top of AWS’s cloud computing resources. The problem I’m having is trying to learn how to make a Java web application. I’m familiar with making basic programs with Java (1st year computer science stuff) and have read the Head First java book, however I’m totally clueless when it comes to a large project like this. I’ve tried to find a suitable tutorial in the AWS docs, but as far as I can tell it assumes you know how to make Java applications. I tried the Oracle Java docs, and I’ve been searching the internet for something useful.    The problem is that all the resources I find assume familiarity with what I’m trying to learn. Ideally I would like an article or tutorial that describes the process and how to make a Java web app that assumes only basic knowledge of the Java programming language. So if anyone can offer any advice, or docs that could help me achieve that goal, I would greatly appreciate your help :-)    Thanks in advance, and I apologize if it seems that Googling could answer this question, but I have honestly looked quite hard to find some way of learning this and have come up with nothing. So I’ve come to you guys - the experts ;) - who presumably knew as little as I did at the start.       Basic details of the app:   It will have a web based interface as well as Android and iOS apps to connect to it. It will be of medium complexity and will involve user interaction. For the browser based part it will involve taking payments from users if they wish to buy a premium part of the service.


How do you track your progress in a project?

Here's the type of situation that I've been struggling with, and I'm certainly not the first:   * Project has a budget based on the estimated time to develop the solution   * Deadline to turn project over to the PM for QA is one some date   * I am working on multiple projects at once, and each has a budgeted number of hours and deadline Tracking my progress against a budget and deadline would be pretty straightforward if I knew exactly how I was going to implement it, and only had one or two projects to focus on at a time. However, I'm building websites with Drupal, and every project includes some functionality that might be available as module - or the available module won't work at all, and it will require significant effort to build that functionality. What strategy have you found most helpful to keep track of where you are in a project so that you can accurately report to the PM how far along you are, and identify early on if the project is in danger of running late or going over budget, especially in cases where the time required for some parts is unknown?


Make a monolithic architecture in something modular

Currently my architecture is a monolithic block that handles a really specific duty. Now it needs to be generalized. Right now it handles a request and all processes (1 or many) associated to it. There's a class `Request` and a class `Process` and since it serves one specific duty this model was OK. Right now I need to split both classes to achieve modularity. For instance, the `Request` class should be split. So I'll still have a `Request` class, which holds general request information, and many `RequestDetailsForServiceOne`, `RequestDetailsForServiceTwo` and so on, that hold detailed information relatively to a specific type of request. Equally for `Process`. _The question right now is: how to bind together`Request` class with `RequestDetailsForServiceOne` (at run time)?_ I had thought about Dependency Injection, but `RequestDetailsForServiceOne` and `RequestDetailsForServiceTwo` doesn't share any common behaviour, (that classes only store some properties), this way will drive me to code an `IRequestDetailsForService` completely empty. That sounds as a code-smell to me. Would be a better idea in this case use, (inside `Request`/`Process` class) a Dictionary of properties and completely avoid `RequestDetailsForService*` classes? I don't really like the loss of type-checking that this way get me back. What would be an ideal solution?


Does WinRt have support for .Net Framework and Wpf?

I want to find out if   1. WinRt does or not support .Net Framework?   2. WinRt does or not support WPF? Our company has developed applications using WinForms and they want to have them also running on WinRt. So is it possible to use classes developed under .Net Framework 4.5 in WinRt?


What type of projects should each of these projects be given their particular purposes?

I'm working in a creation of a new system that should be able to change the presentation layer without trouble, also be able to comport web-services, shop areas, internal control of data, creation of reports, multiple web portals, etc. Following this post about the "benefits of multiple Projects and One Solution" on Stackoverflow also in some self-experience I came with the idea of the following structure.   * TestProject.BLL (Business)   * TestProject.DAL (Persistence (Mappings, Conventions etc))   * TestProject.WEB (Presentation Layer)   * TestProject.BASE (Framework) But, after some search on the web, I found that those project are **not** always the type of " **ASP.NET Web Application** ". * * * My question is, what are the types that I should create each project? Should I build them as " **Windows Forms Application** " or what?


Solving which bugs will give greatest cost benefit

I wanted to get an idea of categorizing bugs based on how easy is it to solve and how much benefit it will give me. for e.g., if there is a bug which will take say an hour (double file close etc.) to solve vs another which takes a day (segmentation fault). But if solving the first bug is not very important, then I'll probably work on the second one. Are there any research papers which categorize bugs based on cost-benefit or similar metric? [EDIT] Let's say it is possible to categorize bugs based on bug characteristics e.g. security vulnerability, memory error, logic error etc. On the other dimension there could be parameters like difficulty (easy, medium, hard). Are there other dimensions I should be looking for. To simplify things, I can assume two things:   1. Every programmer in the team is equally capable of solving any bug   2. There is no deadline


EF vs. NHibernate

In the past 2 years since I started writing business applications (before I did either high level front end or very low level systems programming), learned datasets, linq to sql, and now entity framework. The logical thing to look at next seems to be NHibernate. Reasons I eventually ended up at EF are: (1) it has the best designer support and (2) it is the most supported by Microsoft. Reasons (these have elements of assumption) I am interested in NHibernate are: (1) it might not get superceded by a totally different thing as quickly as MS churns data access technologies (2) It seems like its either the front running or second to front running tool for what it does and (3) It appears to be stable and tracable back through time quite a bit. Has anyone published a comparioson of the two? Is one better than the other for certain types of architectures? Or is it just a matter of style and preference?


c# Web Content Filter

Can anyone point me to any GOOD open source .NET parental web content filters? I would like to gain an understanding of how I can filter/block web traffic based on Url and/or keyword. I've looked on google but can't seem to find any developed c#


Should a stack trace be in the error message presented to the user?

I've got a bit of an argument at my workplace and I'm trying to figure out who is right, and what is the right thing to do. Context: an intranet web application that our customers use for accounting and other ERP stuff. I'm of the opinion that an error message presented to the user (when things crash) should include as much information as possible, including the stack trace. Of course, it has to start with a nice "An Error has occurred, please submit the below information to the developers" in large, friendly letters. My reasoning is that a screenshot of the crashed application will often be the only easily available source of information. Sure, you can try to get a hold of the client's systems administrator(s), attempt to explain where your log files are, etc, but that will probably be slow and painful (talking to the client representatives mostly is). Also, having an immediate and full information is extremely useful in development, where you don't have to go hunting through the log files to find what you need on every exception. (But that could be solved with a configuration switch.) Unfortunately there has been some kind of "Security audit" (no idea how they did that without the sources... but whatever), and they complained about the full exception messages citing them as a security threat. Naturally, the clients (at least one that I know of) has taken this at face value and now demands that the messages be cleaned. I fail to see how a potential attacker could use a stack trace to figure anything out he couldn't have figured out before. Are there any examples, any documented proof of anyone ever doing that? I think that we should fight this foolish idea, but perhaps I'm the fool here, so... Who's right?


Picking a card from a shuffled deck

I'm pretty new to Haskell although I did some ML many moons ago. I'm trying to set up a deck of playing cards, shuffle them and then deal them. I have the deck and shuffle sorted (of a fashion) but I'm not sure what I'm doing after that. This is what I have so far:               import System.Random     import Data.Array.IO     import Control.Monad          -- | Randomly shuffle a list     --   /O(N)/     shuffle :: [a] -> IO [a]     shuffle xs = do             ar <- newArray n xs             forM [1..n] $ \i -> do                 j <- randomRIO (i,n)                 vi <- readArray ar i                 vj <- readArray ar j                 writeArray ar j vi                 return vj       where         n = length xs         newArray :: Int -> [a] -> IO (IOArray Int a)         newArray n xs =  newListArray (1,n) xs          ranks=[2..14]          suits=[1,2,3,4]          cards=[(r,s) | r <- ranks, s<- suits]          deck=shuffle cards               myAction :: IO [(Integer, Integer)]     myAction = shuffle cards          main :: IO ()     main = do         xs <- myAction         print xs      There was no particular reason I chose that list shuffler other than the reason I could interrogate (or at least display) the resulting list. I'd like to be able to pull items off the returned **IO [(Integer, Integer)]** but I'm not entirely sure how to proceed. I understand that I can't simply convert it to a vanilla list (this is covered sufficiently elsewhere) so presumably I either need to:   * extend the IO (monad?) somehow   * write a custom list of tuples shuffler   * write my own monad   * use some other method I haven't learnt yet Anecdotally, I believe this can be done "uncleanly" but I don't want to go to programmer hell until I understand how hot the fires are... Any idea how best to proceed?


Technologie Roadmap: Portlet JSR286 vs Widget/Gadget

IBM got me confused (again). For many years IBM have been pushing for Portlet Containers with the JSR 168 and later the JSR 286 Specification. 2008-2009, IBM the Lotus division introduced the iWidget Specification. Based on my reading, it is a more dynamic and lightweight version of the Portlets, close to Google Gadget. It uses a different paradigm than Porlet while providing the same features. A major differentiator with this kind of client side technologies is that you don’t need a big and costly Portal infrastructure. To not fall in the ‘It depends on needs’ discussions, let consider the following:               * New company, no legacy portlet, no portal in place.      What are your thoughts on this?


Learning to Program in Assembly - Useful Resources

Following on from a previous thread, it has got me interested in learning a little about Assembly programming. Not so much for wanting to program useful apps in, just to get a feel for low level programming to better understand what is happening. Can anybody recommend any books or online resources for beginners? Thanks.


What do you do when you have to work on a project using a language that you hate?

I've recently been assigned to work on a project written in PHP. I can't change that, and have no intention of really trying. However, this can't be an uncommon scenario. How do you motivate yourself to work on the project when the code you're looking at and producing constantly makes you want to cry? EDIT: It should be noted that this is pretty much the only on-campus job doing anything software related available at the moment, so "just change jobs" isn't really an option :(


How to explain a project for a potential employer

I went to an interview last week for a junior programmer and mentioned that I have been working on a project with a buddy of mine. Tomorrow they would like to see this project in order to decide if they should hire me or not. So I was wondering:   * What parts of a project are of interest to someone who has not seen the project before?   * What could I show that would change their perspective of me as a programmer and what I know? The project is in C# and have been a hobby project for 6 months now. Without going into to much details:   * it's a networked program   * it's server / client based where clients end up connecting to each others   * there is synchronization of data between clients   * we are using files to store information about the different clients, which is also being synchronized   * the program in whole is divided into some different projects (some which go into .dll's)   * the project will later handle multiple layers of displaying the data to the user (meaning cmd, a window etc..) I have green lighted this with my buddy as well and it is ok to show. My idea was to show the shell (cmd) that we have which is working and the top layers of the hierarchy, the ones that the shell communicates directly with. These are three classes in particular, one that connects and communicates with the server, one that handles the synchronization and one that handles the objects that are being synchronized. I'll try to go into some details about how we store the objects and how this is communicated to the synchronizer class. Then discuss on a higher level of how we synchronize the data, ending with going into some detail about how this is done.   Basically, **start from an abstract layer and go into detail where the magic happends.** But I wonder how this will be understandable for someone who has never seen our project before. How will this show that I am a better or worse programmer than my next? They are programmers so I guess they will understand the basics and be able to follow the functions and what the code do. But I know that _I_ have trouble with understanding the overall picture of a project, much less in 1-2 hours. Also, I wouldn't know how to decide if it was a good programmer or bad unless I saw some bad code. So my question is:   1. Is the above idea something to work on? (top > bottom)    2. Should I concentrate more on algorithms?   3. Should I try to build a UML diagram or some other visual representation of the project?  Any other ideas?


What should I ask interviewer during the interview?

I have an SDET interview upcoming in a week. I have been preparing for a long time. It is a good company. I am working as SDET for two years. I wonder what questions I should ask my interviewer regarding testing and other things. I would appreciate your help if you give me some sample questions that I should ask my interviewer during the interview. Some of them I thought are:   1. What type of testing methodologies do you use?    2. Do you have triage meeting everyday?    3. What percentage of code coverage is done by unit tests? I do not find these questions to be more effective. I would appreciate if somebody could help me out in coming out with better questions.


What does "Released under MIT and GPL license" mean?

There are lots of projects released under more than one license. One example is Mozilla's tri-license, which states that the Software is released under the MPL, but the user can also choose GPL or LGPL instead of MPL (I think this is because the MPL license is incompatible with the GPL license). However, I came across projects released under both the GPL license and the MIT license. What conditions must be met in this case? For the MPL/GPL/LGPL case, things are clear because you can choose MPL or GPL or LGPL. But from GPL & MIT I understand that the conditions from both licenses must be met at the same time in order to use it, and this doesn't make much sense because they have different purposes. In this case, should the MIT license be interpreted as an exception, similar to, for example, the QT's LGPL exception or as an additional set of conditions on top of the GPL license?


HTML in docblock comments?

In the PEAR standards there is no reference to HTML, if its allowed or not. http://pear.php.net/manual/en/standards.sample.php But I see some people use HTML tags like `<kbd>` and stuff.. So is HTML allowed? Will it break some doc parsers?


How to become a Kernel/Systems/Device driver programmer?

I currently work in a professional capacity as a software engineer working with the Android OS. We work at integrating our platform as a native daemon among other facets of the project. I primarily work in Java developing the SDK and Android applications, but get to help with the platform in C/C++. Anywho, I have a great interest to work professionally developing low level for linux. I am not unhappy in my current position and will hang around as long as the company lets me (as a matter of fact I quite enjoy working there!), but I would like to work my way that direction. I've been working through Linux Kernel Development (Robert Love) and The Linux Programming Interface (Michael Kerrisk) (In addition to strengthening my C skills at every chance I get) and casually browsing Monster and similar sites. The problem I see is, _there are no entry level positions._ How does one break into this field? Anytime I see "Linux Systems Programmer" or "Linux Device Driver Programmer" they all require _at the minimum_ 5-7 years of relevant experience. They want someone who knows the ropes, not a junior level programmer (I've been working for 7 months now...). So, I'm assuming, that some of you on stackoverflow work in a professional capacity doing just what I would like to do. How did you get there? What platforms did you use to work your way there? Am I going to have a more difficult time because I have my bachelors in CSC as opposed to a computer engineer (where they would experience a bit more embedded, asm, etc)? _EDIT FOR CLARIFICATION!_ I am aware of the opensource nature of the linux kernel/drivers etc. I plan on contributing regardless of where my day job is. I'm more curious of what kinds of entry level positions will allow me to do relevant work and get paid doing it! Thanks for all the replies so far!


Time allocated to code reviews

If you are doing code reviews   * How much time do you spend on code reviews, compared to implementation?   * How much of the changes undergo code review?   * you think it's to much / should be more? Are there any studies about effectiveness? [edit] thank you all for the answers, it's hard to pick a "winner" for such a question, there is lots of valuable info in the other replies, too.


Mathematical Knowledge Required prior to entering Computer Science

I am currently a College Student in a Systems Analysis (3 year course). I am about to finish my course and would like to enroll in Computer Science at a University near me. I have a deep interest in learning sorting algorithms, measuring time complexity, cryptography, systems programming and security research. I am bored by the typical, high-level knowledge; java and general algorithm knowledge. I have absolutely no problem learning and utilizing new programming languages, mentalities and syntaxes. My only worry with regards to entering this course is what Mathematical knowledge is required prior to entering. I have done linear algebra but not quadratic equations; I have not done Calculus, nor have I done any Big-O notation. I plan on enrolling in 1 (one) year, so this gives me one year to prepare. I would like to know what I should be studying and reading to prepare. Books, worksheets, videos and any sort of advice or opinion(s) would be greatly appreciated. I have a great passion for efficient computing/programming and solving problems in the most efficient manner. I'm just trying to figure out if I would be in over my head entering Computer Science. Some people have said that I am to old, 22 this year, I would love to hear the opinions and advice of the Stack community. Thanks To All In Advance,


What is design pattern/paradigm for ASP.NET web-apps?

I don't actually know if my question is correct, but working on a webapp porting from ASP.NET world to Java + Spring platform I came up with this question in mind. Using Spring MVC, the new version of the the application, I'm obviously applying MVC pattern, but which was the ASP.NET design/paradigm. I know that ASP.NET uses event-oriented paradigm, but is this a design pattern? Hope to be clear...


And at what point of modification to the original does source code with no license become owned by me?

I've recently come across a publicly viewable project on Github that has no license associated with it. In this repo, there is a file with the logic and most of the code needed to work as a piece of a project I am working on. Not verbatim, but about 60% of it I'd like to use with various modifications. Once my code base is a little bit more stable, I plan to release what I've done under the WTFPL License. I've emailed the repo owner, and so far have not gotten a reply. I know I have the rights to fork the repo, but if I release a stripped down and modified version of the other project's file with mine, under the WTFPL, am I infringing on copyrights? Per Github's Terms of Service, by submitted a project on Github and making it viewable to the public, you are allowing other users to see and fork your project. Doesn't say anything about modifying, distributing, or using the fork. And at what point of modification to the original does it become owned by me?


Performing a Depth First Search iteratively using async/parallel processing?

Here is a method that does a DFS search and returns a list of all items given a top level item id. How could I modify this to take advantage of parallel processing? Currently, the call to get the sub items is made one by one for each item in the stack. It would be nice if I could get the sub items for multiple items in the stack at the same time, and populate my return list faster. How could I do this (either using async/await or TPL, or anything else) in a thread safe manner?               private async Task<IList<Item>> GetItemsAsync(string topItemId)     {         var items = new List<Item>();            var topItem = await GetItemAsync(topItemId);              Stack<Item> stack = new Stack<Item>();                    stack.Push(topItem);         while (stack.Count > 0)         {             var item = stack.Pop();             items.Add(item);                                     var subItems = await GetSubItemsAsync(item.SubId);                  foreach (var subItem in subItems)             {                 stack.Push(subItem);             }         }              return items;        }      I was thinking of something along these lines, but it's not coming together:               var tasks = stack.Select(async item =>     {         items.Add(item);                    var subItems = await GetSubItemsAsync(item.SubId);              foreach (var subItem in subItems)         {             stack.Push(subItem);         }        }).ToList();          if (tasks.Any())         await Task.WhenAll(tasks);      The language I'm using is C#.


Displaying and processing objects in a list?

I currently have code like this to display some objects that meet some criteria in a grid:               // simplified     void MyDialog::OnTimer()     {         UpdateDisplay();     }          void MyDialog::UpdateDisplay()     {         std::list<MyClass *> objects;         someService_->GetObjectsMeetingCriteria(objects, sortField, sortDirection);              for(std::list<MyClass *>::iterator it = objects.begin();             it != objects.end() ; it ++)         {             AddObjectToGrid(*it);         }          }         This works fine. Now the requirement has come in to process these objects when they meet some criteria. The information on the objects can change quickly so it would be most desirable to check if an object meets criteria and then process it immediately and continue on in this fashion. My question is how to best architect this to handle the display and processing. I could simply add a method to process the object such as:               for(std::list<MyClass *>::iterator it = objects.begin();         it != objects.end() ; it ++)     {         ProcessObject(*it);         AddObjectToGrid(*it);     }      However ideally I'd check if an object meets the criteria immediately before processing it to ensure its acting on the most recent info. In this example, all the objects are checked to see if they match the criteria and then afterwards each one is processed. Also I'm concerned this is coupling the processing code with the display code although I'm not sure how to separate them or if it's even necessary. I could solve that like this:               void MyDialog::OnTimer()     {         ProcessObjects();         UpdateDisplay();     }      But then I'm iterating over the list of objects twice, once to process and once to display. Finally I could do something like:               // simplified     void MyDialog::OnTimer()     {         ProcessAndDisplayObjects();     }          void MyDialog::ProcessAndDisplayObjects()     {         std::list<MyClass *> objects;         someService_->GetAll(objects, sortField, sortDirection);              for(std::list<MyClass *>::iterator it = objects.begin();             it != objects.end() ; it ++)         {             if(someService->MeetsCriteria(*it))             {               ProcessObject(*it);               AddObjectToGrid(*it);             }         }     }         Overall what's holding me up is I'm worried about coupling the display and processing code together and the code running efficiently because timely processing is critical. How can I best structure this code?


What to look out for in employment contracts

I thought of this today after a co-worker looked through the contract they had signed several years ago and was quite alarmed. What should one look out for before signing a contract, as most employers _will_ get you to sign one. Please post ideas separately so they can be voted individually.


Should a website use its own public API?

I am starting to write a webservice, and I've built with nodeJS and a RESTfulish approach. From what I gather:   * The advantage is that you don't have to duplicate code.   * The disadvantages are that you:      * will update the public API frequently, but should be solved with versioning     * can't really make service specific caching and optimizations What is considered best practice? Do sites such as Stack Exchange, Github, Twitter, etc use their own APIs for their clients?


Design Patterns / Strategies For Custom Fields & Data Types

Are there any common strategies or design patterns for designing applications that have either the ability to add custom fields to data objects, or for creating your own custom definition of objects. For example, I am thinking of products such as SalesForce, where you can have your own types of information,frameworks such as Expression Engine and the way it handles channels and channel field groups (Example), or How CMSes Like wordpress have the ability to add fields to custom post types.


Understanding bitmap logic

I was going though this blog and it says > You can represent a list of distinct integers no larger than N using exactly > N bits: if the integer i appears in your list, you set the i th bit to true. > Bits for which there is no corresponding integers are set to false. For > example, the integers 3, 4, 7 can be represented as 00011001. As another > example, the integers 1, 2, 7 can be represented as 01100001. Can someone please explain me how [3, 4, 7] = 00011001 and [1, 2, 7] = 01100001 and also why 8 bits are taken?


Is there a difference between property and attribute?

These two words are completely synonymous for me, but I wonder if there's actually a useful semantic difference that I can incorporate into coding/naming conventions/process.


Why are we still using the DOM in the browser rather than a desktop paradigm

From my understanding, the web interface was developed to use HTML because at the time it wasn't possible to simulate a desktop style application in the browser such as how Silverlight and Flash work, because of bandwidth limitations, and possibly processing power. Why hasn't there in the past, and the present been a larger acceptance and push for technologies like Flash/Silverlight? From my experience they are more pleasing to develop with (of course my opinion), and you don't have to deal with cross browser compliance, and older browsers (for the most part). Handling postbacks, AJAX, etc seems like extra unnecessary effort compared to the development paradigm of desktop applications. Do the DOM and it's complimenting technologies continue to thrive mainly on the fact that Silverlight/Flash requires a plugin install, and some mobile devices don't support the plugin?


The practical size limits of an AngularJS based application

We have been tasked with replacing a series of 25 year old mainframe applications with web applications. There are 4 applications in the series and we are trying to come up with a stack that will work on all 4. Now these applications are big. Not huge, but big. Based on the work that our sister company did to replace similar pieces of their systems, the small one is expected to come in at about 150k lines of rest service code and about 80k of UI code. For the big one, a million of service code and 200k of UI code isn't out of the question. The small application, so far we have about 150 different views, The big one has about 500 we know about. Now I understand that line numbers are a bad metric to use, but at the moment, its the best i got, so lets just go with that. So in the world I typically work in, this is one medium size application and three large ones. The next issue we have. Across the board, all systems. No user action is to take more than one second. Meaning, if you come into an application, the app has to be loaded and ready to login within one second. If you click on a search button, the response has to be displayed within one second. We have people that use the mainframe systems that process paperwork and in order for them to hit their daily quota, they have to average a start to finish processing time of 15 seconds for each case. The green screens they use right now just barely hit that mark. Dont get me going on eliminating the paper. State and Federal law requires it. So we already know that we have to build the app in such a way that a user can use it without touching the mouse. No way are they going to hit their quotas if they have to be mousing all over the place. Thats not such a big deal, we can define hot keys to do that. But the big issue is the speed. The typical internal framework is JSF. The standard is RichFaces, but many years of horrible performance out of Rich has finally convinced them to move to Prime. We would be about the 2nd or 3rd to use Prime. But since our performance requirements are the highest they have ever encountered, they asked my team to evaluate different frameworks. For internal applications, the current acceptable response time is between 5 and 7 seconds. Pretty typical in an enterprise, usually pretty easy target to hit with JSF. So we spent the past 5 weeks evaluating various options and by leaps and bounds the highest performing framework was GWT. In our benchmarks it blew Vaadin and JSF/Prime completely out of the ball park. Also, aside from JSF, its pretty much the only thing we could find designed to handle applications of this size with surprising ease. (Struts and SpringMVC are strictly forbidden in our enterprise) Then the problems started. Our Enterprise group said no, we can't use it. They acknowledge the fact that there is very little chance of JSF pulling off our performance requirements and the only practical way of hitting our goal is a thick browser front end, but, instead of GWT, they want us to use Angularjs. For the purpose of this post, lets not get into why they said no, lets just stick to the fact the answer was no. So, the past 2 days, I started digging into Angular. So far, I'm not impressed. It looks ok for very small applications (compared to what I normally deal with) but I can't find anything anywhere that shows an experience in trying to build an application of the size that I need to build. The closest I found was a guy talking about his "Enterprise" application he built with Angular that was about 9k lines. He said it was a bitch to pull off, mostly from inexperience, but once he found the tool Lineman, it became tolerable and he was able to pull it off. In the applications I need to build, 9k lines won't cover the logic I need to build into my search UI (so far we have identified about a dozen different ways to search for various data, and counting). To say nothing about actually doing anything with the results. So I called up two of our really, really good developers and asked their opinion. After we got past the initial "Your out of your mind, that's what GWT was built for" phase of the conversation, it was settled that to try to pull off apps of this size as single page javascript apps, like you can in GWT very easily, would be complete suicide. Angular just simply wasn't designed to go that big, it was designed for tiny stuff. Mobile apps, small web apps, etc. Nothing of this scale. The idea is we have to break the app into smaller modules. But, this brings the problem of how to transfer application state from one module to the other. This problem has been tackled at this company before with very poor results. But, they had an idea. Since we can't switch out our Websphere servers for Node.js, Their suggestion was to try a hybrid approach. The idea is to create a JEE6 Conversation bean. Then create a JSF file for each module of the application. That JSF would be linked to the conversation bean. This way, each module can run Angular to handle the MC side and the V side can be basic HTML with Twitter Bootstrap to make it pretty. When the user switches from one module to another, the JS application state is posted to the conversation bean. The conversation bean then redirects you to the new JSF module page, then the JSF can grab the object that represents the current application state from the conversation and pass that to Angular, loads it and they are off to the races. Then of course Angular would talk to the REST services directly. We are using the slow ass JEE stack as little as possible, but still able to sorta easily move app state from one module to another. The stack sounds ok to me. We have the ability to break the app into modules, if the module gets too big, we can break them into sub modules, use the conversation to move the state from module to module, and we can use Angular. My problem with this stack is 2 fold. One, thats a lot of plumbing. Lots of things to go horribly wrong. Two, I can't find anyone that has tried something like this. Questions: What is the practical size limit of an application based on Angular that does not have the benefit of Node.js sitting behind it? I have been told by my UI programmers that when an application gets to the point of about 10k HTML elements within a single page JS module, the performance starts to degrade. When you hit about 25k elements, the performance drops off a cliff, and about 40k elements the app usually doesn't load. Are these numbers consistent with medium to large applications that you have written? For comparison sake, lets say Stack Exchange is a medium sized application, Google Drive is large. Does a design pattern exist for this scenario. Meaning does a pattern exist where you can break a large JS based front end app apart into modules that can be handled easier by the JS frameworks by using JSF or some other system to transfer the application state from one module to another. The failed attempt made in the past was to post the app state object to a web service and that service store it in an application scoped EJB to be retrieved by the next module. That technique failed miserably when the app came under any kind of meaningful load. Are there any other frameworks out there to consider that can give us the performance, scalability, flexibility, and ease of developing large applications like this that doesn't have Google in its name? BTW, I was told about Angular Modules about 15 minutes before I walked out the door today. All I really know about it is its name. If you think it could help me, please let me know. Thanks guys/gals. I'm really stumped here.


starting off with non trivial programs -- publish or not?

I've just started making some simple but non trivial(i think) programs in Ubuntu -- as of now have made a small xkcd scraper, which i plan to develop into a multi webcomic downloader+viewer At this point, would it be a good idea to start publishing the code on a site like Github or launchpad? (currently I'm not really worried about people copying my code/licensing) Or is it better to publish the code only after the program is completed? Also, can you suggest some such sites where I can post such codes and get suggestions for improvements/discuss the code with others?


Lisp: Benefits of lists as code over arrays as code?

Question for lisp programmers: Lisp code is lisp data, usually lists. Is there an advantage to code being lists over code being arrays? Would macros be easier to write/faster to run? You can assume that, in such a language (you could call it "arrap"), elements can be deleted from or inserted into arrays and that the arrays would grow and shrink as needed.


When initially releasing an app, do you hold some of the features back for future releases?

New to the site so sorry if this is the wrong section. I'm starting app development and wondering what is the best practice when initially releasing my app. Do developers tend to keep some of the features for future updates to keep users active, or do they try to release the most complete app possible? Basically, is it advised to release an app as soon as possible, and then periodically update it to the complete app you have in mind, or wait until you have it fully developed and release it with fewer update prospects? EDIT: Thanks for the answers. I am currently just designing the app and writing down all the features I can think of and trying to prioritize which to include to the initial launch. Based on the answers given, I think I will get a MVP (thanks for the term) out as soon as it is ready, and then update with new features as soon as they are built. I am not holding back built features, was just torn between if I should build them all before launch or just the necessary ones, release, and then build the others. As far as I am aware this isn't a clone. It is my first app though and I will be using it as a learning experience


Using continuous build results as part of performance review metrics?

My boss is planning to use the metrics from our continuous build (builds and runs tests on every commit) as part of our performance reviews (in our 'quality' metric). This seems like a REALLY bad idea to me, but I'd like to know if anyone has studied this or seen this tried before. My thought is that it's going to have our developers not put in as many tests as they otherwise would, for fear that the tests are going to fail. I feel that he's turning a valuable developer tool into a stick to beat the developers with. The obvious counter argument is that it will promote people being more careful before they commit, and therefore leading to higher quality. Am I off base here? Please leave aside the question of whether we should be doing performance reviews at all or not - that's been answered elsewhere.


Implicit optimization versus explicit optimization

To explain what I mean, let me start with an example. Consider a `deque` that supports `O(logn)` concatenation with another deque and `O(n)` addition of `n` elements at one end. This dequeimplements a general `seq` interface (or type-class, or what have you) that allows iterating over a collection. An explicit optimization approach would be, having a `concat` method (or function) for deque objects and a separate `pushSeq` method for seq objects. Each method would be documented with the appropriate complexity. An implicit optimization approach would be to have a single `concat` method that accepts a seq. An internal dynamic type test checks whether the supplied argument is actually a deque, and if so, calls an implementation method for concating deques. This is documented in the API. Obviously you could have both of these. The point of implicit optimization is that you don't give the user explicit control over optimization. It just "happens", unless the user deliberately looks for it. Right now I'm writing a library and I'm facing a very similar choice. I very much like the idea of a compact interface where things just "work". An implicit approach also gives me a lot more freedom. For example, maybe I can perform ten dynamic type tests to optimize the concat operation for different collections. Having ten different methods wouldn't make sense. What's your take on this? Which approach is better, and why?


What are standard directory layouts for storing database scripts in TFS?

I recently took over the maintenance of 10-15 SQL Server databases and to my surprise found out that the team does not store the code scripts anywhere. They currently deploy changes to each environment without any paper/code trail. The code for applications that use these databases are all stored in TFS and I need to implement a directory structure for storing the scripts - tables, views, stored procedures - in TFS. On our Oracle side of the house we use a two directory structure:   * ddl   * sql  But I think there could be improvement in storing the scripts on the SQL Server side. I was thinking of using something similar to the way SSMS stores objects:   * tables   * views   * stored procedures/functions Is there a standard structure or best practice that is used to store SQL scripts?


Why doesn't C# have local scope in case blocks?

I was writing this code:               private static Expression<Func<Binding, bool>> ToExpression(BindingCriterion criterion)     {         switch (criterion.ChangeAction)         {             case BindingType.Inherited:                 var action = (byte)ChangeAction.Inherit;                 return (x => x.Action == action);             case BindingType.ExplicitValue:                 var action = (byte)ChangeAction.SetValue;                 return (x => x.Action == action);             default:                 // TODO: Localize errors                 throw new InvalidOperationException("Invalid criterion.");         }     }      And was surprised to find a compile error: > A local variable named 'action' is already defined in this scope It was a pretty easy issue to resolve; just getting rid of the second `var` did the trick. Evidently variables declared in `case` blocks have the scope of the parent `switch`, but I'm curious as to why this is. Given that C# does not allow execution to fall through other cases (it requires `break`, `return`, `throw`, or `goto case` statements at the end of every `case` block), it seems quite odd that it would allow variable declarations inside one `case` to be used or conflict with variables in any other `case`. In other words variables appear to fall through `case` statements even though execution cannot. C# takes great pains to promote readability by prohibiting some constructs of other languages that are confusing or or easily abused. But this seems like it's just bound to cause confusion. Consider the following scenarios:   1. If were to change it to this:              case BindingType.Inherited:         var action = (byte)ChangeAction.Inherit;         return (x => x.Action == action);     case BindingType.ExplicitValue:         return (x => x.Action == action);      I get " _Use of unassigned local variable 'action'_ ". This is confusing because in every other construct in C# that I can think of `var action = ...` would initialize the variable, but here it simply declares it.   2. If I were to swap the cases like this:              case BindingType.ExplicitValue:         action = (byte)ChangeAction.SetValue;         return (x => x.Action == action);     case BindingType.Inherited:         var action = (byte)ChangeAction.Inherit;         return (x => x.Action == action);      I get " _Cannot use local variable 'action' before it is declared_ ". So the order of the case blocks appears to be important here in a way that's not entirely obvious -- Normally I could write these in any order I wish, but because the `var` must appear in the first block where `action` is used, I have to tweak `case` blocks accordingly.   3. If were to change it to this:              case BindingType.Inherited:         var action = (byte)ChangeAction.Inherit;         return (x => x.Action == action);     case BindingType.ExplicitValue:         action = (byte)ChangeAction.SetValue;         goto case BindingType.Inherited;      Then I get no error, but in a sense, it _looks_ like the variable is being assigned a value before it's declared.   (Although I can't think of any time you'd actually want to do this -- I didn't even know `goto case` existed before today) So my question is, why didn't the designers of C# give `case` blocks their own local scope? Are there any historical or technical reasons for this?


Design: multiple algorithms on the same large data sets

I have several algorithms that I would like to test against the same data sets to compare their results. I don't know how to design it so there is maximum readability and maximum efficiency. I have considered creating a class for each algorithm, and giving it a copy of the data to work with, but it doesn't seem that that is the right answer:   1. Each data set is fairly large (10,000 float numpy array), so I don't want to copy each one ~30 times.   2. Many of the algorithms have similar pre-processing routines (thus repeating them for each algorithm seems wasteful)   3. Some algorithms have nearly identical code, except a few parameters which are different. At the same time, having one function call per algorithm also seems wrong: as per (2), many will call the same preprocessing functions, and then it becomes very difficult to tell who is calling who. I want to be able to allow the user (which will be me) to easily call a variety of algorithms on the data, while keeping the code as clear as possible. I just keep thinking I need the inverse of a class; where each objects of a class will have the same methods but different data, I need something where each member will have the same data but different methods.


Fast cold start text editor

Is there text editor with c# syntax highlight which starts VERY FAST? I just want look source code some files in project and i donnt want wait 30 seconds while VS starts.


Where is the object browser in VS 2010

I am teaching myself C# and Im using a book that references Visual Studio 2008. However, I am using VS 2010. The book wants me to look at the object browser by choosing View, Other Windows, Object Browser from the menu. However, the object browser is not there. I moused over the icons on the menu and nothing stood out. So, where is it? Also, am I going to run into more problems like this? Is it worth getting an updated book?


Proper name for a project supports 2 different release

Is there a technical name for a software project where the current and prior stable releases are both maintained?


How does the Common Language Runtime improve performance?

I read on the wikipedia article for Common Language Runtime that one of the benefits that the runtime provides is "Performance improvements". Executing managed code (Or bytecode) must surely always be **slower** due to additional overhead for JIT compilation than executing native code. How then is it possible that the CLR causes "Performance improvements"? **Update:** I have looked at the question and answers to What backs up the claim that C++ can be faster than a JVM or CLR with JIT?, but it has not been helful as that question is actually asking why C++ would be faster rather than slower. What I am interested in is how it is possible, from an architectural point of view, that managed code could lead to performance improvements


I work for an e-commerce site that has lately been shedding its workforce. I was hired ten months ago as a UI Developer. At that time we had three other developers. One was the technical lead who had been with the company for 10 years. The other two were server-side developers who had been there for 10 and 3.5 years respectively. In ten months, the technical lead left for a better position, one developer was laid off, and the other very recently left. So, I am now the only developer on staff. We have one DBA and one network administrator. They are currently looking to hire another developer but are not willing to pay enough to hire a senior person. I consider myself a junior developer with two years of experience. I have argued that we need to hire at least one senior developer and another junior developer if we're going to keep our current site operational (not to mention develop new features)...even if that means laying off staff in other departments. Right now we get 6.5 million pageviews per month, and I feel like 3.2 million pageviews per developer must be incredibly abnormal. My question is then: what is a normal developer to pageview ratio? Are there any industry standards or literature on the subject that I can use to argue for more staff?


What is the name to differentiate between parts of an app that have different types of users in each part?

On a project I'm working on, I'm trying to find a noun to describe the different parts of the application dependent on user interface. There are three parts: super admin, admin and regular users. Each of these parts consist of modules, interfaces with users, interfaces with the other parts. I've tried "sub-system", "module", "environment", "platform" but none of these really described what each of these parts of the system is. I need a noun that captures everything included within each part e.g. the super admin(?) enables the owner to manually add and edit content. Normally I would just use "module" but there are many modules within each part.


Software Engineer with no post-secondary degree?

So here's the deal: Right now I am in college and due to a maelstrom of recent events including difficulty in non-cs and -math related courses, I'm really not sure that I want to continue studying at a university next year. While I thoroughly enjoy my computer science and math courses, I find that I just can't keep up with the class. Take my calculus-based physics for example. I'm sure that, given enough time, I could make it through the course and learn everything I need to know; but because I am working and taking 4 other courses, I just don't have that time. I feel that I would benefit a lot more from teaching myself these courses one at a time, i.e. finishing Calculus before I take calculus-based physics. I probably should have registered for the algebra-based course, but it's too late to do that now. What kind of repercussions (career-wise) would there be if I decided to drop out of school and learn on my own? I might consider coming back after a few years of working full-time, but I really don't know. Is it worth paying for school if I don't feel like I'm gaining as much as I can from it?


How to create Public API wrapper with different configuration parameters

I'm looking to see if there is a design pattern that can solve the following problem. The example is fairly specific but the goal is a public + internal API. I need specific information for my underlying library but I want to present the API generically. If my question is vague or terrible I'll try and spruce it up with your comments. As an example, let's say I am creating a public API and I want it to be agnostic to the implementation. Continuing the example, I am creating a job handler API using the Quartz (can be any library) library in the current implementation. I want people to be able to type:               Job job = jobManager.getJob("my.job.name");     String otherInformation = job.getOtherInformation();     job.setSchedule(new IntervalSchedule(repeatInterval, intervalUnit));     job.setSchedule(new CronSchedule(cronExpression));      The Quartz API has builders for schedules (used in Trigger):               CronScheduleBuilder.cronSchedule(cronExpression);     CalendarIntervalBuilder.calendarIntervalSchedule()                            .withInterval(repeatInterval,                                 DateBuilder.IntervalUnit.DAY);      In my current example I would have a base interface or class Schedule. With this structure how would it be possible to get the specific information I need for the schedule builders without revealing an implementation specific object in my interface while keeping it extensible. My goal is to prevent implementation classes from leaking in to the public API. If in the future Quartz falls out of favor, the public API doesn't need to change and deprecate the Quartz specific classes. What design pattern or code reorganization am I missing?


Copyright issues with encryption algorythms

I'm developing an application for Android/Java. This application is a kind of password manager, so I'm storing encrypted passwords under the hood of a master password. There are a number of encryption algorythms DES/AES/BlowFish/TwoFish and so on. My intention is to develop application which is free of commercial copyright issues. So the questions are:   1. If I use built-in Java encryption API's (e.g. DES/AES)- does it mean that I will be free from possible commercial interests of DES/AES alike copyright holders?   2. Encryption algorythms sometimes are export limited, keeping in mind that I'm from Moscow/Russia - are there any implications of that fact? Any other thoughts would be helpful.


need some concrete examples on user stories, tasks and how they relate to functional and technical specifications

Little heads up, I'm the only lonely dev building/planning/mocking my project as I go. I've come up with a preview release that does only the core aspects of the system, **with good business value** , and I've coded most of the UI as dirty throw-able mockups over nicely abstracted and very minimal base code. In the end I know quite well what my clients want on the whole. I can't take agile-ish cowboying anymore because I'm completely dis-organized and have no paper plan and since my clients are happy, things are getting more complex with more features and ideas. So I started using and learning Agile & Scrum Here are my problems: * * *   1. I know what a functional spec is(sample): Do all user stories and/or scenarios become part of the functional spec?   2. I know what user stories and tasks are.   Are these kinda user stories? I don't see any Business Value reason added to them. * * * I made a mind map using freemind, I had problems like this: Actor : Finance Manager >> Can Add a Financial Plan into the system because well _that's the point of it_? What Business Value reason do I add for things like this? > Example : A user needs to be able to add a blog article (in the blogger app) > _because..??_ It's the point of a blogger app, it centers around that > feature? * * * How do I go into the finer details and system definitions:   _Actor:_ Finance Manager >> _Action:_ Adds a finance plan. This _adding_ is a complicated process with lots of steps. What User Story will describe what a _finance plan in the system is_ ??   I can add it into the functional spec under definitions explaining what a _finance plan_ is and how one needs to add it into the system, but how do I get to the **backlog** planning from there? > Example: A Blog Article is mostly a textual document that can be written in > rich text in the system. To add a blog article one must...... But how do you create backlog list/features out of this? Where are the user stories for what a blog article is and how one adds/removes it? * * * Finally, I'm a little confused about the relations between functional specs and user stories. Will my spec **contain** user stories in them with UI mockups? Now will these user stories then branch out tasks which will make up something like a technical specification? Example : _EditorUser_ Can add a blog article.   1. Use XML to store blog article.   2. Add a form to add blog.   3. Add Windows Live Writer Support. That would be agile _tasks_ but would that also be part of/or form the technical specs? Some concrete examples/answers for my questions would be nice!!


Method overload in scala

I know method overload is not allowed in Scala and I have read some posts regarding the reasons. But still, I see some functions overloaded in Scala library (example: println). I want to know how it is done and if I can use the same mechanism to some of my methods.


Testing abstract class' behavior

I'm currently refactoring an existing design, which was created without TDD. There is a class hierarchy with one abstract base class and two subclasses. In the original design, these classes were mostly just data holders without much behavior. I have identified some functionality which should be implemented in the base class, and I'd like to write tests for this functionality now. But since the class is abstract, I cannot instantiate it (obviously). **Note:** The functionality I'd like to test doesn't invoke any `pure virtual` methods.               class Base {}; // Is abstract          TEST(BaseTest, doesSomethingAmazing) {         Base aBase; // <-------- Not possible!!!          ASSERT_THAT(aBase.amazeMe(), Eq(AMAZING_RESULT));     }      _Edit:_ To clarify a few things:   * Inheritance does actually make sense in this situation - both subclasses map to specific domain concepts, and polymorphism helps keep the surrounding code clean   * There is behavior which will be used in both subclasses, and which needs data that is common to both classes. So I think it makes sense to put it in a common super class. I can think of several possible solutions, but none of them seems optimal to me:   * Add a subclass to the test code, which implements all `pure virtual` functions. Downside: Hard to name that subclass in a concise way, understanding the tests becomes harder   * Instantiate an object of the subclass instead. Downside: Makes the tests pretty confusing   * Add empty implementations to the base class. Downside: Class is not abstract anymore I tend towards option 3, to make the tests as clear as possible, but I'm not really satisfied with that. Is there a better way I'm not aware of?


Python, magic and objects that add attributes to its owner

Let me start with a disclaimer: I'm _not_ the best programmer out there. I _do_ however study I.T. and learnt a bit of Java and C. I'm getting stuck into Python and Django + Mongoengine, I'm not going to explain it into detail as it will deviate from the original question. While trying to understand what is happening at this bit of Django code I was **shocked** by some of concepts I seemed to understand. Mostly I was completely confused by how one object could add accessible attributes to a parent object and how Python defines `__set__()` and `__get__()` in such a way as to be so confusing as that. Could someone tell me how _orthodox_ this design style is and whether I find it bizarre because I'm an amateur programmer.


copyright notice for client work

I'm wondering what's the best way to add copyright/info into source for a client. Normally I do projects for myself and release them as GPL however I'm working with a client and not sure how to give them the source. Would something like this be correct? > /* Package: Project Name   >  File: filename.php   >  Author: My name (emailme@example.net)   >  (c) 2011 Client Name All Rights Reserved > > File Description....   >  */ The client owns the code once they have paid for it but I still think it's a good idea to add a file description and copyright to each file. Maybe this is a conversation to have with each client but does this seem like a fair (and legal) way to do it?


Is it still ok to get MCTS in .NET 3.5?

As I work for a Microsoft Gold Partner, they are keen for me to become certified. They have left it up to me to decide which certifications I want to go for. I had started training for the .NET 4 MCTSs but I am finding them harder than expected. Part of the problem is that I mostly work with 3.5 as my part of job and only work with 4 at home. Should I just give myself a break and go for the 3.5 exams? Would other employers think it was bad/strange that I'm still sitting 3.5 exams in 2011? I would still like to know all the latest technologies but at the moment I'm just finding that there is too much. By the time I'm ready for .NET 4 they will probably have released 5, and the cycle will continue.


Why do bitwise operators have lower priority than comparisons?

Could someone explain the rationale, why in a bunch of most popular languages (see note below) comparison operators (==, !=, <, >, <=, >=) have higher priority than bitwise operators (&, |, ^, ~)? I don't think I've ever encountered a use where this precedence would be natural. It's always stuff like:                 if( (x & MASK) == CORRECT ) ...   // Chosen bits are in correct setting, rest unimportant            if( (x ^ x_prev) == SET )      // only, and exactly SET bit changed            if( (x & REQUIRED) < REQUIRED )   // Not all conditions satisfied      The cases where I'd use:                 flags = ( x == 6 | 2 );     // set bit 0 when x is 6, bit 1 always.      are near to nonexistent. What was the motivation of language designers to decide upon such precedence of operators? * * * For example, all but SQL at the top 12 languages are like that on Programming Language Popularity list at langpop.com: C, Java, C++, PHP, JavaScript, Python, C#, Perl, SQL, Ruby, Shell, Visual Basic.


SourceTree app, how do I know what is my current branch?

I have branched from my `develop` branch `bugfix/issue2` to work on a bugfix. Now that it's done I want to merge this branch `bugfix/issue2` back onto `develop` but it's asking me if I want to merge into my current branch. And I don't know if my current branch is `develop`? See attached screendumps: ![enter image description here](http://i.stack.imgur.com/cLFGl.png) ![enter image description here](http://i.stack.imgur.com/sEM44.png)


The physical implementation of quantum annealing algorithm

From that question about differences between Quantum annealing and simulated annealing, we found (in comments to answer) that physical implementation of quantum annealing exists (D-Wave quantum computers). Can anyone explain that algorithm in terms of quantum gates and quantum algorithms, or in physical terms (a part of algorithm that depends on quantum hardware)?


Is it a good practice to use smaller data types for variables to save memory?

When I learned the C++ language for the first time I learned that besides int, float etc, smaller or bigger versions of these data types existed within the language. For example I could call a variable x               int x;     or      short int x;      The main difference being that short int takes 2 bytes of memory while int takes 4 bytes, and short int has a lesser value, but we could also call this to make it even smaller:               int x;     short int x;     unsigned short int x;      which is even more restrictive. My question here is if it's a good practice to use separate data types according to what values your variable take within the program. Is it a good idea to always declare variables according to these data types?


How to learn C in two days (if I already know C++)?

I've been programming in C++ for a few years, and I've done a school project or two in C (as well as several other languages). However, I don't know C very well at all. I have a programming interview in two days, and I just realized that this interview will be in C. How do I approach this? How do I learn C well enough to succeed in a programming interview? This job is not looking for a "C expert" or anything like that, so I think they'll be somewhat understanding if I explain that I have not programmed much in C. They just choose to host their interviews in C. Buying and reading a textbook is not feasible, so my resources will have to be on the internet.


Chrome extensions every programmer should know

I just switched from Firefox to Chrome, so what I wanna know: Are there any Chrome Extensions which are indispensable for a programmer?


Describing requirements in SRS - use cases?

I do not have the access to the IEEE standard and information on the net are contradictory. Can I capture user requirements in SRS using use cases? Or I should keep use cases separate as they are more like scenarios than separate requirements?


Summarize terms of service?

What's your opinion on summarizing the ToS?   Example:               [ToS here]     Basically, it means you won't sue me.     [I accept][I don't accept]      Is this good practice or will this just get you sued more?


How: Personal life of a Software Developer

have just graduated and am looking for job in the field of Software Development. Since, I like to go with application developments. Well, being a Software Engineer; Can able to survive personal family life. I am single :) Once I get married. Will I able to spend time with my wife and kids? I see, nowadays many Software Specialists are not returning to home at nights. due to the workload. That makes their wife to scary about in someways. How the understandings will go? How do you compromise your personal life?


Do you need to meet personally to collaborate effectively?

If you are starting up a web, mobile, or standalone application, how well must you know the rest of your collaboration team? Would it be a bad idea to ever work with someone unless I've met him personally? Is it okay to sometimes accept small public contributions such as code snippets and artwork without meeting the contributor? Should I ever actively collaborate with people online that I have not met, as long as the person has a detailed profile and a good reputation. If you do collaborate online, what tools do you to build teams and find contributors? If not, would you consider the idea if there was a safe medium? Any other input on the subject would be appreciated.


Re-gaining confidence of senior programmer

My boss found out I'm not as smart as he thought. An example from my experience: I'm a junior programmer, and I work in a team of two, my boss (senior programmer) and myself. I was tasked with developing an internal web-application for the company we work at. I wrote the back-end to the front-end (the database design was in already place and the server technology had been chosen). He would periodically check on my progress by observing the web-application in action and was happy with out it was coming along. When I finished the web-app he was pleased with how well the end-product turned out. A few days ago he became interested in the code so I told him what technologies I used (for the front-end), and this is where it went south. For the front-end of the web-app I used a Javascript framework (Backbone.js). When asked why I would do such a thing. My response was because that I felt that the framework fit into this app quite well, and would help me structure the code better than if I wrote it from scratch...."Well, that's dis-heartening" was his response. So given this example my question is: If your a senior programmer and have lost confidence in the ability of your junior programmer, what would you like to see from your junior to gain the confidence back? **EDIT** : Thank you everyone for the great answers and supportive feedback!


What is the C++ convention, if any, for naming to differentiate between structure types and other types?

In general, should I use some sort of convention for structure names which is distinct from other type name? I was thinking about this when my professor started talking about structures. I had the following discussion with myself, and since I do not want to come to any unreliable conclusions. How would you answer the question(s) and which answer(s) are untrustworthy? Q: Should I distinguish structure names and type names to make the code more clear? A: A structure is a type, so there doesn't need to be a distinction. RE: Q: So there is never a case when someone uses `typedef int SOMETYPE` to rename a built-in type to make the code more flexible? RE: A: There is no practical reason to rename built-in types. Actually, defining `int` types as `SOMETYPE` makes the code less readable because someone reading the code will not know the built-in type used for that type. Honestly I do not trust either answer. Looking at some of the base structure in a new Win32Project using Visual Studio, I see things like `typedef short HFILE;` which, I guess, makes it more clear to the programmer what the variable is used for. Perhaps that is too subjective however. As an aside, how does one usually determine what is going on when they come across variable declarations which use types you have never seen before. Do you just rely on the IDE to take you to or display the declaration?


Is making my own copyright licence safe?

I've seen various open source libraries (actually I've seen it for assets as well) having a home-baked license in the following manner : > SomeGuy's License:   > 1\. You can use this code freely in commercial projects and modify it as you > wish, but not sell it   > 2\. If you want to sell a modified version, drop me an email first, or give > credits to me Edit: The above example is ambiguous, so I am giving another one, I want to know if 3 lines of license will hold some ground: > SomeGuy's License:   > 1\. You can use this code in a commercial project as a 3rd party library   > 2\. You can't sell it as a derivative work I know that such license is not polished at all, for example the Creative Commons set of licenses seem to be short, but actually have some large legal stuff underneath it, but I wonder if at least some level of protection can be gained with a hobby license like that ? My question is, **could this hold any ground in the court** , or would the corporative lawyers of the company X tear it apart ?


Ruby isn't a PHP generator, right?

My boss was looking down on me about learning Ruby because "It's just a PHP generator" which I can't find anything about it being so. Is this the case? I understand that the Rails framework can be used to generate PHP code, but isn't Ruby in-and-of-itself its own programming language?


What is Script Binding, and How is it done?

I have heard such thing as Script Binding - binding Javascript or lua with API's from C++ or Objective-C. I want to know more about it- however Google has strangely proven unuseful for this. How is it done? - it OK if I get pointed to other sources, but, just how? I never knew a Scripts jitter could interact with compiled libraries.


Improve coding quality

I have been dealing with programming for several years now (I am still a student but with a lot of internships). Mostly working with C++, Python and MATLAB, I noticed that whenever I download an SDK or a library from Internet/GitHub and look inside, the code is much more complex than mine, using error catches everywhere and other things that would never come to my mind while writing my own code. My question is, how can I learn or practice this kind of things? From my experience, no programming course talked about coding style, when and how to use try/catch efficiently, how to debug faster etc... I am also not thinking about using mutex while accessing one variable from different functions at the same time because my code is simply working without them and I didn't face any problem until now. Currently I am working on a project using Python and Pycharm is helping me a lot keeping a correct coding style but it is limited to the syntax and naming conventions.


Which software licenses should I be aware of?

Licensing is something that I really haven't paid any attention to; I guess I felt there was no need. However I can't but help thinking that I should. So which are the most common licenses that I, as a programmer, should be aware of? Also, it would be helpful if you could include a brief description of each provided.


Are there any programming languages understood by all operating systems, if so what?

I'm curious if there's a programming language that you can write code for all operating systems in, and if so what language that might be? I'm guessing something very low-level like Binary could do this, but am not sure.


Should developers be worried about automation that make them redundant eventually?

Should developers be worried about possible automation happening in their projects that might make them redundant ? I never particularly worried about this myself but I have seen many developers worrying about it, even if they don't admit this openly. There is a fear that if you automate most of the aspects of a system that you are handling it might make you redundant eventually. I myself had an experience on this. 1 year back I had started working in a project were any requirement/change request that came, the only deliverable was a bunch of insert queries. That team had 2 developers and 1 tester working on it (all on shore). The only thing that the developer had to do would be to configure the insert queries based on the requirements. When I came to work on it, I immediately suggested to build a web application that would enable the business people to do it directly. Every thing would be configured in the web application including error reports in case anything went wrong. Needless to say my manager loved the idea but it never passed through with the higher management. The logic for that was until the client comes up with such a requirement it should never be done as it will involve future losses for the company and possibly loss of employment of the employees currently handling it. So should a developer be concerned about this ?I would certainly like to believe that > If you don't take care of your customer some one else will but experience tells me otherwise.


Handling invoices with timestamps

I'm currently going to write something to **automatically create invoices** with cronjobs by using PHP and timestamps. I have a, for me, **well-considered idea** of how to solve it, but I want to ask the community **if someone may see errors in reasoning** and **possible problems with my solution**. I'm trying to describe my idea as detailed as possible so everyone can follow my way of thinking: In General there are **4 types of invoices** :   1. Paid yearly   2. Paid semiyearly   3. Paid quarterly   4. Paid monthly **Purchased products are saved in a SQL database** with the billing cycle:   * ID of User   * Product ID   * Billing Cycle   * Last Due Date Now there is a cronjob that runs once a day to check if it should create a new invoice for each purchased product. In the row `Last Due Date` I save the timestamp of the first date to pay when it's created. A code I already wrote calculates the **time that has gone by** since the `Last Due Date` timestamp and outputs something like this:   * Timestamp is in past or in future   * Month gone by   * Days gone by Now my **rules for creating a new invoice** are:   1. **Paid yearly** if ( Timestamp is in past = true AND Month gone by = **11** AND Days gone by >= 20 ) then ( create a new invoice and set "Last Due Date" to time() )   2. **Paid semiyearly** if ( Timestamp is in past = true AND Month gone by = **5** AND Days gone by >= 20 ) then ( create a new invoice and set "Last Due Date" to time() )   3. **Paid quarterly** if ( Timestamp is in past = true AND Month gone by = **3** AND Days gone by >= 20 ) then ( create a new invoice and set "Last Due Date" to time() )   4. **Paid monthly** if ( Timestamp is in past = true AND Month gone by = **0** AND Days gone by >= 20 ) then ( create a new invoice and set "Last Due Date" to time() ) As you can see a new **invoice would be created ~10 days before date of payment** and the timestamp in `Last Due Date` is set to the current time, so when the cronjob checks back the next day no invoice will be created for this purchased product. My question is **if this is an appropriate way of solving** this and if you can **see any errors in reasoning or problems that may occur**?


Resources for C/C++ security (whitehat) hacking

I'm currently working as a C++ developer in a software security department, but not as a researcher or whitehat hacker. Security is an interest of mine, mainly in the areas where I can exploit code or reverse engineer executables/communication/protocols. I've done some work in reverse engineering but only as a hobby (ie. modifying a saved game file for a game). As a person that knows C, C++ and some assembly (MASM), what types of resources would you recommend that I read so that I may gain more knowledge about these fields? Books, blogs, and articles would probably be best. Currently I'm reading 24 Deadly Sins of Software Security: Programming Flaws and How to Fix Them.


What would be a good name of practices you don't (usually) learn at university?

I'm preparing a course dedicated to fresh graduated CS students. I have to name it. Is there an English word or sentence to define all the practices you don't learn at college/university? Here are a (partial) list of things are not teach to most students I interview or talk with:   * Unit Testing + mocking   * Design Patterns   * Agility (such as Scrum or Extreme Programming)   * DRY, YAGNI, SOLID, DIP, KISS, ...   * Source Control, DVCS, ... I once heard "Software Industrialization Practices" (literally translated from French), and while it sounded great in French, I'm not sure it does in English.


What should be "D" for a good unit test?

I'm trying to introduce what is unit testing, and how to write good unit test to a friend. I think it's better if I give him some principles for a good unit test, and suddenly I remember about "ACID" properties of transaction: **A** \- atomic: a unit test should test only one thing **C** \- consistent: a unit test, if passed, should pass thousand times, whenever you run it, so it should not depend on external things, such as network, database... **I** \- independent: a unit test, should be independent from others, therefore, you can run unit tests in every order, without changing the result. But i get a bit stuck with "D" - durable. Durable unit test? It makes no sense. Any suggestion about this D? Thank you.


Use of the word "glitch"

I find myself talking about computers with a lot of non-tech people, who often use the word "glitch" to describe an undesirable outcome of a program or operating system(of course, never Linux!). I have never heard another programmer use the word "glitch" and hearing it makes me think the user has no idea what they are talking about. SO my question: Do you use the word glitch in everyday, technical conversation, if not, does its use imply to you ignorance and lack understanding?


emacs - project explorer and auto complete features - is it available?

I know that Emacs is a very powerful editor out there. I try to use it occasionally and want to learn it better. But to learn it better i have to use it more frequently than I am using now. But one big obstacle is that I could not find the basic properties like a project auto completion. Maybe I am lazy but I dont want to write again and again the same long method names. Another one is go to definition stuff, I want to see the real declaration of any class or method or even a variable. Also I know that it can handle the make files but an actual representation of a project alongside the editor would be very good. So, what I am asking is, is there a way to provide these options in Emacs? Or is there an extended version of Emacs that supports these features?


How will closures in Java impact the Java Community?

It is one of the most talked about features planned for Java: Closures. Many of us have been longing for them. Some of us (including I) have grown a bit impatient and have turned to scripting languages to fill the void. But, once closures have finally arrived to Java: how will they effect the Java Community? Will the advancement of VM-targetted scripting languages slow to a crawl, stay the same, or acclerate? Will people flock to the new closure syntax, thus turning Java code-bases all-around into more functionally structured implementations? Will we only see closures sprinkled in Java throughout? What will be the effect on tool/IDE support? How about performance? And finally, what will it mean for Java's continued adoption, as a language, compared with other languages that are rising in popularity? To provide an example of one of the latest proposed Java Closure syntax specs:               public interface StringOperation {        String invoke(String s);     }          // ...          (new StringOperation() {        public invoke(String s) {            new StringBuilder(s).reverse().toString();            }     }).invoke("abcd");          would become ...               String reversed = {          String s =>          new StringBuilder(s).reverse().toString()       }.invoke("abcd");      [source: http://tronicek.blogspot.com/2007/12/closures-closure-is-form-of- anonymous_28.html]


Unit test SHA256 wrapper queries

I have the following SHA256 wrapper.                   public static string SHA256(string plainText)         {             StringBuilder sb = new StringBuilder();                  SHA256CryptoServiceProvider provider = new SHA256CryptoServiceProvider();             var hashedBytes = provider.ComputeHash(Encoding.UTF8.GetBytes(plainText));                  for (int i = 0; i < hashedBytes.Length; i++)             {                 sb.Append(hashedBytes[i].ToString("x2").ToLower());             }                  return sb.ToString();         }      Do I want to be testing it? If so, what do you recommend? My thought process is as follows:   1. What logic is there here.   2. The answer is my for loop and `ToString("x2"`) so from my understanding I want to be testing this part? I can assume `Encoding.UTF8.GetBytes(plainText`) works. Correct assumption? I can assume `SHA256CryptoServiceProvider.ComputeHash()` works. Correct assumption? I want to be only testing my logic. In this case is limited to the printing of hex encoded hash. Correct? Thanks. EDIT: Update method based on MainMa's excellent answer:                   /// <summary>         /// Returns a SHA256 hash of the plain text.         /// </summary>         /// <param name="plainText">The pain text.</param>         /// <returns>The hash.</returns>         public static string SHA256(string plainText)         {             if (string.IsNullOrWhiteSpace(plainText)) throw new ArgumentNullException("The plain text cannot be empty.");                  StringBuilder sb = new StringBuilder();                  Byte[] hashedBytes;             using (SHA256CryptoServiceProvider sha256Provider = new SHA256CryptoServiceProvider())             {                 hashedBytes = sha256Provider.ComputeHash(Encoding.UTF8.GetBytes(plainText));             }                  foreach(Byte b in hashedBytes)             {                 sb.Append(b.ToString("x2").ToLower(CultureInfo.InvariantCulture));             }                  return sb.ToString();         }


Acceptance tests for large multi-step online form

I have to extend/fix a large online form written by other developer. There is a lot of code, mixing PHP and JS. It's kind of write-only style of coding and I want to redo it completely, but currently I can't. It works like this:   * It is a wizard-style form with 12 steps - let's call them _phases_ to not confuse with steps of the tests.   * User has to fill at least ~100 fields to finish.   * Some fields are grouped by 3-5. Those groups can be dynamically added and removed with JS.   * Validation is done after submitting each phase. If some errors occured, user is notified immediately and cannot go further until he/she fixes all errors.   * Submitted data is temporarily stored in the session between phases. No permanent storage.   * User cannot skip phases, only sequentially go back and forth to already completed phases. It is ridiculous to test this thing manually, so I wrote a test using Behat with Mink and Selenium2. I have only 1 test now, which completes all 12 phases of the form. To go to specific point in the process of filling the form, I created a step definition wich just makes webdriver wait 1 hour (laugh at me). When I need to test some specific phase, I just add this step where I want Selenium to stop - this leaves browser window open so I can do whatever I want manually without having to fill all previous fields. It saves a ton of time, but feels stupid. I have reasons to do that:   * Has to be done ASAP.   * I cannot test each separate step in the form.   * I cannot reuse parts of the filling process without having to write quite a lot of PHP code. Now my test is just ~120 lines written in Gherkin language. Simplified version of my question is: **how should I test this?** I can think of several ways:   * Modify the code to allow skipping phases. This can be done safely by detecting environment parameters withing the application and deciding whether client (webdriver or user) can or cannot skip phases, so skipping is not allowed in a production environment.   * Just write more tests with a lot of copy-pasting and be a bigger monkey.   * Write step definitions to complete specific phases separately. So, I could just write               When I complete phase 1     And complete phase 2     And complete phase 3     ...      in the tests. So, the full version of my question is: **which way is preferable and what (dis)advantages each way has?** Maybe there are other ways, like designing an application in a completely different way so there are no such problems.