title: Functional Programming: right ideas about concurrency and state?

text: FP proponents have claimed that concurrency is easy because their paradigm avoids mutable state. I don't get it. Imagine we're creating a multiplayer dungeon crawl (a roguelike) using FP where we emphasize pure functions and immutable data structures. We generate a dungeon composed of rooms, corridors, heroes, monsters and loot. Our world is effectively an object graph of structures and their relationships. As things change our representation of the world is amended to reflect those changes. Our hero kills a rat, picks up a shortsword, etc. To me the world (current reality) carries this idea of state and I'm missing how FP overcomes this. As our hero takes action, functions amend the state of the world. It appears to be every decision (AI or human) needs to be based on the state of the world as it is in the present. Where would we allow for concurrency? We can't have multiple processes concurrently ammending the state of the world lest one process base its outcomes on some expired state. It feels to me that all control should occur within a single control loop so that we're always processing the present state represented by our current object graph of the world. Clearly there are situations perfectly suited for concurrency (i.e. When processing isolated tasks whose states are independent of one another). I'm failing to see how concurrency is useful in my example and that may be the issue. I may be misrepresenting the claim somehow. Can someone better represent this claim?


title: Breaking up a large PHP object used to abstract the database. Best practices?

text: Two years ago it was thought a single object with functions such as `$database->get_user_from_id($ID)` would be a good idea. The functions return objects (not arrays), and the front-end code never worries about the database. This was great, until we started growing the database. There's now 30+ tables, and around 150 functions in the database object. It's getting impractical and unmanageable and I'm going to be breaking it up. What is a good solution to this problem? The project is large, so there's a limit to the extent I can change things. My current plan is to extend the current object for each table, then have the database object contain these. So, the above example would turn into (assume "user" is a table) `$database->user->get_user_from_id($ID)`. Instead of one large file, we would have a file for every table.


title: How to search for information related to Go programming language?

text: If there's something that would kill Go language, then it's name. I find it very hard to find anything in web related just by using "Go" in the query. The word is on of the most frequent in English. So I see everything in the result except Go-related stuff. Even Google, who sponsors the language and famous for tracking anything I search, can not track I'm a programmer so interested in the programming language and not English grammar. How to search for information related to the programming language itself, excluding the results related to English grammar? Imagine for example a blog post where someone mentions his observation about Go. He probably won't use the easy-to-search sentence like "go programming language", maybe something "there's one thing I like about Go".


title: Why can't we declare 'extern C' for C++ macro's?

text: I am new to C/C++. Wanted to know why we cannot declare 'extern C' for C++ macro's similar to methods/functions...which will allow macro's defined in C++ file to be accessed in .c files. Thanks in Advance


title: SMS verification in web application

text: This is my first project related to SMS verification. How to implement SMS verification in online ordering web application? For example:- when we try to reset the password in amazon's website, it sends an sms verification code and after entering the code it proceeds with changing the password. I want to implement the same function in my application, where users will place order, but before the final step it will send an sms verification code to the users mobile and verify the same. The main requirement is SMS Gateway(Transactional Quality). But as I'm completely new in this, so any idea how to proceed, or how can I implement it.


title: Is "Explain the RAII idiom" a good C++ screening question?

text: A company that I work with has asked me to do candidate phone screenings to make sure they aren't completely embarrassed when sending over someone to a potential client. It turns out that a fair number of people were being placed for a C++ developer role. I don't spend much time in C++, but I have done a few trivial and non-trivial projects in the language. I figured that "Explain the RAII idiom" would be a nice softball question that most serious C++ developers could answer while half asleep, and would allow me to move on to more interesting questions about experience. But it turns out people who have 10+ years C++ experience don't recognize the term, even if I expand the acronym to "Resource Acquisition is Initialization." One candidate went so far as to say he felt it wasn't always practical to apply the technique in Windows development, which I thought was an odd sentiment, but I could see a couple of examples that arguably support that line of thought. (But really only _arguably_ ). Even a couple of C++ developers I know well enough to judge their competence said they didn't recognize the term, but upon reading a summary of the technique, said "Oh, yeah, I didn't know that had a name. I just thought of those things as something you _just have to do_." I remember the term from the second edition of Stroustrup's book, even though the full impact didn't sink in at the time. So, is "Can you explain the RAII idiom to me?" a fair screening question? Is it reasonable to expect all competent C++ developers to understand it? Is the term more esoteric than I would think? Assuming a candidate doesn't know the term, are there follow up questions that could help me tease out whether they have at least internalized the practices that make RAII work? Are there better alternative "weeder" questions that give the candidate some latitude in answering, and help the candidate demonstrate their understanding of C++ development? **Editing to add** : To clarify, I'm not the sort of interviewer that disqualifies people because they don't know buzzwords and acronyms. However, I do think it's reasonable to expect that an experienced C++ programmer has internalized good practices for resource management. I also think that it's important to verify that a candidate understands some "basics" about the technology they claim expertise in before moving on to more interesting questions about design, problem solving, etc. I think what I'm looking for is a good way to ask an open-ended question, suitable for use in a short telephone screening, that I can use to judge a candidate's basic understanding of good resource management practices in C++, before I ask "hard" questions.


title: Why do people pick the MIT license over BSD, if BSD's "non-endorsement clause" is a good idea?

text: According to this question and it's replies What is the purpose of the "non-endorsement clause" in the New BSD license? it seems smarter to pick the BSD license over the MIT, to prevent people using your name in an unwanted way. If that is the case, why do people still pick the MIT license over BSD license?


title: Best Architecture for ASP.NET WebForms Application

text: I have written an ASP.NET WebForms portal for a client. The project has kind of evolved rather than being properly planned and structured from the beginning. Consequently, all the code is mashed together within the same project and without any layers. The client is now happy with the functionality, so I would like to refactor the code such that I will be confident about releasing the project. As there seems to be many differing ways to design the architecture, I would like some opinions about the best approach to take. **FUNCTIONALITY** The portal allows administrators to configure HTML templates. Other associated "partners" will be able to display these templates by adding IFrame code to their site. Within these templates, customers can register and purchase products. An API has been implemented using WCF allowing external companies to interface with the system also. An Admin section allows Administrators to configure various functionality and view reports for each partner. The system sends out invoices and email notifications to customers. **CURRENT ARCHITECTURE** It is currently using EF4 to read/write to the database. The EF objects are used directly within the aspx files. This has facilitated rapid development while I have been writing the site but it is probably unacceptable to keep it like that as it is tightly coupling the db with the UI. Specific business logic has been added to partial classes of the EF objects. **QUESTIONS** The goal of refactoring will be to make the site scalable, easily maintainable and secure.   1. What kind of architecture would be best for this? Please describe what should be in each layer, whether I should use DTO's / POCO / Active Record pattern etc.   2. Is there a robust way to auto-generate DTO's / BOs so that any future enhancements will be simple to implement despite the extra layers?   3. Would it be beneficial to convert the project from WebForms to MVC?


title: centralized hosted application framework or "private copies" for each program?

text: We have a centralised business application framework, and it contains all our business logic and provides access to all our back-end systems. It is accessed by a number of different programs and clients through remoting. When we need to do a change in a certain part of the program, we currently have to retest all our different programs and clients. Even assuming we extend our automated testing, we feel that there is no way we can be certain that upon releasing a new version of our application framework all the different programs will work correctly after that change without also manually retesting all these programs. Every time we release a new version of project C, we have to test program A and B as well for unintended changes. Preferably, we would move to a release system where upon releasing project C, we only have to retest program C, and not A and B for possible breaking changes that we overlooked. The idea lives to duplicate our centralised business application framework, one for each sub-project. It would mean for that when we release a new version of program C, we will provide a private version of the application framework. Upon release of program C, nothing will have changed for application A and B, they still communicate with their private application framework - so they do not need to be retested. I came up with the following pro's and con's: Con's:   * We'll have our framework hosted n times for each project    * We'll get confused in what version / project what bug is solved.   * With a major fix / change, we will have to re-release all n versions of the application framework. Pro's:   * Significantly cuts down on testing   * "Certainty" that no unintended changes are released for different projects. I must admit I am not a fan of the private copies-approach, but I fail to provide a better alternative, or better arguments against this. Has anyone been in a similar situation, and how was it handled? Is the above approach of "private frameworks copies" a solid / accepted approach? Any advice is welcomed. Thanks in advance.


title: Entity Framework 5, separating business logic from model - Repository?

text: I am working on my first public-facing web application and I’m using MVC 4 for the presentation layer and EF 5 for the DAL. The database structure is locked, and there are moderate differences between how the user inputs data and how the database itself gets populated. I have done a ton of reading on the repository pattern (which I have never used) but most of my research is pushing me away from using it since it supposedly creates an unnecessary level of abstraction for the latest versions of EF since repositories and unit-of- work are already built-in. My initial approach is to simply create a separate set of classes for my business objects in the BLL that can act as an intermediary between my Controllers and the DAL. Here’s an example class:               public class MyBuilding     {         public int Id { get; private set; }         public string Name { get; set; }         public string Notes { get; set; }              private readonly Entities _context = new Entities(); // Is this thread safe?         private static readonly int UserId = WebSecurity.GetCurrentUser().UserId;              public IEnumerable<MyBuilding> GetList()         {             IEnumerable<MyBuilding> buildingList =                  from p in _context.BuildingInfo                 where p.Building.UserProfile.UserId == UserId                 select new MyBuilding {Id = p.BuildingId, Name = p.BuildingName, Notes = p.Building.Notes};             return buildingList;         }              public void Create()         {             var b = new Building {UserId = UserId, Notes = this.Notes};             _context.Building.Add(b);             _context.SaveChanges();                  // Set the building ID             this.Id = b.BuildingId;                  // Seed 1-to-1 tables with reference the new building             _context.BuildingInfo.Add(new BuildingInfo {Building = b});             _context.GeneralInfo.Add(new GeneralInfo {Building = b});             _context.LocationInfo.Add(new LocationInfo {Building = b});             _context.SaveChanges();         }              public static MyBuilding Find(int id)         {             using (var context = new Entities())  // Is this OK to do in a static method?             {                 var b = context.Building.FirstOrDefault(p => p.BuildingId == id && p.UserId == UserId);                 if (b == null) throw new Exception("Error: Building not found or user does not have access.");                 return new MyBuilding {Id = b.BuildingId, Name = b.BuildingInfo.BuildingName, Notes = b.Notes};             }         }     }      My primary concern: Is the way I am instantiating my DbContext as a private property thread-safe, and is it safe to have a static method that instantiates a separate DbContext? Or am I approaching this all wrong? I am not opposed to learning up on the repository pattern if I am taking the total wrong approach here.


title: Is a code review subjective or objective (quantifiable)?

text: I am putting together some guidelines for code reviews. We do not have one formal process yet and are trying to formalize it. And our team is geographically distributed. We are using TFS for source control (we used it for tasks/bug tracking/project management as well, but we migrated that to JIRA) with Visual Studio 2008 for development. **What are the things you look for when doing a code review?**   * _These are the things I came up with_     1. Enforce FxCop rules (we are a Microsoft shop)     2. Check for performance (any tools ?) and security (thinking about using OWASP - code crawler) and thread safety     3. Adhere to naming conventions     4. The code should cover edge cases and boundaries conditions     5. Should handle exceptions correctly (do not swallow exceptions)     6. Check if the functionality is duplicated elsewhere     7. A method body should be small (20-30 lines), and methods should do one thing and one thing only (no side effects and avoid temporal coupling -)     8. Do not pass/return nulls in methods     9. Avoid dead code     10. Document public and protected methods/properties/variables **What other things should we generally look out for?** I am trying to see if we can quantify the review process (it would produce identical output when reviewed by different persons) Example: Saying "the method body should be no longer than 20-30 lines of code" as opposed to saying "the method body should be small". Or is code review very subjective (and would differ from one reviewer to another)? The objective is to have a marking system (say -1 point for each FxCop rule violation, -2 points for not following naming conventions, 2 points for refactoring, etc.) so that developers would be more careful when they check in their code. This way, we can identify developers who are consistently writing good/bad code. The goal is to have the reviewer spend about 30 minutes max, to do a review (I know this is subjective, considering the fact that the changeset/revision might include multiple files/huge changes to the existing architecture, etc., but you get the general idea, the reviewer should not spend days reviewing someone's code). **What other objective/quantifiable system do you follow to identify good/bad code written by developers?** Book reference: _Clean Code: A handbook of agile software craftmanship by Robert Martin_.


title: Can't work on real projects because I keep thinking about my side projects

text: I have a "real" project I'm working on to make money from, and a side project that is vastly more interesting. I'm having a problem where every time I go to work on my "real" project, all I can think about is ideas for my side project. How do you guys deal with that? Just power through the real work?


title: Copyright license for an open source project when copying a few files from another project

text: I'm working on a library which I'm releasing under the MIT License, but I plan to copy a few useful classes from another open source project which is released under the Apache license. Obviously, I'm going to leave the original license intact, and credit the original project but how does the licensing work? EDIT: What I need to know is - 1\. Is it okay for me to do this, since there will be two different licenses? 2\. Will it happen that most of my project will be under the MIT License(the code that I wrote), but those files that I copied from the other project will remain under Apache? EDIT 2: I got my answer here - How to include an apache library with my opensource code? Please vote to close this question.


title: How far can I drift from my original domain model and still have the benefits of an ORM?

text: I have the following **domain** models:               public class User     {         public int Id { get; set; }         public ICollection<Product> Products { get; set; }     }          public class Product     {         public int Id { get; set; }         public decimal Price { get; set; }     }      My User entity has a collection of Products, and no Product can be created without an User. I am using EntityFramework Code First approach, which requires me to declare the Foreign Key on my Product entity, thus changing it to:               public class Product     {         public int Id { get; set; }         public decimal Price { get; set; }         public int UserId { get; set; }     }      I dont quite like this because, from the **domain point of view** , it is not interesting to have the User foreign key shown in my Product entity. This, however, does not bring any harm to me and I can live with it. Please, mind that I am using an ORM to simplify my work, so I am okay with it to an extent. Is it okay to my **domain entities** having properties or such things only to satisfy my ORM of choice requirements?


title: Best practices for rotating large datasets?

text: [edit]Turns out there's 1.5 million records... The SQL database is taking about 17-20 seconds to run the query. Would it be best to have Java handle the joins and rearranging in that case? Since this is a web app, if multiple users are getting Excel exports, would the long queries reduce the overall performance of the site?[/edit] I have a dataset that contains roughly 70,000 records. For simplicity's sake, let's say the data currently looks like this: User ID | Question | Answer In our web application, the data needs to be rotated 90 degrees and exported into Excel, such that we have the following: User ID | Question 1 | Question 2 | Question 3 .... I think we end up with around 50 or so columns. Should the data be rearranged on the database side using pivot tables or should it be rearranged on the application side? Which solution would be the easiest to maintain? Which solution would have the greatest performance?


title: How important is automated testing in rapid release, non-critical (web) apps?

text: I think I understand the theoretical benefits of automated testing, especially unit testing. However, I'm not sure what the optimal amount of testing is when the project is a non-critical, rapidly developed (and deployed) web app with a reasonably large user base. My current reasoning goes like this:   * Most of the core functionality of our app can be manually tested in a matter of seconds. (The site is a type of search engine, so basically - run search, get results, it works.)   * Of course, there are many edge cases and options and such that could be tested, as well as unit testing of underlying logic, but if anything significant breaks and isn't caught before it's made live, we literally tend to get email from users within an hour. (Within minutes if it's a major problem, but very rarely does one of those get out.)   * So the consequence of any significant problem going live is that a few people are inconvenienced for a few minutes. Maybe some percentage of new visitors we get in that period would be lost, although the numbers should be very low since the time period is so short.   * Lower impact bugs might take longer for someone to email about - days, or even weeks depending on the severity - but they will also have less of an impact on users, so from a business perspective likely don't "matter" as much. Now, I'm not saying that excellent test coverage is useless. Of course it would be nice to catch every issue before it goes live. But in the cost/benefit tradeoff between working on tests and responding quickly to user feedback / adding and refining features, the latter seems to win. The one exception I've found is in code that doesn't directly affect the user. For example, ad serving code, or data collection. These don't directly impact the user's value from the site, so people are unlikely to let us know when they break. They will also be less noticeable in our feature testing. So I can see a strong case for well-defined unit tests there. (And from there, there ironically seems to be a spectrum where good test coverage becomes less important as features become more important, to the point where code that is critical to the site's operation doesn't really need to be tested (in a well defined manner) at all.) So my question is, am I way off base here? Is widespread test coverage and/or test-driven development optimal even in a non-critical, continuous-release environment? And if so, where am I failing in my reasoning? Or, assuming we fix bugs immediately when reported, is it reasonable to focus on rapid, nimble development, knowing that our users will let us know if we break something? (With the exception that we will have formal tests for functionality that is not directly exposed to the user.)


title: Is it necessary to memorize every line of code when it comes to game development?

text: I am currently following along a youtube tutorial here and from what I understand we are starting out by creating an engine to run the game. Should I be able to implement all of this by myself without outside help in the future or should I just make sure to have an understanding of everything that is going on? Would a professional game developer know how to implement everything that it takes to make a game or would he/she just copy and paste certain parts (like creating a buffer, or fps cap) and edit it to their taste?


title: What keywords are important to speedup the code in C++?

text: I'm porting to C++ and adding a lot of functionality to a numerical application written in Fortran 77. While I hate F77, I have to admit that the thing goes very fast. Now, I'm implementing practically the same structure and algorithm, but nevertheless the difference in the execution time is noticeable. Not big, but it's there. And I'm wondering, could it be that I need to pass extra information to the compiler? The only related information that I've been able to find is a recommendation to use the **restrict** key word which is supported by g++, but that's all. Hence, my question: Are there anymore keywords important to speedup code in C++ in numerical applications? or maybe compiler directives? Thanks!


title: Logging asynchronously - how should it be done?

text: In many of the services I work on there are a lot of logging being done. The services are WCF services(mostly) which use the .NET EventLogger class. I'm in the process of improving these services' performance, and I got to think that logging asynchronously would benefit performance. I'm unaware to what happens when multiple threads ask to log, and it if creates a bottleneck, but even if it doesn't I still think that it shouldn't interfere with the actual process being executed. My thoughts are that I should invoke the same log method I call now but do so using a new thread, while continuing with the actual process. **Some questions about that:** Is it ok? Are there any downsides? Should it be done in a different way? Maybe its so fast that it doesn't even worth the effort?


title: What is the reason for creating the symbols ∞ on the client side?

text: Take a look at this link: http://math.stackexchange.com/questions/60766/what- is-the-result-of-infinity-minus-infinity What is the reason for transforming the symbols ∞ on the client side? Because if someone disable javascript, this is what they see: ![enter image description here](http://i.stack.imgur.com/NXTKY.png) So right now I'm pondering what may be the reasons for that decision _(I was thinking there are bound to be some advantage otherwise the decision wouldn't have been done)_.


title: How to handle technological "Dogmatism"

text: I left a job (to relocate to another country) where I programmed in Javascript and Haskell (some python) most of the time. I really liked it because people were objective, positive, mathematical, and yet got a bunch of stuff done. This was a truly professional shop. Now I work at an Agile/XP shop. While this is good and all I feel that maybe we are unprofessional when it comes to the selection of technologies and libraries. I feel that our approach to writing software is a bit immature and unstructured. I am trying to read the books I have been offered and they seem to encourage this style ( _ugh_ ). A lot of times we just pick libs off of git hub and use it without any type of review. I get forced to work with someone all the time even if it's a small task for one person. There seems to be a little "fast" rule for everything even if the rule can be broken by a trivial counter example (one time I made the mistake of giving that counter example and I was verbally attacked). Is this normal here in the states? How do I handle this dogmatism?


title: What to do when allowing application to run in an invalid state?

text: We currently have a 'global catch all exceptions' section in our application. When an uncaught exception is thrown, the stack trace is displayed and the application continues running. More often than not, this leaves the state of the application invalid going forward. Especially with NullReferenceExceptions, and threading exceptions being the cause. I decided to have the application log the exception in the 'global' section and shutdown and restart. This was met with criticism from management - who asserted that the user should choose to select whether or not to restart under these conditions, since it never shut down before. ( _Though I tried my best to explain that the issue was allowing the app to continue running in the first place)_. I am looking for things to watch out for now, and specific approaches I can take to handle code that is now allowed to continue to run while in an invalid state.


title: Should I use a workflow engine?

text: I need to add some new features to a PHP application. It is to follow the steps of a order. A process create some orders, the order goes to confirmation, then if approved is sent to a provider, later the provider confirm that can deliver the order, a request is made to the provider and so on... I need to register when every step is made and send notifications. Also, some steps have a estimate time, and if that time is elapsed I need to send notifications so everybody know about the delay. When a process starts, it have a predefined set of steps, but in a middle the user should be able to create new sub-steps, and delete or skip future steps.. Should I use a workflow engine? Which one do you suggests (free-opensource only)?


title: Converting a bounded knapsack problem to 0/1 knapsack problem

text: I ran across a problem where goal was to use dynamic programming (instead of other approaches). There is a distance to be spanned, and a set of cables of different lengths. What is the minimum number of cables needed to span the distance exactly? To me this looked like a knapsack problem, but since there could be multiples of a particular length, it was a bounded knapsack problem, rather than a 0/1 knapsack problem. (Treat the value of each item to be its weight.) Taking the naive approach (and not caring about the expansion of the search space), the method I used to convert the bounded knapsack problem into a 0/1 knapsack problem, was simply break up the multiples into singles and apply the well- known dynamic programming algorithm. Unfortunately, this leads to sub-optimal results. For example, given cables:   1 x 10ft,   1 x 7ft,   1 x 6ft,   5 x 3ft,   6 x 2ft,   7 x 1ft If the target span is 13ft, the DP algorithm picks 7+6 to span the distance. A greedy algorithm would have picked 10+3, but it's a tie for minimum number of cables. The problem arises, when trying to span 15ft. The DP algorithm ended up picking 6+3+3+3 to get 4 cables, while the greedy algorithm correctly picks 10+3+2 for only 3 cables. Anyway, doing some light scanning of converting bounded to 0/1, it seems like the well-known approach to convert multiple items to { p, 2p, 4p ... }. My question is how does this conversion work if p+2p+4p does not add up to the number of multiple items. For example: I have 5 3ft cables. I can't very well add { 3, 2x3, 4x3 } because 3+2x3+4x3 > 5x3. Should I add { 3, 4x3 } instead? [I'm currently trying to grok the "Oregon Trail Knapsack Problem" paper, but it currently looks like the approach used there is not dynamic programming.]


title: Do speakers get paid for tech talks?

text: I'm curious if speakers (bloggers, google employees like Matt Cutts) get paid for speaking at conferences. If they do, how much? If they don't, or they get paid so little that it's as though they don't, why do it? What are the attractions beyond money that lead a developer into public speaking?


title: How to trim emails for just the body, when using email as input to an external system?

text: When an application allows emails to be sent to it to either reply to comments or add todos, trimming those emails for just the relevant text becomes a problem, since there are many different standards. Many times you'll end up seeing things like this: > Hey Joe, good to hear from you. Let me know when you'll be back in town.   >  **_Posted by Bob, 30 minutes ago_** > > * * * > > I'll be back on the 13th. > > \--   >  Sincerely,   >  Joseph R. Roberts   >  Senior Partner > > This communication is confidential and is property of Whatever Law Firm.   >  **_Posted by Joe, 10 seconds ago_** Signatures are probably the most difficult to get rid of, and quoted text the easiest. I imagine any comprehensive strategy for trimming will be multi- facted, and ideally, learning. I think a good system should:   1. Remove quoted body   2. Remove quote headers ("On 15 October, Joe wrote:")   3. Remove signatures   4. Preserve anything that was typed manually. What steps would a system need to take to accomplish this, and what pitfalls should it be aware of? * * * This answer is a good example of a useful answer to a similar question


title: Architectural patterns for interaction beyond MVC?

text: We all know the venerable Model-View-Controller pattern used to design interaction [mostly] with human users. It is the de-facto standard in OOP environment. What are some other architectural patterns of interaction worth mentioning? Non-OOP (functional, logical, etc) approaches welcome, too.


title: Is the separation of program logic and presentation layer going too far?

text: In a Drupal programming guide, I noticed this sentence: > The theme hook receives the total number of votes and the number of votes > for just that item, but the template wants to display a percentage. That > kind of work shouldn't be done in a template; instead, the math is performed > here. The math necessary to calculate a percentage from a total and a number is `(number/total)*100`. Is this application of two basic arithmetic operators within a presentation layer already too much? Is the maintenance of the entire system severely compromised by this amount of mathematics? The WPF (Windows Presentation Framework) and its UI mark-up language, XAML, seem to go to similar extremes. If you try to so much as add two numbers in the View (the presentation layer), you have committed a cardinal sin. Consequently, XAML has no operators for any arithmetic whatsoever. Is this ultra-strict separation really the holy grail of programming? What are the significant gains to be had from taking the separation to such extremes?


title: Do you have any tips to help with applying to an international job?

text: I've had some freelance jobs in my country (Brazil), working for different companies. I like to work to Brazillian companies, but I'm looking for some international experiences and I would like some advice. How do you hire foreign developers/professionals? How can I proceed to become more "visible" to the international employers? I don't want to leave Brazil for now, so I wonder if its possible to get good freelance jobs outside here. If you have worked like I'm willing to work, I'll be glad if you share your experiences ;)


title: Help in finding the total time taken by the entire production?

text: I have a line object and each line object has an array of tasks associated with it.Each task has a start time and an end time.Each task also has a list of tasks which are its predecessors. **So if all the tasks were independent (no predecessors) I would just calculate the end time of the last task on each line which would be the end time of this line.The time taken by the production would be the maximum of the end time of all lines.** The problem is a task could be dependent on a task (which could be on the same or a different line). So if a task's predecessor is on the different line and its start time is greater than this task's start time,then this task's start time should be updated accordingly. **How can I calculate the correct production time given these predecessor tasks on different lines?** **EDIT:** This is what I have come up with so far.               Cluster{     func* func[n]     };          func{     int executiontime;     int starttime;     int endtime;     func* pred[k]     };          int main{     /Cluster objects were initialized up somewhere.          Cluster cl[4];//An array of four clusters          for(int i=0;i<4;i++){          cl[i].func[0].starttime = 0;          cl[i].func[0].endtime = cl[i].func[0].starttime + cl[i].func[0].executiontime;          for(int j=1;j<n;j++){          cl[i].func[j].starttime = cl[i].func[j-1].endtime;          cl[i].func[j].endtime = cl[i].func[j].starttime + cl[i].func[j].executiontime;          }          }          int productiontime=Max(cl[0].func[n].endtime,cl[1].func[n].endtime,cl[2].func[n].endtime,cl[3].func[n].endtime);          return productiontime;     }      This is what I have done so far.I am stuck at how to modify the code to account for the task predecessors. **EDIT** :After the above loop,I would update the start and end times of each task whose predecessor task is on another line.If the predecessor task's start time is greater than this task's start time then this task's start and end time both would be updated.How should I do this when the problem is that predecessor task's start time might also need to be updated depending on its own predecessor tasks.


title: Being IDE dependent. How can it harm me?

text: I am highly IDE dependent developer (NetBeans and Eclipse as I am a JAVA dev). I can code properly if I have an IDE. I can rely a lot on that for development, debugging and deployment. But without IDE I can do nothing. Can code a simple hello world program or some simple UI arranging but I need an IDE to do complex things or long coding of simpler things. Do you think it harms me? Some programmers who have more than 6 years of development experience strongly believe that it can be harm, but I think that if I can do some complex things rapidly and properly why should I stick to notepad and command line tools to perform a time consuming task when IDEs have a button click to do this?


title: Does a developer really have to know build tools, classpath etc?

text: When IDEs like eclipse can handle all the maven, ant, classpath etc related tasks, does a developer really need to learn all these things ? If yes, then why ?


title: Benefit of C++ to System Administrators

text: What benefit could C++ bring to system administrators? I am working on Windows and Ubuntu. If I learn C++, where could I implement it in system administration, Please specify some of its benefits.


title: How do I add restrictions for users to sign up before they can access web site?

text: How do I get my webpage not to go back when they hit the back button and are logged out ? how can I add a web page to be blocked like FACEBOOK doesn't let you get into their site with out having a page or a account with them, and if you try to put something in the url and try to go to something on their site it gives you a web page that says "you have to be logged in first" ? I mean I don't want someone going to the url of the "index" page before they have signed up as a member they need to make an account first then they can have access to the "index" page. How do I do this gateway? Consider I have a website so far that has a database and the website has 5 pages so far and two of them which is the login and sign up page which are both used with php and mysql and they work fine. How do I restrict access to the main website by first having the users sign up with me for an account?


title: Are Extension methods (C#) and categories (Objective-C) the same as traits?

text: According to: Something similar to Objective-C categories in other languages? Static extension methods in C# are `basically the same thing` as Objective-C categories, so I'm going to lump these two features together in asking: Are these techniques the same as traits? Also, can these language features be used to solve problems that typically would be solved with Multiple Inheritance? And, if so, specifically how do they avoid the pitfalls of Multiple Inheritance?


title: Expanding on vendor software?

text: I am a SCADA consultant and I work with many software packages. Due to their robust nature they include the capability of executing internal/external activex and vbscript code. Over the years I have written 10's of thousands of lines of code which my clients have utilized happily. I've met a point in my career where I want to go independent with these libraries due to their complex nature. That being said, is it legal for me to advertise "SoftwareX Expansion libraries" or "SCADA expansion libraries for software X/Y/Z"? What exactly can I state on a website or software package which would not get me swarmed by lawsuits? SCADA is supervisory control and data acquisition. Writing advanced reporting/software for industrial hardware and software. I work with human machine interface(hmi) software which allows internal/external execution of vbscript. Think of it as adobe flash, and how it executes actionscript. In the case of adobe flash, I would want to sell my actionscript libraries. My question is - Is it legal?


title: How to choose which schema design for a tree structured domain model

text: I have the following classes that I want to store.               public class StorableObject     {         public string Id { get; set; }     }          public class User : StorableObject     {         public string Name { get; set; }     }          public class Project : StorableObject     {         public string Name { get; set; }         public User Owner { get; set; }         public ICollection<Task> Tasks { get; set; }     }          public class Task : StorableObject     {         public string Name { get; set; }         public User Owner { get; set; }         public ICollection<Timesheet> TimeSheets { get; set; }     }          public class Timesheet : StorableObject     {         public User Owner { get; set; }         public DateTime Timestamp { get; set; }         public TimeSpan Duration { get; set; }     }      Schema design has a lot to do with which queries you'll be needing, so let me try to explain a bit. I'll need to do fast queries to extract:   * all Tasks on a Project   * all Timesheets on a Task   * all Projects a user owns   * all Tasks a user owns   * all Timesheets a user owns. I also need some summations like get total time spent on a Project or Task in a given time period and total time spend per user in a given period. (MapReduse I suppose) I started out (after reading this blog) with 4 collections (Users, Projects, Tasks, Timesheets), each child would have a parent reference so I could construct my domain model in my business logic. However after watching this I've changed my mind and now going for a more embedded approach.               {        _id: 123456789,        owner_id: 123,        name: "My Project",        tasks: [                 {                    owner_id: 123,                    name: "My Task",                    timesheets: [                                  {                                     owner_id: 123,                                     ...                                  }                                ]                 }               ]     }      What's your take? Is that a fast schema design?


title: How to make Ninject inject an MVC view model?

text: How do I configure Ninject so it injects an instance in a view model? PS. It is an abstracted service to help with validation, so I am not trying to burden the model with too much responsibilities.


title: How often do you use Formal UML?

text: I used ad-hoc MUML (made-up modeling language) to design and explain system fairly frequently. It looks similar to UML and tends to be pretty well understood. However, I've had a professor or two that harped on the use of strict, formal UML, as close to the spec as possible. I always suspected that strict UML wasn't really as common as they claimed. So, how 'bout it- how often do you actually draw out complete diagrams that use all the proper line endings, multiplicity, member type symbols, etc?


title: What should I concentrate on?

text: Let me first give you a small background. I am a high school student in my last year of high school. When I get to college, I want to take up computer science, because I really love software engineering. At home, I do a lot of programming. I never really finish any projects, but I just create all kinds of different "experimental" stuff just to learn different programming languages, technologies, and programming methods. I am a big fan of C# and I also am getting more into other managed languages such as Java. I've worked with C++ many times, and I know how the language works. Still, I just can't seem to get anything useful done with it. In C#, I can create a useful app in just a few hours. In C++, I will still be trying to understand different 3rd party libraries to get things done. For instance, I was earlier trying to figure out Qt for C++ GUIs, but in C#, you have Windows Forms right there to help with GUI Development. **So I say all of that to ask** , what is the job market out there currently looking for? I want to get more into C++, but it gives me such a hard time. By the way, I am interested in business application programming. So would it be wise to concentrate on sharpening my C# and Java skills and leave C++ until later? Thanks


title: Is Software Testing Really Needed?

text: I'm a student working on my B.E(CS) and my question is the following:   1. Is testing in the software field needed?    2. If we create a software with great care, then why should we test?    3. After testing can we be **sure** that we have achieved this goal (the product/software works as intended) because we have done the **testing** for it? Is it possible? My question: **Is testing of software needed**?


title: For open-source licenses with an acknowledgement clause, how obvious does the notice need to be?

text: In licenses such as that of libjpeg and freetype, there are clauses like the following: > (2) If only executable code is distributed, then the accompanying > documentation must state that "this software is based in part on the work of > the Independent JPEG Group". or: > o Redistribution in binary form must provide a disclaimer that states that > the software is based in part of the work of the FreeType Team, in the > distribution documentation. Is putting a notice in a text file in the installation directory enough? Or is a more obvious notice typically needed? For a non-open-source end application, what's the usual way to display these mandatory acknowledgments?


title: arrays format (Javascript)

text: I have a list of users, with minions, something like this:               User52:            minion10            minion12     User32:           minion13           minion11      I've been keeping in an array where the "location" is the id, like this:               Users:            [52]User                    minions:                            [10]minion                            [12]minion            [32]User                    minions:                            [13]minion                            [11]minion      so I can access them easily like this: `user[UserID].minions[MinionID]` (ex: `user[32].minions[11]`). But when I print it or send it by json I get something like this:               {,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,minion,,,,,,,,,,,,,,minion}      But should I keep using like this or should I change to something like this:               User = function(){        this.minions = ...;        this.getMinion = function(value){          for(var m in this.minions){           if(this.minions[m].id == value){              return this.minions[m];              break;           }          }        }      }      and get it like this:               user.getMinion(MinionID);      Question: I get better performance using a "short" array but using loops every time I need a minion, or using "long" arrays, but no need for loop and getting values directly from the id "name"?


title: Resharper: Do You Use 'Symbol Completion' or 'Smart Completion'?

text: @Amir Rezeai says that 'Coding Assistance' is his favorite Resharper feature. I actually just found out about 'Coding Assistance' after watching James Kovacs' most excellent webcast, entitled 'Resharper Tips and Tricks' on Pluralsight.com. My Question is: > Do you use 'Symbol Completion' or 'Smart Completion'? And if so, did it take you a while to get used to [either feature]? * * * These features could potentially accelerate development. But it seems like they require a different mindset.   [I don't know - Maybe it's just me.]


title: Learn programming backwards, or "so I failed the FizzBuzz test. Now what?"

text: ### A Little Background I'm 28 today, and I've never had any formal training in software development, but I do have two higher education degrees equivalent to a B.A in Public Relations and an Executive MBA focused on Project Management. I've worked on those fields for about 6 years total an then, 2,5 years ago I quit/lost my job and decided to shift directions. After a month thinking things through I decided to start freelancing developing small websites in WordPress. I self-learned my way into it and today I can say I run a humble but successful career developing themes and plugins from scratch for my clients - mostly agencies outsourcing some of their dev work for medium/large websites. But sometimes I just feel that not having studied enough math, or not having a formal understanding of things really holds me behind when I have to compete or work with more experienced developers. I'm constantly looking for ways to learn more but I seem to lack the basics. Unfortunately, spending 4 more years in Computer Science is not an option right now, so I'm trying to learn all I can from books and online resources. This method is never going to have NASA employ me but I really don't care right now. My goal is to first pass the bar and to be able to call myself a real programmer. I'm currently spending my spare time studying Java For Programmers (to get a hold on a language everyone says is difficult/demanding), reading excerpts of Code Complete (to get hold of best practices) and also Code: The Hidden Language of Computer Hardware and Software (to grasp the inner workings of computers). **TL;DR** So, my current situation is this: I'm basically capable of writing any complete system in PHP (with the help of Google and a few books), integrating Ajax, SQL and whatnot, and maybe a little slower than an experienced dev would expect due to all the research involved. But I was stranded yesterday trying to figure out (not Google) a solution for the FizzBuzz test because I didn't have the `if($n1 % $n2 == 0)` ~~method~~ **modulus operator** memorized. What would you suggest as a good way to solve this dilemma? What subjects/books should I study that would get me **solving problems faster** and maybe more "in a programmers way"? **EDIT** \- Seems that there was some confusion about what did I not know to solve FizzBuzz. Maybe I didn't express myself right: I knew the steps needed to solve the problem. What I didn't memorize was the modulus operator. The problem was in transposing basic math to the program, not in knowing basic math. I took the test for fun, after reading about it on Coding Horror. I just decided it was a good base-comparison line between me and formally-trained devs. I just used this as an example of how not having dealt with math in a computer environment before makes me lose time looking up basic things like modulus operators to be able to solve simple problems.


title: Why do we need the async keyword?

text: I just started playing around with async/await in .Net 4.5. One thing I'm initially curious about, why is the async keyword necessary? The explanation I read was that it is a marker so the compiler knows a method awaits something. But it seems like the compiler should be able to figure this out without a keyword. So what else does it do?


title: Can a small team enter .NET world while most of them are working on OpenSource languages?

text: We are a team of about 15 employees, in a non-IT enterprise. Today, we mainly develop websites, using PHP, MySQL, etc. We run a bit less than 100 linux servers on ourselves. But today, we are confronted with a too-big-for-us-to-code project. We selected a great provider (yes, outsourcing), and now they ask us to choose between C++/Qt and .NET/WPF. The app is highly graphical, and meant to be distributed on Windows systems. .NET is recommanded to us as easier to design and more lightweight. But what about our team ? Can we handle, with our small number, both universes at the same time ? responsibilites :   * during the dev : design the app, review the code   * after the dev : host servers, do maintenance and answer user calls   * in the case we need a v2, we intend to call back the same provider What do you think ? **EDIT** We finally chose C++/Qt. The reasons are :   * the dev time has been tested to be somewhat equal   * it suits us better from a management point of view   * and it increases cross-platform portability


title: Why do we need method level security?

text: In the real world , why do we need to implement method level security ? We either have a web application or a desktop application , where the user accesses the user interface (and therefore directly cannot access the method) . So where does accessing methods directly come into picture here ? edit : I ask this question because I am experimenting with spring security , and I see authorizing users for accessing methods . something like :                @ROLE_ADMIN     public void update() {           //update     }


title: Adding base-class (inherited) functionality to classes that you don't control

text: I have a set of classes from a 3rd party library. These classes use an inheritance structure to share logic. I would like to add a layer of abstraction in the middle of their inheritance tree to add functionality to all of the children (concrete) implementations. Here is a simplified example of the classes in the 3rd party lib:               public interface IAnimal     {         bool IsMammal { get; }     }          public abstract class Animal : IAnimal     {         public abstract bool IsMammal { get; }         public string Name { get; set; }     }          public class Cat : Animal     {         public override bool IsMammal { get { return true; } }         public void Pur() {}     }          public class Dog : Animal     {         public override bool IsMammal { get { return true; } }         public void Fetch() {}     }          public class Snake : Animal     {         public override bool IsMammal { get { return false; } }         public void ShedSkin() {}     }      I would like to add the concept of an `AnimalWithSuperPower`. These types of animals should have 1 additional Property; `SuperPower`. I would like to be able to have classes like `CatWithSuperPower` which derive from `Cat`, `AnimalWithSuperPower`, & `Animal` so that I can access all the functionality of those. Here is the definition of `SuperPower`:               public enum SuperPower { Invisibility, SuperStrength, XRayVision }      My first idea was to use multiple inheritance. But unfortunately, C# doesn't support multiple base classes.               private abstract class AnimalWithSuperPower : Animal     {         public SuperPower SuperPower { get; set; }     }          // doesn't compile because you can't extend 2 classes     private class DogWithSuperPower : AnimalWithSuperPower, Dog {}      My next attempt uses a combination of inheritance, composition, and generics to try to deliver the functionality of the base classes.               private abstract class AnimalWithSuperPower<TAnimalType> : Animal where TAnimalType : IAnimal     {         public SuperPower SuperPower { get; set; }              protected readonly TAnimalType Animal;              protected AnimalWithSuperPower()         {             Animal = (TAnimalType) Activator.CreateInstance(typeof(TAnimalType));         }     }          private class SuperCat : AnimalWithSuperPower<Cat>     {         public override bool IsMammal { get { return Animal.IsMammal; } }     }          private class SuperCatWithPur : AnimalWithSuperPower<Cat>     {         public override bool IsMammal { get { return Animal.IsMammal; } }              public void Pur() // needing duplicate pass-through methods/properties like this is painful :(         {             Animal.Pur();         }     }          private static void ExampleUsage()     {         var invisibleCat = new SuperCat { SuperPower = SuperPower.Invisibility };         invisibleCat.Pur(); // doesn't compile - can't access Pur() method because doesn't extend Cat              var xrayCat = new SuperCatWithPur { SuperPower = SuperPower.XRayVision };         xrayCat.Pur(); // only works because I exposed the method with the EXACT same signature     }      This solution is not very good (IMO) because of these reasons:   * `SuperCat` and `SuperCatWithPur` aren't actually instances of `Cat`   * any method you wish to use from `Cat` needs to be mirrored in the container class   * feels kind of messy: `AnimalWithSuperPower` is an `Animal` but it also takes an `Animal` type parameter I also tried doing it with an extension method but it wasn't any better than the above two attempts:               private abstract class AnimalWithSuperPower : Animal     {         public SuperPower SuperPower { get; set; }     }          private static AnimalWithSuperPower WithSuperPower(this Animal animal, SuperPower superPower)     {         var superAnimal = (AnimalWithSuperPower) animal;         superAnimal.SuperPower = superPower;         return superAnimal;     }          private static void ExampleUsage()     {         var dog = new Dog { Name = "Max" };         var superDog = dog.WithSuperPower(SuperPower.SuperStrength);         superDog.Fetch(); // doesn't compile - superDog isn't an instance of Dog     }      If I had control of the 3rd party classes, I could likely do this cleanly by introducing a new class in the middle of the inheritance tree, but I can't **My Question:** How can I model `AnimalWithSuperPower` so that:   * instances are considered of types `Cat` (or appropriate sub-class), `Animal`, & `AnimalWithSuperPower`   * all the methods and properties are available without extra pass-through calls


Why is nesting or piggybacking errors within errors bad in general? To me it seems bad intuitively, but I'm suspicious in that I cannot adequately articulate why it is bad. This may be because it is not in general bad and that it is only bad in specific instances. Why is it detrimental to design error/exception handling in such a way. The specific instance is that of a REST service. There is a desire by some to use http errors (specifically the 500 response) as a way to indicate any problem with specific instances of a resource. An example of an instance resource in this case would be:                 http://server/ticket/80 # instance       http://server/ticket # not an instance      So this is the behavior that is being proposed.   * If `ticket 80` does not exist return a http response code of `500`. Within the body of the error return the "real" error as an additional error code and description.   * If the `ticket` resource doesn't exist return a response code of 404.


title: Good example of gprof, for iOS project

text: The GNU profiler `gprof`, can be used to profile any application right on the device, allowing real world profiling. As Xcode 4.5 based on LLVM plus it has GNU Debugger, Profiler, and others. I need a better example, implementation example, for iOS projects.


title: How do I make web-application development less frustrating?

text: I am fairly new to web-application development. I just can't shake the feeling that it takes me forever to do anything of even remote complexity. In c++ and java I could write the same applications in a matter of hours. On the web debugging is painful (especially if complex json-ajax) is involved. IDEs suck. The languages let everything through without errors until it is doesn't work anymore and you are stuck looking for a bug without any error or warning to guide you (and no real good way to step through the program). Can someone guide me to reading material and/or technologies that would help me find a way to stay sane when developing complex web-applications? Perhaps the answer is to use a good framework (zend?). At work we are not really using a framework except for database models generators and basic add/update/delete page generators.


title: Tips on develop further on a legacy system?

text: I was assigned to extend (and eventually maintain) a legacy system (mostly procedural, semi-ball of mud) without MVC. Any tips or suggestions for me going forward? :S


title: Where does form processing belong in an MVC application?

text: I found  this question on stack overflow and I have a question about one of the answers: In Zend Framework, forms are typically objects with decorators, but usually (I thought) processing is done using a combination of controllers and models, with the main objective to keep the controller as lightweight as possible, and each object responsible for its own state. One of the answers said to use the form object itself as the place to encapsulate the form processing members. Is that a good practice? For some reason that seems awkward to me. But it also seems awkward to do most of the work in either the database abstraction layer (Zend_Db_Table/Row) or the controller. Where is the best place to encapsulate form processing? Should you create separate classes for the form itself and another class for processing the form (which then deals with the DBAL)? **Edit:** here is another SO post that asks a similar question, but the OP doesn't get a complete answer. We want to know: where does each part of the form processing logic belong?


title: Is there any method to estimate the cost for source code verification?

text: I am in need of an estimation technique to verify if the source code delivered is appropriate. for example, if the vendor has developed an application and is surrendering the source code, me as a consultant to the client, need to verify if the source code delivered is genuine and appropriate. Question is how to verify and how much to charge for this service?


title: Is there a canonical book on Monodroid?

text: So far I have been living of standard Android books and mainly blogs for Monodroid, but I'm trying to find a definitive resource about the topic and not having any luck. Is there a book out there that's the de-facto standard for describing best practices, design methodologies, and other helpful information on Monodroid? What makes that book special?


title: Middle tier language for interfacing C/C++ with db and web app

text: I have a web application requiring a middle-tier language to communicate between an oracle database and math routines on a Linux server and a flex- based application on a client. I'm not a software expert, and need recommendations for which language to use for the middle-tier. The math routines are currently in Matlab but will be ported to C (or C++) as shared libraries. Thus, by default there's some C or C++ communication necessary. These routines rely on FFTW (www.fftw.org), which is called directly from C or C++ (thus, I don't see re-writing these routines in another language). The middle tier must manage traffic between the client, the math routines, and the Oracle database. The client will trigger the math routines aynchronously, and the results saved in the db and transferred back to the client, etc. The middle-tier will also need to authenticate user accounts/passwords, and send out various administrative emails. Originally I thought PhP the obvious choice, but interfacing asychronously multiple clients with the C or C++ routines doesn't seem straightforward. Then I thought, why not just keep the whole middle tier in C or C++, but I'm not sure if this is done in the industry (C or C++ doesn't seem as web-friendly as other languages). There's always Jave + JNI, but maybe that introduces other complications (not sure). Any feedback appreciated.


title: Working with multiple clients

text: After applying to multiple contracting positions, I landed a few interviews which I then was accepted to do the work. I am also a full time college student, but I do have about 25-30 hours free a week, so that isn't a problem. My issue is how do I manage that **time efficiently**? One of the contracting position starts next week and I've already started one yesterday. How do you make your schedule to fit your clients to give them the most time a day and not get stuck in a narrow path of working for one until you "feel" done? My clients do know that I have other work, but I don't want them to think it'll affect their work nor do I want it to. Also, if you can give advice about similar experience of **things to look out** for or how having multiple clients affected your **quality of work**. I'm hoping this isn't too subjective or too specific, so comment regrading to that so I can fix it . Thanks!


title: how to separate the logic of different views when using android viewFlipper?

text: I use a ViewFlipper in a dialog. I want to fetch the data from the EditText in both of them and also add click listeners to both of them. I can write the whole code in one big file, but i want to separate the logic to different files. since i don't need UI and full life cycle I don't use Activities but plain managers. what should i pass these managers to use `findViewById()`? if i pass context how can i fetch its UI's root view?


title: What are some ways people handle DB change notifications?

text: Multiple clients can modify the DB and all need to be notified if a DB change occurs. Where I work, this is implemented with application threads that poll the DB every second or so. This doesn't strike me as a good way to do it, so I was wondering how do people usually handle this?


title: Is it OK to reformat another developers code while modifying/adding to a module?

text: While developing in a group atmosphere and adding or modifying features in some code base. Is it considered offensive or impolite to reformat the previous developers code to bring it up to current coding standards? I understand that standards have changed, and will probably continue to change, but would any of you get offended if someone came through and changed your code formatting? To be clear, I'm not talking about changing any logic, just messing with tabs and spaces and such. EDIT: I don't only do this for the sake of coding standards, it helps me read through their code and bring it up to date so I can fully understand the logic that has been implemented before I start modifying critical applications.


title: Differences betwen HTML templating systems

text: I'm looking at backbone.js and noticed that it supports various templating systems (they specifically refer to Mustache.js, Haml-js, and Eco, but I understand it can support even more)(like Pure and dust.js) My question is really why are there so many of these? What makes one better or different to the others? Can anyone shed light on what their individual strengths and weaknesses are.


title: Where ORMs blur the lines between code and data, how do you decide what logic should be a stored procedure, and what should be coded?

text: Take the following pseudocode:               CreateInvoiceAndCalculate(ItemsAndQuantities, DispatchAddress, User);      And say `CreateInvoice` does the following:   * Create a new entry in an Invoices table belonging to the specified User to be sent to the given DispatchAddress.   * Create a new entry in an InvoiceItems table for each of the items in ItemsAndQuantities, storing the Item, the Quantity, and the cost of the item as of now (by looking it up from an Items table)   * Calculate the total amount of the invoice (e.g., shipping and taxes) and store it in the new Invoice row. At a glance you wouldn't be able to tell if this was a method in my application's code, or a stored procedure in the database that is being exposed as a function by the ORM. And to some extent it doesn't really matter. Now technically none of this is business logic. You're not making any decisions - just performing a calculation and creating records. However some may argue that because you are performing a calculation that affects the business (the total amount to be invoiced) that this isn't something that should be done in a stored procedure and instead should be in code. So for this specific example - why would it be more appropriate to do one or the other? And where do you draw the line? Or does it even particularly matter as long as it's sufficiently well documented?


title: Requiring Programming Portfolios In Interviews/Recruiting

text: I've heard about a few mentioning of programming portfolios. A programming portfolio being a significant amount of code or code segments. Is a programming portfolio a good indicator of the quality of a developer? Also, another part of this question is how do you reject an potential employer's request for an portfolio?


title: Appropriate use of SQL CLR

text: We have some back end processes that runs* on our sql server (SQL Server), they involve processing claims. This requires both data manipulation (biz logic) and data read/write to tables. The biz logic contained should never be used by any of our end user (web/fat client) applications, just for this (runs once, nightly) process. * By "runs" I mean it runs, but it is slow, full or errors, and is a nightmare to maintain, we're looking to redo this to fix these issues. One thing I'm trying to avoid is writing a 3000+ line Stored Proc (we have a few) that does everything, it isn't maintainable. My initial thoughts/approach is to use:   * SQL CLR (Sql 2012 / C# .Net 4.0) for the biz logic (there will be some complexity to the logic)   * Entity Framework for any simple CRUD read/write   * Stored Procedures for any complex data read/writes. There will be a final step of writing our end results (data) to other companies databases, but that's someone else responsibility. I'd like some thoughts about this approach if it is a good one (is there a better approach?), any suggestions would be appreciated.


title: modify source of copyrighted software

text: There is a a program that I want to use that is released in two (fully copyrighted) ways:   1. Stable binary form   2. Beta release, mostly-stable binary form that is easy to derive the source (uses jars) (this version is free) Question:   1. Can I legally download the beta version, make the necessary changes to work properly on my machine, recompile and then use the software?   2. If yes to question 1, can I then explain to people I work with how to do the same thing so that they too can use the product?  In no way would I be giving them the modified software, but rather distributing instructions how to modify it. The original download would still come from the copyright owner. I believe I have done my due diligence searching these and google's forums, but as always, if you find a duplicate question, please let me know (and point to where it is found). It seems odd to me that this hasn't been covered yet.


title: How to handle unexpected schema changes to production database

text: Is it a common or normal practice to encounter schema changes, especially renamed or removed columns, in a production database, without having been notified of the change? If unexpected schema changes are anticipated in the production database, how are they guarded against, other than basic exception handling? I've worked mainly with credit union software, DoD software, high volume e-commerce web applications, real estate systems, robotics, and more recently CMMS, GIS, and SCADA systems. Although the '90s and early 2000s were more of the wild west, everything I have been involved with over the last 10 years or so has required change management. Modifications to a production database without change control is not allowed by policy and by security controls. Comments in the accepted answer to this question - Why is “Select * from table” considered bad practice make me wonder how much of this is academic and how much is reality.


title: How to network with other developers?

text: What suggestions would you give to find networking opportunities or to network at user groups and other developer venues? For instance, if you went to a code camp, would you try to network with other developers there? How would you go about doing it? Would you go up to someone you don't know at lunch and introduce yourself? I recently attended a user group meeting and found it somewhat boring. Only a few people really seemed to talk to others. Most attendees seemed to keep to themselves. Is this typical for developers? I've never been good at networking, probably somewhat introverted around people I don't know, so networking isn't my strong point. However, I would definitely like to branch out more and meet other developers.


title: scripting support in a C# application

text: what is the simplest and fastest way to support simple scripting in a .Net application? I search a lot but only find many things with practical no documentation or outdated since years. I only need to transfer a simple .Net Object to the script and get a bool result from it.


title: Does anyone have a specific example of using the Flyweight Pattern?

text: I have been studying design patterns and came accross the fly weight pattern. I have been trying to see opportunities to use the pattern in my applications but I am having trouble seeing how to use it. Also, what are some signs that a fly weight pattern is being used when I read other peoples code? According to the definition it says: > Use sharing to support large numbers of fine-grained objects efficiently. If I read it right Dictionaries and Hashtables could be instances of fly weights is this correct? Thanks in advance.


title: using parent child windows - is chrome phasing this out?

text: I use child pop ups extensively in my browser based web application. Examples include using child to search for information which is passed back down to parent form that is updated or I use child to update recordset information which then updates and refreshes parent. Current code has been working great in IE for years and until latest Chrome update (version 34.0.1847.116) it was working in Chrome too. Now it doesn't. From what I have read, it appears Chrome is specifically disallowing the ability to pass focus back to the parent from child. I cannot understand why this is the case. Its simple, intuitve and easy. Can someone shed light on this please? And what are the thoughts regarding using parent child in this way as a method? Hope I have made myself clear :) Thanks in advance.


title: What's the ideal length of the sprint review/retrospective based on the length of the iteration?

text: I've been in several projects using scrum now. The length of the sprint review and/or retrospective has varied from client to client, from project to project. Some of the reviews became too long (2 days). Sometimes, I've lost focus while being in this long meetings and just wanted to go back to my safe and happy place (my chair in front of my computer). What is the ideal length of these meetings? What's the best way to avoid long meetings?


title: Reading from a file and inserting into a database, a good practice

text: I am making an Android application which reads several JSON files and inserts the read information into tables in my database. For instance, there are three files:   1. countries.json { "countries": [ { "name": "United States", "org_ids": [ { "id": 1 }, { "id": 2 }, { "id": 3 } ] }, { "name": "China", "org_ids": [ { "id": 1 }, { "id": 2 } ] }, { "name": "Hong Kong", "org_ids": [ { "id": 3 }, { "id": 4 }, { "id": 5 } ] } ] }   2. orgs.json { "orgs": [ { "id": 1, "name": "UNO" }, { "id": 2, "name": "Organization of American States" }, { "id": 3, "name": "INTERPOL" }, { "id": 4, "name": "European Union" }, { "id": 5, "name": "The Commonwealth of Nations" } ] }   3. continents.json { "continents": [ { "id": 1, "name": "Africa" }, { "id": 2, "name": "North America" }, { "id": 3, "name": "South America" }, { "id": 4, "name": "Asia" }, { "id": 5, "name": "Europe" }, { "id": 6, "name": "Australia" } ] } Please don't pay attention to the contents of my JSONs, they don't contain real members of the listed international organizations. It's just an example. I see two ways. **THE FORMER WAY.** Store each country with its data to a class instance and define a `SparseArray` contains a country ID as a key and a `CountryInfo` object as a value.               /** Each item contains country's ID (key) and respective data (value) */         private SparseArray<CountryInfo> mCountriesInfo = new SparseArray<JsonParser.CountryInfo>();      After reading everything from the files, the data from the `SparseArray` will be inserted into the database.                   private class CountryInfo {              String mCountryName;         int continentId;         String mContinentName;         /** Contains IDs (keys) and names (values) of organizations */         SparseArray<String> mOrgNames = new SparseArray<String>();          }      **Drawbacks.**   * The more JSONS (or the more complex JSONs) the more complex the class for storing.    * Data duplication. **Benefits**   * Reading and inserting does not depend on each other. **THE LATTER WAY.** Read and insert without preliminary saving. **Drawbacks.**   * Database logic and reading logic are mixed. **Benefits.**   * No any additional classes.    * No data duplication. Which way is a better practice?


title: How do you deal with pain from typing too much?

text: This is probably not the right place for this question, but I figure it is a board visited by thousands of programmers, and I am a programmer, and it is related, so I would try anyway. This is not a technical question, but rather a physical one - targeting mostly programmers, who have, as we all know, an extremely keyboard intensive lifestyle. The constant back and forth of the mouse, the rapid typing, the near expert level fluency over the keys. I can't be the only one who has come down with long term chronic pain from all of this. So I pose the query to other coders, how do you slow down? How do you bring those enormous typing speeds down to levels that let you function in day to day workload? I am currently attempting unfamiliar keyboard layouts, arthritic gloves, restrictive pads, and even word delay tools and I am having a lot of trouble "training" myself to type more slowly and not burn my arms up. I apologize if this isn't appropriate content, I just figure a place with all programmers would hold some insight.


title: Persistence frameworks and common sense

text: I have studied some persistence frameworks mainly Hibernate, DORM, TMS Aurelius and I'm wondering. In a model of type:               TOrderFiscal < > ----- > Items < > -------- > TOrderItem ------- > TProduct          TOrderFiscal --------- > TSuplier --------- > TCidade -------- > State      Each class of this with countless attributes, all mapped correctly to their corresponding tables and fields. When carrying a note without using "Lazy Load" would always be done with several joins select all fields to come from each of these classes. But it would be a waste since the note need only the supplier code and name attributes, the attributes OrderItem need only code, qty name. stock. What solution should be taken to create a specific class supplier of note just with these attributes ? eg               TOrder <> ----- > Items <> -------- > TOrderItem ------- > TNotaItemProduct          TOrder -------- > TOrderSupplier      If this is the solution , what happens when a business rule in TProduct should also be TOrderItemProduct? I duplicate code in both classes? Do heritage, eg TORderItemProduct and TProduct both inheriting from TBaseProduct ? Or is this a concern that we programmers we should not have ?


title: Is Windows suitable for Ruby development?

text: I've read that Windows is not recommended for Ruby development and this is last thing that stops me from starting some projects in Ruby. Are there any changes to this? Or any suggestions to make development less painful? PS. I really like Win 7 as desktop OS, but for production I'm going to use Linux server.


title: C++ library API: new or getters?

text: I'm writing a C++ wrapper for my C library (my C++ skills are a bit rusty) and I'm wondering what's preferable: allowing user to construct objects themselves or give them objects via getters? What would be idiomatic C++ equivalent of that C function?               result* process_foo(library_handle*, foo*);      a constructor like this:               Result *res = new Result(library_handle, foo);      or a getter like this? (that basically wraps the above code):               Result *res = library->get_result(foo);      Does the answer change if creation of the result could fail? Getter could return `NULL`, but what should constructor version do on failure? AFAIK some people don't like exceptions. An extra method such as `init()` or `is_valid()` doesn't seem elegant. OTOH the `Result` object sticks to RAII, it's tiny with inline methods, so it might be good candidate for stack allocation.


title: Given two sorted array in ascending order with same length N, calculate the Kth min a[i]+b[j]. Time complexity O(N)

text: Given two sorted array in ascending order with same length N, calculate the Kth min a[i]+b[j]. Time complexity `O(N).` Another variant of the question goes like this: given a matrix with sorted rows, and sorted columns, find kth smallest. We can easily formulate an `O(klogk)` solution with minheap, but the challenge is doing the same in `O(N)` time ... The paper below formulates the solution but I could not understand it. Can somebody explain it or any alternative idea? hint: http://www.cse.yorku.ca/~andy/pubs/X%2BY.pdf


title: When to use MVC

text: I'm building a site with PHP and a MySQL backend. But, I am currently not using any type of framework. Should I be using Model View Controller?


title: How to remember the details (Core APIs) of one computer language?

text: I found my self often paused to check a certain usage of one core API when writing either `javascript` or `Ruby`. I am wondering how the other guys doing? Is it necessary to remember every Core API usages? It the answer is **yes** , how did you guy do it **efficiently**?


title: does quicksort provide less swapping step?

text: So far, most of the fastest and common sorting method is quicksort. Although it has its pro and cons. However, i'm thinking that although this sorting method is fast but does it provide shortest swapping step? Because quicksort divide a set of element into 2 and then sorting, will it double up the swapping step?


title: Managing large number of app.config files

text: We have many windows services and web apps which all rely on a lot of common settings. Currently we use just appSettings as needed and they are referenced by key. Some of the settings are app specific and only know by the app team while others are environment specific and only know by the deployment team. Also we have issues when we have to make a change to common setting necessitating the change 100s of files and restarting all corresponding services. With the great variety of settings there are duplicates ones that are no longer used and many that don't mean the same thing to different applications. To solve the problem I had a two fold idea one we would write a custom config sections group for the company with custom config sections for each app and one for common. The common section would be able to accessed by a wcf service and validate that all of its settings are the current settings. My question is am I reinventing the wheel are there any good frameworks/projects/products that are designed to manage many many configurations files in a distributed environment, and if not is the approach I have decided take a reasonable one.


title: Why would Qt be considered harmful?

text: A large list of "harmful stuff" related to software development is presented on cat -v. Is Qt harmful? What would be the rationale for considering to Qt harmful? Why would Tcl/Tk be presented as a superior alternative?


title: OS Development in C++ Questions

text: As a Master's project, I am designing a simple operating system. It is being designed to run in 16-bit Real Mode on an x86 architecture. Ideally, I would like to develop this OS in C++, and only using assembly where necessary. Thus far, I have a boot loader written in assembly, that loads a kernel that is a mix of C++ and asm. My question is in regards to using C++. As of now, it has compiled and can run, but I have not used any dynamic memory allocation. If I were using C, it would make sense to write malloc functions that would handle memory allocation, but in C++ the new keyword is used. So... **How does 'new' work behind the scenes to allocate memory, and how would I go about handling this?** And as a corollary... **Does it make sense to try to use C++ to take advantage of its higher level abstactions? Or would it be more of a headache to use it and should I stick with C?** Please provide rationale if you believe that C++ would not be a good choice.


title: Why is C++ backward compatibility important / necessary?

text: As far as I understand it is a wide-spread opinion within the C++ community that certain features of C++ (including some features inherited directly from C), while still usable in themselves, do not fit well with the most recent C++ _best practices_. For example, I read a comment on this site stating that new / delete should be avoided altogether in favor of smart pointers. In view of this, I often wonder why backward compatibility with C and earlier C++ features is still important: to my knowledge there is no 100% compatibility, but most of C and C++ are contained in C++11 as a subset. So, maybe it would be possible / make sense to drop earlier C++ features (e.g. the mentioned new / delete) from a future C++ standard so that it is impossible to use them in new code. Existing code could still be maintained using the appropriate compiler. Interoperability between legacy and new code would be supported through separate compilation. One could continue to use the earlier standard or adopt the more recent one, only mixing the two would not be possible: a developer /team would have to **clearly choose** which programming style they want to use. The most flexible solution would be to have compiler options to switch on and off certain features (e.g. no new / delete allowed). Would this be a viable strategy for encouraging the adoption of modern C++ practices? Are there technical problems (e.g. compiling existing templates, ABI compatibility) that make such a change too difficult or even impossible? **EDIT** Following the suggestions contained in comments and answers I have shortened and partially reformulated the question. This is **NOT** a C versus C++ question. It is a question regarding C++ best practices and how they can be promoted. **EDIT 2** The number of down-votes suggests to me that the point of the question has not be understood by some. I have changed the formulation to stress the important point even more.


title: How to maintain trade off between number of columns in table vs join operations?

text: I have learnt that if there are more columns in table, then get those results using join query. How to decide the max number of columns in table? How feasible is "Join Operation" if too many table involved? **And if join operation hurts performance** Can we define all columns in one table to get rid of join operation? I found many developer telling me that its better to have few extra columns if needed frequently in most database operation than to have multiple tables.


title: What decent web-frameworks exists for functional programming?

text: I would like to do some web programming using functional programming. What decent web-frameworks exists for functional programming languages?


title: Real life examples of P, NP, NP hard ,NP Complete problems

text: I need to know the real life or real time examples of above mentioned problems thanks!!


title: Tools for Operating on Large Amounts of Text Data

text: I need to handle and process ~5 million news articles, an amount small enough to fit on a commodity desktop but too large to process serially. Thus far, I have been using Python/`pickle` for serialization, but this is easily getting out of hand. However, I do not have a server much less a cluster immediately available for distributed storage. What tools can I use to store, query, and operate on this size of a dataset? The majority of operations I need to do can be formulated as Map operations; the only exception is that the Natural Language Processing portion which is handled by calling Stanford's CoreNLP software suite (it needs a few seconds to load some large parameter files).


title: At least one database view per database table-Is this good or bad design and why?

text: We are building a Windows Mobile based application to interface with a customer's existing web application. We are reading and writing data to the customer's SQL server 2008 database. The customer wants all reads to happen through SQL views, and all writes to happen through stored procedures. But taking a look at their database schema, they have a view of each and every table. And they have a view of each and every query that would be used to read data, instead of using the existing views on their tables. They have 348 tables and 655 views so far. They want us to model our mobile application in a similar fashion i.e. create additional views for all queries that we use to retrieve data. I know this is poor design, but I am unable to list out to the customer why their view based strategy is a poor design. What is the consensus in the community on when to use views? How does having so many views affect performance of the SQL server?


title: Good resources for learning Rails?

text: > **Possible Duplicate:**   >  Is there a canonical book on Ruby on Rails? I just finished working through Peter Cooper's "Beginning Ruby". So now I've got a reasonable grounding in the Ruby language and would like to move onto learning Rails. This question's answers give some good pointers, but I'd like to hear some specific reviews of books and online materials. I generally learn best by working through books with good practical/technical examples AND some passive reading content that breaks up the study between practical and reading sessions (this is what made "Beginning Ruby" great for me), but I'm worried that RoR is evolving fast and that any printed book I order might be obsolete by the time I get it and work through it. Is this a fair worry? Or can anyone recommend a good Rails 3 book that should be up to date at least for the next year or so? Also, I had a brief look at some of the online resources from the other questions, and Rails for Zombies seems to get a lot of praise. Has anyone here actually used it as their introductory guide to Rails? Basically I'd like to hear first-hand accounts of people who went through this "Ruby-to-Rails" learning phase recently and which materials were useful to you.


title: How should I go about learning Ruby and Rails?

text: > **Possible Duplicate:**   >  Is there a canonical book on Ruby on Rails? I really want to change my PHP specialization to Ruby. I have some Ruby/Rails experience, and I've already created a few Ruby apps and a few Rails apps, but I want to dig deeper. I have limited time everyday for studying, so I'm looking for an effective way to improve my skills. I want to learn and understand a lot of Ruby-specific topics, e.g.:   * Ruby coding style   * understanding Ruby/Rails internals   * OOP and functional realization   * OO patterns in Ruby Also any other technologies related to Ruby and Rails that intermediate/senior developers should know. I don't want to confuse myself by reading/watching everything without a plan, so I need a good roadmap; I could create this plan by myself, but I would like to hear some advice from more professional developers. **Update: here is what I have so far** :   1. Learn the obscure parts of Ruby syntax; the parts that aren't explained in books that simply cover syntax.   2. Learn TestUnit.   3. Learn TDD and use it every time I write code.   4. Learn Ruby patterns. Ruby's OO architecture is different than PHP/Java/C++, so patterns look different.   5. Learn metaprogramming techniques.   6. Write my own web server that has common features, e.g. process-based, thread-based. Publish it on GitHub and get help from others at stackoverflow etc.   7. Dig into rack.   8. Dig into useful gems and tools such as: rake, haml, sass, rspec, nokogiri, capistrano, cucumber etc.   9. Write my own simple MVC framework that uses several ORMs. Publish it on GitHub and get help from others at stackoverflow etc.   10. Learn Rails by learning every topic from different sources: books, articles, screencasts. For example: learn generators from books, from railscasts, searching at stackoverflow, google groups etc.   11. Read Rails-specific topics in Crafting Rails Applications, paid screencasts from RailsCasts, PeepCode, TekPub, Rails for Zombies v2.


title: Is there a good reference manual for ruby/rails?

text: > **Possible Duplicate:**   >  Is there a canonical book on Ruby on Rails? I've found switching from Java to Ruby/Rails to be very difficult. I feel like the rails books and websites that I've seen are program by example, and I have yet to see anything like a complete reference. In the java/spring world there is plenty of examples but also very thorough reference manuals. So even though I can get toy application xyz up and running in an afternoon with rails I'm apprehensive about doing anything of significance. I'm willing to admit that maybe this is because I've done java/spring for a few years and have near zero experience with ruby/rails. Just wondering if anyone else has run into this or if I'm missing something.


title: Rails Book Suggestions

text: > **Possible Duplicate:**   >  Is there a canonical book on Ruby on Rails? I'm looking to learn Ruby on Rails. I already have a small background in Ruby and don't really need a book that covers both, as I ordered the Pickaxe Book a couple days ago. I recently read some of Beginning Ruby on Rails-Steven Holzner, but abandoned that after seeing multiple statements on SO about how terrible the code in it was, and also the fact that it used Rails 1...Just wondering, what is the best book for an ABSOLUTE BEGINNER in Rails?


title: Legal issues of creating a version of a classic game (Snake)

text: I recently created a version of Snake, the classic game popularized by Nokia, and I am planning on using it as an example of my game development skills. I just want to know if there are any copyright issues that could come up if I do this?


title: Java SE and Java EE?

text: I was now talking with some people and they told me that if i was intrested in a job in the future for Java programming i should not spend too much time only learning Java SE i should spend time learning Java EE instead.. Now that brought me to some questions.. Java Enterprise Edition why use this ? What can i make with this that i can't make in Java SE?, And what kind of applications is this good for? Is there any good books out there that i can read to learn the Java EE? If i know Java SE well is it easier to learn Java EE ? Thanks! I will keep browsing the web for some anwears for theese questions.. And if i find anything i wil update this question.


title: What is the difference between Enterprise Java vs Core Java?

text: I have some experience in programming in Java but wondering if someone could explain what is the difference between Enterprise Java vs Core Java? Someone asked me a question on whether I use core-Java or Enterprise Java. Now I have to ask is there such thing as core-java?


title: Distributing Libraries

text: How are libraries typically distributed? Because they have to be compiled with the **same compiler** under the **same settings** as the project using it, distributing the `.dll`, `.lib`, etc. seems impractical. Is the source code just made available for download?


title: What's the difference between computer science and programming?

text: I'm new at computer science and programming, and I was wondering, is there a difference between computer science and programming? and do you get to choose to study only one of them at the university, or both of them?


title: What are the things you put on an impact analysis document?

text: So you're fixing bugs, then you encountered one that could affect other modules of the software product. Your data is not enough to support your claim about the effects of the fix and you were asked to create an impact analysis document.   1. Is there a defined process on how to do this?   2. What are the key information needed?   3. Are there any known formats / templates for this document?


title: Find material for improvement of my SQL ability

text: I need lots of training in SQL coding in MS SQL server The following part that is needed to be improved is:   * script    * T SQL    * Procedure    * Function Problem:   Where can I get material to improve my ability in SQL coding? Is there any website for downloading a database with different task/assignment and solution? Where should I go to review lots of SQL code?