title: How to assure users that website and passwords are secure

text: On reliable websites I always see claims such as "All data is encrypted" or "All passwords are encrypted using 128bit encryption" and etc. However I have never come across a claim such as "All passwords are hashed." On my website, I will be storing all user passwords in a database after using SHA-512 (most likely) hashing with a random salt. I want to add a snipet assuring users that their passwords are secure so they will not be deterred from using my website because it requires a password. I want users to feel secure but I do not think everyone knows what hashing is. MY QUESTION: Is it okay to provide a message saying that "All passwords are encrypted and secure" since I do not think that the average user will know what the difference between hashing and encryption is, and will more likely feel secure just because they see the comfort word "encryption"? Or is there an alternative message I should provide? On a side note, I am new to encryption and password hashing and I was wondering if this would be safe enough for now as I launch my site. I do not want to tell users it is secure if it is not. Any information would be greatly appreciated. Thanks.


title: I'm using JSON and degrading gracefully, so how do I prevent duplicate code?

text: There are a bunch of questions on Stack Overflow about whether AJAX should return JSON or HTML, and most seem to agree that it is ideal to return JSON for the sake of speed. However, that means that if I degrade gracefully, I will have some duplicate code because I am generating the same markup in both PHP and Javascript. A hypothetical example: A website has a list of links to short stories. If the user has Javascript, then clicking on one of these links loads the story without a page refresh. This is done with an AJAX request that returned a JSON with the story information. Javascript generates the markup for the story. If the user does not have Javascript, then clicking on the same link reloads the page with the story now loaded. PHP generates the markup for the story. Is there a solution to use JSON and degrade gracefully without duplicating the code?


title: GPL Confusion (I made a mistake)

text: I have a project that I created under GPL (I am copyright holder). The mistake I made is I deciding to go closed source, in doing that I removed the open source download access and removed the project from sourceforge. A third party came in and recreated the project on sourceforge (under the same name) with the last GPL release and plans to modify the software. (For download access) Is it required by GPL that any branches of the project by under a new name? http://www.gnu.org/licenses/gpl- faq.html#WhyDoesTheGPLPermitUsersToPublishTheirModifiedVersions "Sometimes control over modified versions is proposed as a means of preventing confusion between various versions made by users. In our experience, this confusion is not a major problem. Many versions of Emacs have been made outside the GNU Project, but users can tell them apart. The GPL requires the maker of a version to place his or her name on it, to distinguish it from other versions and to protect the reputations of other maintainers. UPDATE The third party and I decided to leave the project page in place and redirect users to a new page for the open source version. This way the old page serves a purpose of notifying former users of the status of the project.


title: Where should I draw the line between unit tests and integration tests? Should they be separate?

text: I have a small MVC framework I've been working on. It's code base definitely isn't big, but it's not longer just a couple of classes. I finally decided to take the plunge and start writing tests for it(yes, I know I should've been doing that all along, but it's API was super unstable up until now) Anyway, my plan is to make it extremely easy to test, including integration tests. An example integration test would go something along these lines: Fake HTTP request object -> MVC framework -> HTTP response object -> check the response is correct Because this is all doable without any state or special tools(browser automation etc), I could actually do this with ease with regular unit test frameworks(I use NUnit). Now the big question. Where exactly should I draw the line between unit tests and integration tests? Should I only test one class at a time(as much as possible) with unit tests? Also, should integration tests be placed in the same testing project as my unit testing project?


title: DDD: service contains two repository

text: Does it correct way to have two repository inside one service and will it be an application or domain service? Suppose I have a Passenger object that should contains Passport (government id) object. I am getting Passenger from PassengerRepository. PassengerRepository create request to server and obtain data (json) than parse received data and store inside repository. I have confused because I want to store Passport as Entity and put it to PassportRepository but all information about password contains inside json than i received above. I guess that I should create a PassengerService that will be include PassengerRepository and PassportRepository with several methods like `removePassport, addPassport, getAllPassenger` and etc. **UPDATE:** So I guess that the better way is represent Passport as VO and store all passports inside Passenger aggregate. However there is another question: Where I should put the methods (methods calls server api) for management passenger's passport. I think the better place is so within Passenger aggregate.


title: Constants and Big O

text: Are constants always irrelevant even if they are large? For example is O(10^9 * N) == O(N) ?


title: Why creating a new MDX language instead of extending SQL?

text: I have a long experience with SQL, but recently began working with datawarehouse and OLAP technologies: building fact and dimension tables, that then are queried using MDX (MultiDimensional eXpressions). The problem is that MDX works with a completely different logic compared to SQL, and it's a whole new learning curve even for someone with a strong SQL background. Yes, MDX allows you to do things that would be hard or almost impossible with plain SQL. But sometimes it's frustrating to be hours around an MDX to do something you know you could achieve in minutes using SQL (ok, you can tell me to RTFM ...). But why go on to the trouble of creating a new completely different language when you could build on SQL, extend it to add the features needed by OLAP applications?


title: How can I make a case for "dependency management"?

text: I'm currently trying to make a case for adopting dependency management for builds (ala Maven, Ivy, NuGet) and creating an internal repository for shared modules, of which we have over a dozen enterprise wide. What are the primary selling points of this build technique? The ones I have so far:   * Eases the process of distributing and importing shared modules, especially version upgrades.   * Requires the dependencies of shared modules to be precisely documented.   * Removes shared modules from source control, speeding and simplifying checkouts/check ins (when you have applications with 20+ libraries this is a real factor).   * Allows more control or awareness of what third party libs are used in your organization. Are there any selling points that I'm missing? Are there any studies or articles giving improvement metrics?


Does your company have a written policy about contributing to open-source projects? We've been contributing "don't ask don't tell" style, but it's time to write something down. I'd appreciate both full written policy text and bits and pieces. **Update** : we've made some progress since I asked this question and now have such a policy - read this.


title: Break on default case in switch

text: I am a bit puzzled on whenever or not to include `break` after the last case, often `default`.               switch (type) {         case 'product':                  // Do behavior                  break;         default:                  // Do default behavior                  break; // Is it considered to be needed?     }      `break`s sole purpose is in my understanding to stop the code from running through the rest of the `switch`-case. Is it then considered more logical to have a `break` last due to consistency or skip having it due to the `break` applying no functional use whatsoever? Both are logical in different ways in my opinion. This could to a certain degree be compared with ending a `.php` file with `?>`. I never end with `?>` mostly due to the risk of outputting blank spaces, but one could argue that it would be the logical thing to end the file with.


title: Does Jar file shrinker affect performance

text: I've heard ProGuard's Jar shrinker affects the performance of you application. Is this true? And if so just how much slower does the Jar go shrinked compared to unshrinked?


title: Dropbox as a Version Control tool

text: I have some friends telling me that Dropbox can be used as a version control tool. I have always used SVN or Git. I was looking around Dropbox and couldn't find anything that tells me about is characteristics as Merging, Fork and other characteristics for a complete VCS. Can someone point me what I'm missing.


title: Becoming an “Application DBA”?

text: I have to admit, until recently I did not know there was such a thing as a "System DBA" and "Application DBA." Currently, I am an Application/System Admin for a large CMS. I would like to pursue a track/training that would eventually lead to this role of "Application DBA", the ultimate goal being understanding how to best use Apps and DBs together. Our Apps run on Oracle 10g. I do OK with basic SQL (selects, inserts, updates and can figure out a join or two, etc), but right now most of our DB support (e.g., generating and interpreting AWR reports, etc) is from the System DBA. I came across several posts that talked about becoming a DBA, but I would appreciate any advice and pointers towards an "Application DBA" role.


title: How to interview someone you know well?

text: How would you interview someone you know well or someone you may even be friends with? What if you already know their strengths and weaknesses. I would prefer to avoid this situation by delegating this task to somebody else, but what if this is not an option. I feel like there is just too much personal feelings involved and it is almost impossible to be unbiased. If you have been in an similar situations, how did you handle them?


title: Building a website, want to use java

text: I'd like to make a simple-ish website that is essentially a small game. Key strokes are to be processed and sent to a server (already acquired and should support SQL and JSP, I believe) which then translate to a location and written to the DB. SQL queries are to be used to retrieve these locations and written to other clients connected to the website. Their page is to be updated with these locations. I have working knowledge of Java, jQuery/Ajax, SQL and JavaScript but I'm unfamiliar with JSP and how everything hooks up. I'm aware of the MVC paradigm as well. For my little game idea, would these technologies work? Am I over thinking this and can make it much easier to implement? What might be a good tutorial or example to study? EDIT: I was just informed I will not be able to use WAR files on the server. I'm not big on php and really don't like developing with it, can I still use Java?


title: What is the best way to create HTML in C# code?

text: I have a belief that markup should remain in mark-up and not in the code behind. I've come to a situation where I think it is acceptable to build the HTML in the code behind. I'd like to have some consensus as to what the best practices are or should be. When is it acceptable to build html in the code behind? What is the best method to create this html? (example: Strings, StringBuilder, HTMLWriter, etc)


title: How do you track Production tasks

text: I manage a team of coders (5people) that maintain a few modules in a large project. On top of doing coding, we also do production operational tasks (like doing server housekeeping, batch backlog tracking) These tasks are done daily, done by 1 person, and is rotated weekly The problem is this: These tasks are routine, but there I cant think of a practical way of ensuring the person does what he is supposed to do. I thought of using spreadsheets to track, or to the extent of doing a paper checklist, which the person on duty will have to physically sign off. I just want the guy on duty to remember and execute every daily item. What works on your project?


title: How is"cloud computing"different from "client-server"?

text: Watching a CEO for a new "cloud computing" company describe his company on a finance TV program today, he said something like "Cloud computing is superior to old-fashioned client-server computing". Now I'm confused. Can someone please explain what "cloud computing" means in contrast to client-server? As far as I understand it, cloud computing is more of a network services model, such that I do not own or maintain the physical hardware. The "cloud" is all the back-end stuff. But I still might have an application that communicates with that "cloud" environment. And if I run a web site presents a form that a user fills out, pushes a button on the page, and returns some report that was generated by the web server, isn't that the same as "cloud" computing? And would you not consider my web browser as the "client"? Please note my question is specific to the concept of "cloud computing" with respect to "client-server". Sorry if this is an inappropriate question for this site; it's the one closest in the Stack universe and this is my first time here. I'm an old timer, programming since mainframe days in the late 70's.


title: How do I convince my team that a requirements specification is unnecessary if we adopt user-stories?

text: We are planning to adopt user-stories to capture stakeholder 'intent' in a lightweight fashion rather than a heavy SRS (software requirements specifications). However, it seems that though they understand the value of stories, there is still a desire to 'convert' the stories into an SRS-like language with all the attributes, priorities, input, outputs, source, destination etc. User-stories 'eliminate' the need for a formal SRS like artifact to begin with so what's the point in having an SRS? How should I convince my team (who are all very qualified CS folks by the way - both by education and practice) that the SRS would be 'eliminated' if we adopted user-stories for capturing the functional requirements of the system? (NFRs etc can be captured too, but that's not the intent of the question). So here's my 'work-flow' argument: Capture initial requirements as user- stories and later elaborate them to use-cases (which are required to be documented at a low level i.e. describing interactions with the UI prototypes/mockups and are a deliverable post deployment). Thus going from user-stories to use-cases rather than user-stories to SRS to use-cases. How are you all currently capturing user-stories at your workplace (if at all) and how do you suggest I 'make a case' for absence of SRS in presence of user- stories?


title: Balance between workload and helping new-hires

text: I've been at my first job for about 2 months and I've started to notice that there is a delicate balance between workload and helping new-hires. Since there is a lot of pressure from managmanet to fix bugs and resolve as many customer issues as possible everyone on the team seems to be very focused on their backlog of work instead of helping the new-hires get up to speed. The new-hires can ask questions and occaisonally we'll get a developer to sit down and help us but often we'll get an obscure answer that only a veteran of the product would understand because they are too busy with their task. I understand the the new-hire must also maintain a balance. Sometimes it will take a new-hire 3 days to investigate and fix something where a veteran could have done it in 20 minutes. New-hires need to show effort toward learning the product and the codebase. With out simply reducing the workload of the veterans, how can you balance between helping new-hires and continuing to work on your backlog at a reasonable rate?


title: Design Pattern for building a Budget

text: So I've looked at the Builder Pattern, Abstract Interfaces, other design patterns, etc. - and I think I'm over thinking the simplicity behind what I'm trying to do, so I'm asking you guys for some help with either recommending a design pattern I should use, or an architecture style I'm not familiar with that fits my task. So I have one model that represents a `Budget` in my code. At a high level, it looks like this:               public class Budget     {         public int Id { get; set; }              public List<MonthlySummary> Months { get; set; }              public float SavingsPriority { get; set; }              public float DebtPriority { get; set; }              public List<Savings> SavingsCollection { get; set; }              public UserProjectionParameters UserProjectionParameters { get; set; }              public List<Debt> DebtCollection { get; set; }              public string Name { get; set; }              public List<Expense> Expenses { get; set; }              public List<Income> IncomeCollection { get; set; }              public bool AutoSave { get; set; }              public decimal AutoSaveAmount { get; set; }              public FundType AutoSaveType { get; set; }              public decimal TotalExcess { get; set; }              public decimal AccountMinimum { get; set; }     }      To go into more detail about some of the properties here shouldn't be necessary, but if you have any questions about those I will fill more out for you guys. Now, I'm trying to create code that builds one of these things based on a set of `BudgetBuildParameters` that the user will create and supply. There are going to be multiple types of these parameters. For example, on the sites homepage, there will be an example section where you can quickly see what your numbers look like, so they would be a much simpler set of `SampleBudgetBuildParameters` then say after a user registers and wants to create a fully filled out `Budget` using much more information in the `DebtBudgetBuildParameters`. Now a lot of these builds are going to be using similar code for certain tasks, but might want to _also_ check the status of a users `DebtCollection` when formulating a monthly spending report, where as a `Budget` that only focuses on savings might not want to. I'd like to reduce code duplication (obviously) as much as possible, but in my head, every way I can think to do this would require using a base `BudgetBuilderFactory` to return the correct builder to the caller, and then creating say a `SimpleBudgetBuilder` that inherits from a `BudgetBuilder`, and put all duplicate code in the `BudgetBuilder`, and let the `SimpleBudgetBuilder` handle it's own cases. Problem is, a lot of the unique cases are unique to 2/4 builders, so there will be duplicate code _somewhere_ in there obviously if I did that. Can anyone think of a better way to either explain a solution to this that may or may not be similar to mine, or a completely different pattern or way of thinking here? I really appreciate it.


title: What are the benefits of Android way of "saving memory" - explicitly passing Context objects everywhere?

text: Turned out, this question is not easy to formulate for me, but let's try.   In Android, pretty much any UI object depends on a `Context`, and has defined lifetime. Android can also destroy and recreate UI objects and even whole application process at any time, and so on. This makes coding asynchronous operations correctly not straightforward. (and sometimes _very_ cumbersome) But I never have seen a real explanation, why it's done that way? There are other OSes, including mobile OSes (iOS, for example), that don't do such things. So, what are the wins of Android way (volatile UI objects and Contexts)? Does that allow Android applications to use much less RAM, or maybe there are other benefits?


title: Is error suppression acceptable in role of logic mechanism?

text:
This came up in code review at work in context of PHP and `@` operator. However I want to try keep this in more generic form, since few question about it I found on SO got bogged down in technical specifics. Accessing array field, which is not set, results in error message and is commonly handled by following logic (pseudo code):               if field value is set        output field value      Code in question was doing it like:               start ignoring errors     output field value     stop ignoring errors      The reasoning for latter was that it's more compact and readable code in this specific case. I feel that those benefits do not justify misuse (IMO) of language mechanics.   * Is such code is being "clever" in a bad way?   * Is discarding possible error (for any reason) acceptable practice over explicitly handling it (even if that leads to more extensive and/or intensive code)?   * Is it acceptable for programming operators to cross boundaries of intended use (like in this case using error handling for controlling output)? **Edit** I wanted to keep it more generic, but specific code being discussed was like this:               if ( isset($array['field']) ) {         echo '
' . $array['field'] . '
';     }      vs the following example:               echo '
' . @$array['field'] . '
';


title: Naming a predicate: "precondition" or "precondition_is_met"?

text: In my web app framework, each page can have a precondition that needs to be satisfied before it can be displayed to the user. For example, if user 1 and user 2 are playing a back-and-forth role-playing game, user 2 needs to wait for user 1 to finish his turn before he can take his turn. Otherwise, the user is displayed a waiting page. This is implemented with a predicate:               def precondition(self):         return user_1.completed_turn      The simplest name for this API is `precondition`, but this leads to code like `if precondition(): ...`, which is not really obvious. Seems to me like it is more accurate to call it `precondition_is_met()`, but not sure about that either. Is there a best practice for naming methods like this?


title: Does working with good code make you a better developer or does it make you soft?

text: Does working with good code make you a better developer or does it make you soft and reluctant to work with anything _less_ than quality code?


title: How to test the tests?

text: We test our code to make it more correct (actually, _less likely to be incorrect_ ). However, the tests are also code -- they can also contain errors. And if your tests are buggy, they hardly make your code better. I can think of three possible types of errors in tests:   1. Logical errors, when the programmer misunderstood the task at hand, and the tests do what he thought they should do, which is wrong;   2. Errors in the underlying testing framework (eg. a leaky mocking abstraction);   3. Bugs in the tests: the test is doing slightly different than what the programmer thinks it is. Type (1) errors seem to be impossible to prevent (unless the programmer just... gets smarter). However, (2) and (3) may be tractable. How do you deal with these types of errors? Do you have any special strategies to avoid them? For example, do you write some special "empty" tests, that only check the test author's presuppositions? Also, how do you approach debugging a broken test case?


title: Good or bad code? Or "a secret reason"?

text: I think this code:               if(file_exists("amodule.inc.php"))          require_once("amodule.inc.php");        is _misleading_ because of the use of the require_once. I think that - to keep the logic and "wording" in line - "include_once" would be appropriate (where there are a number of arguments to not use the "if" at all but I would like to concentrate on "require vs include"). As far as my understanding goes, the ONLY difference between "require" and "include" is that "require has a consequence (halt) if the file does not exist vs. include proceeds with just a warning. But, in the example, if the file does not exists, the require_once code will not executed anyways. Therefore the "require" _misleads_ from my point of view. From a superficial view, one could argue that the above code using require_once and               if(file_exists("amodule.inc.php"))          include_once("amodule.inc.php");      are "identical" what, from my view, is not. Because: A "rough" analysis (like an automated check of a project) would throw a message, that "amodule.inc.php" is a vital project file, which the code shows, is not. Also, in a (not very likely) cas that between the execution of the "if" statement and the require_once statement, the file could be deleted. Then, even worse, the code would NOT execute like expected (to run without load) but give up. So, how would you guys out there argue?


title: REST API at backend and MVC Javascript framework at client side

text: I am building an online social network. I have finished writing RESTful API service using Django. This will return only JSON response (No HTML will be generated from server side) so that this JSON response can be used to build native smartphone apps. API service being common to all clients. My question is, since there is no HTML response from server side, can the MV* Javascript Frameworks like Angular / Backbone / Ember take care of complete Front-end, right from generating HTML page with CSS?


title: Statistics on time estimates for web application

text: I have been asked to help estimate the time it would take to develop a web application. I will not be involved in the actual programming, but I am participating as an "experienced" programmer. The actual work will probably be handed over to a consulting company, but the client (a university department) wants to have an estimate to have an idea of how much time and money will be needed. We will try to break down the features to implement and then try to create some kind of grand total estimate (even though Joel Spolsky says this will not work), but I thought that these kinds of web applications have been done hundreds of times and that there must be lots of experience to draw from on one or another of the stackexchange sites. ## Is it possible to answer this question: How many hours/weeks does it generally take for an experienced programmer, using their language and framework of choice (be it Java, Ruby on Rails, or some other fairly big technology), to create a web application, given that:   * It is fairly standard, meaning that there is a database, an administration interface and a presentation layer for the general public.   * It is written from scratch, but there are old systems to draw experiences from.   * The administrators (think they) know fairly well what they want. I know this is **very** vague, but I am looking for your experiences: (made up examples follow) " _We have bought these kinds of systems several times, and they generally take twenty staff-months to complete._ " " _Using Python and Django, I'd say most web apps are up and running in 6 staff-months, top._ " ## Edit: Some clarification:   * I my question most information about this project is missing. The client has written a detailed specification draft on the system and there is also a requirement analysis based on user feedback on the old system.    * I want to state, again, that I am looking for _your experiences_ (see my example answers), not a quote for this system. **Thanks for all the insightful answers, though!**


title: clone/copy constructor and child class

text: I just want feedback on what one considers 'most elegant design' for a situation like this. I have an object that is immutable with some (sort of) copy constructors to allow creating a similar but modified version of my immutable object. So something like this:               class ImmutableObject{        Fee fee;        Fi  fi;        Fo fo;             public ImmutableObject(Fee fee, Fi fi, Fo fo){             this.Fee=fee;             this.fi=fi;             this.fo=fo;        }             public ImmutableObject(ImmutableObject cloneObj, Fee fee){           this.fi=cloneObj.fi;           this.fo=cloneObj.fo;           this.fee=fee;        }             public ImmutableObject(ImmutableObject cloneObj, Fi fi){           this.fee=cloneObj.fee;           this.fo=cloneObj.fo;           this.fi=fi        }                  public ImmutableObject(ImmutableObject cloneObj, Fo fo){           this.fi=cloneObj.fi;           this.fee=cloneObj.fee;           this.fo=fo;        }     }      I'm now expanding this by creating a sub-class with extra behavior:                Class ImmutableChild extends ImmutableObject{             Fum fum;             ImmutableChild(Fee fee, Fi fi, Fo fo, Fum fum){           super(fee, fi, fo);           this.fum=fum;        }      The problem is that I have a collection of 'ImmutableObjects' that contain both original and child classes. When I try to clone them to get a new object with one modifid element My copy constructors will always create a class of parent type 'ImmutableObject' type and completely loose the state of 'fum' if I'm actually cloning the child class. I can easily refactor this to meet any solution I want, copy constructor, clone methods etc. However, while I can get the behavior I want, I'm not sure what would be considered both elequant and non-ridged solution. What is the cleanest method to allow a method that will create a 'clone' of my object with one value modified which works well with children classes that expand functionality?


title: Accessing a 32-bit DLL from a 64-bit process

text: I'm aware that it's not possible to load a 32-bit DLL into a 64-bit process. The DLL in question is a ODBC driver which is no longer supported (although it works fine) and no 64-bit version of it exists. I don't have access to the source code either. There doesn't seem to be an off-the-shelf way of "thunking" between the two architectures - the only option I can think of is to write a 32-bit COM object and get it to wrap the 32-bit DLL, and then also write a 64-bit DLL which exposes the same API the 32-bit DLL exposes and then bridge the gap by serializing the parameters to the API call and utilising DCOM's data marshalling functionality to get across the 32-bit / 64-bit boundary. This is a pretty tedious approach though and it could be quite slow if the interface is "chatty". So what I'm wondering is if there are any other ways of solving this problem?


title: Is the future of the web application going the same as the desktop application?

text: I've noticed an increase in mobile applications being released that offer high value features, but without any corresponding web based version. Was just reading about a new medical app for iPhone that allows doctors to share medical images, and had this idea been done 5 years ago it surely would have been a web application. Now it's released purely on iPhone without any web alternative. It's been years since I've had a client request a desktop application, and everything has been web based, but today all future projects involve some kind mobile solution. How much longer should I recommend clients to continue investing in web based applications?


title: creating a struct in java and searching for a specific member

text: Im a beginner in Java, I have the following code:               public class operations {         public ArrayList<Integer> stream;         public ArrayList<Integer> funct;         public ArrayList<String> name;         public ArrayList<Integer> funcgroup;         public ArrayList<Integer> source;     }      I read and understood that classes in Java are comparable to structs in C. In my program, I have to get an input from the user for name and search through the class and provide the other fields (stream, func, funcgroup, source) as output. My question is similar to Efficient way to shuffle objects From the first and best answer, I understand that rather than parallel lists, I should create a single list and then call a list with this class. But how do I add all my elements to the various fields in List in that case? I already have a separate `ArrayList` of these fields collected in another class.


title: How to handle coworker with "obsessive refactoring disorder"

text: My coworker (who is very clever, but with severly limited inter-personal skills), keeps refactoring my code even when it is work in progress and assigned to me as a task. Whereas I fully subscribed to the idea of collective ownership of code, I find this extremely irritating, but attempts to have him stop seem to have no effect. My analysis of his personality is that he considers himself the best, and if it had not been for him, the codebase would have been in a mess. I should add that I am not a novice, I know my skills and I produce quality work. Some of the refactorings are indeed to the better, most are basically just introduction of a style that he likes better than mine. In addition, he has a almost child-like need to have the last word in any discussion and has never any word of praise for work done by co-workers. There is always something that he, the master, would have done differently. I feel this is strongly affecting the quality of my work-life. What should I do ?


title: Where should the processing to structured XML be done?

text: I have been given the task of redeveloping an "in house" solution to make it expandable and easier to maintain and administer. The original solution had been hashed together over time using PHP as more requirements were added, and the need to expand is expected into the foreseeable future. The solution, gathers many different files such as word documents and varying structures of XML document, from different "locations" and converts each into a specifically structured XML documents which get sent on via a web service. To add to the mix, some of the original XML files are retrieved from the same "location" but have varying levels of processing that are required depending on where they are from before that (identified by a "customer" field in the XML) My intention is to make the new solution as modular as possible so that processing can be suspended at the individual "customer" or "location" level without affecting anything else. While I have many puzzles to overcome and questions to answer, the question that is keeping me up at night at the moment is "Where should the processing to the structured XML be done?" At present it is done per "customer" but as you can imagine, it leads to a lot of duplicated code. Maybe it is unavoidable, due to the "customer" specific processing required sometimes but sanity tells me there must be a better way.


title: How to efficiently troubleshoot or test new code when hardware setup to reproduce bugs is difficult or impossible to obtain?

text: I work at a mid-sized company (150ish employees, ~10 size engineering team), and most of my projects involve interfacing with lab equipment (oscilloscopes, optical spectrum analyzers, etc) for the purpose of semi-automated test applications. I have run into a few different scenarios where I am unable to efficiently troubleshoot or test new code because I no longer or never had the hardware setup available to me. **Example 1:** A setup where 10-20 "burn-in" processes are run independently using a bench top type sensor - I was able to obtain one such sensor for testing and could occasionally steal a second for simulating all of the facets of interfacing to multiple devices (searching, connecting, streaming, etc). Eventually a bug showed up (and ultimately ended up being in the device firmware & drivers) that was very difficult to reproduce accurately with only one unit, but hit near "show stopper" levels when 10-20 of these devices were in use simultaneously. This is still unsolved and is ongoing. **Example 2:** A test requiring an expensive optical spectrum analyzer as its core component. The device is pretty old, legacy according to the manufacturer who was acquired by a larger company and basically dissolved, and its only documentation was a long winded (and uninformative) document that seems poorly translated. During initial development I was able to keep the device at my desk, but now its tied up, both physically and in schedule during its 24/7 multi-week tests. When bugs show up related or unrelated to the device, I often need to go through the trouble of testing code external to the application and fitting it in, or writing code blindly and attempting to squeeze in some testing time in between runs, as much of the program logic requires the OSA and the rest of the test hardware to be in place. _I guess my question is how should I approach this?_ I could potentially spend time developing device simulators, but figuring that into the development estimate will balloon it more than most would probably appreciate. It may not accurately reproduce all issues either, and it's pretty rare to see the same equipment used twice around here. I could get better at unit testing...etc...I could also be loud about the issue and make others understand that temporary delays will be required, not much more than a headache for Research and Development but usually a perceived as a joke when pitched to manufacturing.


title: Separation of Concerns, Data Access Layer

text: I was thinking about this earlier today and figured I would get some input on the matter. When I develop applications I would usually have the Data Access Layer on another project, incase it could be re-used elsewhere in a similar manner in the future but also to allow updating the DAL without updating the UI layer. When doing so I handle all of the data querying etc in the DAL. The application does not need to know if its ADO.NET, EF or a List. However, it occurred to me that in almost all cases the return types are specified in the DAL. So the UI Layer does need to know about types defined there. Is that normal or is there a way for more seperation? (other than using Anon types)


title: How do you use the sample codes while reading programming books?

text: Programming books often contain a lot of code scattered within it. Usually there will be an accompanying website to download the code used in the book. How do you use the code? Do you just run them and check the results or do you code it from scratch again? If you are coding it from scratch, have you found any advantages( like remembering the content better etc)?


title: CSS in a CMS - Pros/Cons

text: I am a regular user of Wordpress and whenever I feel the need to change the look of a DOM element, I prefer to use it inline. This is just because I don't want go back to the stylesheet and create new classes and styles for a single different looking element on a particular post. Can anyone please list the **PROS and CONS of this technique**. And should I change it? _**PS - All suggestions should be given keeping the CMS factor in mind._**


title: Is taking frequent breaks really that beneficial when programming?

text: I keep reading that it is recommended for a programmer to take frequent breaks while programming, and the usual recommendation I see is 5 minutes every half hour or 10 minutes every hour. I gave it a try, but quite often I find something interesting during those 5 minutes, and it takes me away from what I was working on for longer than I planned. Either that, or my mind gets focused on something else and I find it hard to get back into my work and don't focus very well. Is it really that beneficial to take frequent breaks while programming? Am I doing something wrong for it to be decreasing my productivity instead of increasing it?


title: Should one use pseudocode before actual coding?

text: Pseudocode helps us understand tasks in a language-agnostic manner. Is it best practice or suggested approach to have pseudocode creation as part of the development lifecycle? For instance:   * Identify and split the coding tasks   * Write pseudocode   * Get it approved [by PL or TL]   * Start Coding based on Pseudocode Is this a suggested approach? Is it practiced in the industry?


title: Reason for placing function type and method name on different lines in C

text: I just started at a company and one of the style comments at my first code review was that the return type and method name should be on different lines. For example, this               void foo() {     }      should be this               void     foo() {     }      I've always used the first style, and I was wondering if there is any reason other than personal preference why people use the second style? I don't think the first one hurts readability at all. Is one more common than the other with C programmers and large open source projects?


title: The limit of Int32 for Identity Column

text: This is just a consideration for a site am creating and for other big sites out there. I am using Identity Column to store the ID of some of my tables and I have classes whose Id are decorated with `Int32` to hold the value of the ID retrieved from database. My worry is that as the site grows bigger, some tables that grows exponentially e.g `QuestionComments` might exceed the `Int32` limit in future. So I change my class to use `long`.               public class Question     {        public long QuestionID { get; set; }        ...     }      //Converting database value to .Net type                Question q = new Question();      q.QuestionID = Convert.ToInt32(myDataRow["QuestionID"]);      How true is my assumption? Would using a UniqueIdentifier be better? Are there other way to address this? **UPDATE:** But for the sake of learning, how would site like FaceBook, Google, StackOverflow etc. handle Visit table assuming they have VisitID as Identity Column


title: How to copyright personal code

text: I am writing a program using VBA because its readily available, the code will be available to Cracks even though I password protect it. I knew this when I chose VBA because portability is more important than protection. My question relates to copyright, I put copyright and my name in the code and on the spread sheet to indicate it is my program but is this enough when people start copying the code? Do you have a strong legal version which I could place in my code?


title: How similiar should the environments of PreProd and Prod be?

text: I've just recently been on a project and during the release, we realized that it didn't work in Production. It works in all other environments but because we have a separate release team, and we cannot set up the servers and environments ourselves, we have no visibility of the configuration on them. We suspect that Prod has some user permissions in its account or IIS settings that are different, so we are working though it now. So I think this whole thing has been a learning experience for me and I don't want the same thing repeated again. I would like to ask, how different should these environments be? I always thought that PreProd should be an identical copy to the Prod environment using a copy of the same database, using a copy of the same user account, should be installed on the same servers etc. But how far should I take it? If the web site is externally facing, should PreProd be externally facing? What if the website has components that don't require a user account or password to navigate to? Is it still okay to expose it to the outside world?


title: How to write a HTTP server?

text: As the title says, I would like to write a HTTP server. My question is this, how do I do this? I know this sounds VERY general and too "high level", but there is a method to my madness. An answer to this question should be, I believe, language agnostic; meaning, no matter what language I use (e.g., C, C++, Java, etc.) the answer should be the same. I have a general idea of how this is supposed to work:   1. Open a socket on port 80.   2. Wait for a client to make a request.   3. Read the request (i.e., this person wants page "contact-us.html").   4. Find and read "contact-us.html".   5. Send an html header, then send the content of "contact-us.html"   6. Done Like I said, I believe this is the process, but I am not 100% sure. This leads me to the heart of my question. How or where does a person find out this information? What if I didn't want to write just an HTTP server, what if I wanted to write an FTP server, a chat server, an image viewer, etc.? How does a person find out the exact steps/process needed to create a working HTTP server? A co-worker told me about the html header, so I would have NEVER know this without him. He also said something about handing off each request to a new thread. Is there some big book of how things work? Is there some manual of what it takes to be an HTTP server? I tried googling "how does a HTTP server work", but the only answers I could find were geared towards your average Joe, and not towards a person wanting to program a HTTP server.


title: Abstract Factory Method and Polymorphism

text: Being a PHP programmer for the last couple of years, I'm just starting to get into advanced programming styles and using polymorphic patterns. I was watching a video on polymorphism the other day, and the guy giving the lecture said that if at all possible, you should get rid of `if` statements in your code, and that a switch is almost always a sign that polymorphism is needed. At this point I was quite inspired and immediately went off to try out these new concepts, so I decided to make a small caching module using a factory method. _**Of course**_ the very first thing I have to do is create a switch to decide what file encoding to choose. DANG!               class Main {         public static function methodA($parameter='')         {             switch ($parameter)             {                 case 'a':                     $object = new \name\space\object1();                     break;                      case 'b':                     $object = new \name\space\object2();                     break;                      case 'c':                     $object = new \name\space\object3();                     break;                      default:                     $object = new \name\space\object1();             }                  return (sekretInterface $object);         }     }      At this point I'm not really sure what to do. As far as I can tell, I either have to use a different pattern and have separate methods for each object instance, or accept that a switch is necessary to "switch" between them. What do you guys think?


title: Software Manager who makes developers do Project Management

text: I'm a software developer working in an embedded systems company. We have a Project Manager, who takes care of the overall project schedule (including electrical, quality, software and manufacturing) hence his software schedule is very brief. We also have a Software Manager, who's my boss. He makes me write and maintain the software schedule, design documents (high and low level design), SRS, change management, verification plans and reports, release management, reviews, and ofcourse the software. We only have one Test Engineer for the whole software team (10 members), and at any given time, there are a couple of projects going on. I'm spending 80% of my time making these documents. My boss comes from a Process background, and believes what we need is better documentation to improve software: (1) He considers the design to be paramount, coding is "just writing the design down", it shouldn't take too long, and "all the code should be written before the hardware is ready". (2) Doesn't understand the difference between a Central & Distributed Version control, even after we told him its easier to collaborate with a distributed model. (3) Doesn't understand code, and wants to understand every bug and its proposed solution. (4) Believes verification should be done by developer, and validation by the Tester. Thing is though, our verification only checks if implementation is correct (we don't write unit tests, its never considered in the schedule), and validation is black box testing, so the units tests are missing. I'm really confused. (1) Am I responsible for maintaining all these documents? It makes me feel like I'm doing the Software Project Management, in essence. I'm ok with technical documentation, but I believe scheduling/planning should not be done by the developer. (2) I don't really like creating documents, I want to solve problems and write code. In my experience, creating design documents only helps to an extent, its never the solution to better or faster code. (3) I feel the boss doesn't really care about making better products, but only about being a good manager in the eyes of the management. What can I do? This whole year I've done 3 months of actual coding, the rest just spent in making documents and waiting for bug reports from clients.


title: How do web-developers do web-design when freelancing?

text: So I got my first job recently as junior web-developer.   My company creates small/medium sites for wide variety of customers: autobusiness companies, weddign agencies, some sauna websites, etcetc, hope you get my point. They don't do big serious stuff like bank systems or really big systems, it's mostly small/medium-sized websites for startups/medium sized business. My main skills are PHP/MySQL, I also know HTML and a bit of CSS/JS/AJAX. I know that good web-developer must know some backend language (like PHP/Ruby/Python) AND HTML+CSS+JS+AJAX+JQuery combo.   However, I was always wondering. In my company we have web-designer. In other serious organisations I often see the same stuff: web-developers who create business-logic and web-designers, who create design. As far as I know, after designers paint design of website they give it to developers either in PSD or sliced way, and developers put it together with logic, but design is NOT created by developers. Such separation seems very good for full-time job, but I am concerned with question **_how do freelance web-developers do websites_**? **_Do most of them just pay freelance designers to create design for them? Or do some people do both?_**   Reason why I ask - I plan to start some freelancing in my free time after I get good at web-development. But I don't want to create websites with great business-logic but poor design. Neither I want to let someone else create a design for me. I like web-development very much and I am doing quite good, I like design aswell, even though I am a bit lost how to study it and get better at it. But I am scared that going in both directions won't let me become expert, it seems like two totally different jobs and getting really good in both seems very hard. But I really want to do both. What should I do? Thank you!


title: Open source IDEs released under GPL

text: Some IDEs (or code editors like Notepad++) are released under GPL. If I decide to make a program using the IDE, do I have to release my program under the GPL? Or is it only if I take code from the open source?


title: How to validate the ajax post request is coming from

text: I am developing an web application in **MVC4**. I my application all the function is did by the **ajax post call**. I do not even **post single form(Even not have the form tag also)** all the things are did by the ajax call. but I am scared for the miss use of the my java script. Any one who got this code he can post the **dummy data** to my application. So I need to **validate** the weather the post request is coming form my website or not. I thought that the ajax call is good instead of posting all the form to server. Also I have did the validation at client side only. Is that also the threat for me?


title: Using the Decorator pattern to add public methods to an object

text: The Decorator pattern is usually used to extend the functionality of an object by extending one of it's current methods. To illustrate, please consider an object `object` and a decorator `decorator`. `object` has one method called `methodA()`. `decorator`, because we're in the Decorator pattern, also has this method by inheritance (both `object` and `decorator` eventually inherit from the same super-class which has `methodA()`. Let's call it `AbstractObject`). `methodA()` in `object` looks like this:               public void methodA(){         // do stuff     }      `methodA()` in `decorator` looks like this:               public void methodA(){         // do some extra stuff.         wrappedObject.methodA(); // and then delegate to the wrapped object.     }      It would be used like this:               AbstractObject object = new ConcreteObject();     object.methodA(); // does stuff     object = new ConcreteDecorator(object);     object.methodA(); // does stuff and some more stuff. the extended methodA().      The point of `decorator` is to extend the functionality of `object`, **and it does this by extending one of`object`'s current methods**. So far, classic Decorator. **Now, my question:** As I said Decorator usually extends an object's functionality by adding content to one of the object's current methods. But what if I wanted to use Decorator to **add public methods to an object**? Please consider the following scenario where `decorator` has another method `methodB()`:               AbstractObject object = new ConcreteObject();     object.methodA(); // does stuff     object = new ConcreteDecorator(object);     ((ConcreteDecorator)object).methodB();     // methodB() belongs to ConcreteDecorator() but not to AbstractObject().      As you see if I wanted to do this, I would have to cast `object` to `ConcreteDecorator`. This exposes the concrete type of `object` and the fact that it's decorated, and as such somewhat defeats the intent of the Decorator pattern. Also, the code invoking `methodB()` would have to know `object` is decorated. Again, not very much in the spirit of Decorator. **In light of this I have two questions:**   * Is the Decorator pattern ever used this way? Is it ever used to add public methods to an object, as opposed to only 'extending' it's current methods?   * Are there situations where this would be a good idea or a wise use of Decorator?


title: Any experience porting a Powerbuilder application to Java (or another language)?

text: Does anyone out there have any experience porting a large Powerbuilder client/server application to a Java application (or another language)? By large I mean something on the order of 2 million lines of code and literally hundreds of database tables. How did you do it? How long did it take and how much did it cost? What were the biggest challenges?


title: Programmer logbook application?

text: I've just released my application to the public, and I'm working on an updated version, but I really think I should keep track of ALL the code changes. In case some functionality suddenly starts failing, with a history of all the changes I made it would be a lot easier to figure out where I messed it up, in case the problem wasn't already there. The _ideal_ would be to have a super fast computer with a huge hard drive and an application that automatically saves a backup of the whole project every time I change a line in the code, with some file comparison tool that would show me every difference between any two backed up projects, but that's not really possible for now. So, do you know any application that makes it easy for a programmer to keep track of the changes made to the source code?


title: Multi-threaded server

text: I have written a server/client program in which I am using 2 threads :   * One to recieve data continously and   * Other to send data as the user writes it on screen Problem: I have created the threads but durung execution ,the control gets stuck in the recieving thread having the infinite loop to recieve data and never goes to the sending thread. Please tell me if there is any solution to the problem.


title: What is the most obscure sorting algorithm you know?

text: I just read about cyclesort via a sortvis.org blog post. This is probably the most obscure one I have heard of so far, since it uses maths that I am not familiar with (detecting cycles in permutations of integer sets). What is the most obscure one you know?


title: Object Oriented Programming Concepts and Interviews

text: I'm an Object Oriented Programming fanatic. I have always believed in modelling solutions in terms of objects. It is something that comes to me naturally. I work with a services start up that essentially works on application development using OOP languages. So I tend to test understanding of OOP in the candidate being interviewed. To my shock, I found very very few developers who really understood OOP. Most candidates brainlessly spit out definitions they mugged up from some academic book on object oriented programming but they don't know squat about what they are saying. Needless to say I reject these candidates. However, over the course of time, I ended up rejecting almost 98% of the candidates. Now this gets me thinking if I'm being over critical about their OOP skills. I still believe OOP is fundamental and every programmer MUST GET it. Language knowledge and experience is secondary. Do you think I'm being over critical or do I just get to interview bad programmers unfortunately? **EDIT:** I usually interview programmers with 2 to 5 years of experience. The position that I usually interview for is Ruby/Ruby on Rails application developer.


title: Why does every installer on Windows have to be run with elevated privileges?

text: The current tendency to ship even the smallest applications (like simple games, tools, etc.) as a Windows Installer (.msi) or even with .exe that can do virtually anything is very annoying. After the application is installed it is run as standard user, but it is useless if during installation it can do what it wants. For example, configuring a firewall, maybe I do not want my new shiny 15 KB calculator application to have full access to the Internet (for incoming connections :) ) Custom actions inside Windows Installer installer files are even worse, since it is possible to run a custom function inside the provided DLL file! How do you manage to handle this, just ignore problem, or maybe have some unknown for me methods of running Windows Installer packages? And from the other side, why on Earth is everybody making installers? In many many cases, a simple ZIP file will be enough, at least as a opportunity to a standard installer.


I’ve had this gut feeling about Windows Workflow (WW) for a while now. And, until now, I couldn’t think of the right words to say in order to explain it. Since I think I have a good way to verbalize it now, I thought I’d share. I believe there is a problem in our industry where a great percentage of developers take a long time to understand simple, solid OOP principles and design patterns. Indeed, many developers never reach this level of understanding. My unsubstantiated concern is that tools like WW further shield developers from good design. The reason for this is that, absent WW, a developer could be shown how to write code using a state pattern, or chain of responsibility pattern, or a rules engine, or even simple OOP. Many developers simply don’t know how to implement polymorphism. My fear is that tools like WW provide an abstraction that hides, or inhibits, good design by simply providing a way for developers to click boxes on a canvas and write code in those boxes. What’s going on under the hood, or what should be going on under the hood, is lost to the developer. Do tools, like Windows Workflow, inhibit development growth? Disclaimer: I have not used WW. There may be great use cases for using it. My thoughts, above, are simply a gut feeling, and I'd be curious to know how others feel about the topic.


title: What ESB systems work the best for .Net stack

text: What Enterprise Service Bus would you use and why?


title: Is MVC the optimal pattern to build a RESTful web service?

text: Not being a Java practitioner, I recently came to learn about the JAX-RS specification and Apache CXF framework. While still wrapping my head around all these things, I also read the this question on SO. Since MVC is a design pattern while JAX-RS is a specification, I was confused about the comparison. Granted my nascent understanding of JAX-RS, what makes it more suitable for implementing a RESTful API than say a framework that uses the MVC pattern? N.B. I have a C and Python background.


title: How to structure REST api service that accepts POST parameters in the body

text: Everything I've read says to pass parameters to a REST service in the URI, whether by template, or query string:               https://www.myapp/my/login/api/authenticate/ganders/mypassword      or               https://www.myapp/my/login/api/authenticate?user=ganders&password=mypassword      But obviously those are exposing my username and password in clear view. Our security guy is saying that we need to pass the parameters in the body of the request. How do I do that? Examples, or just a link to an example is sufficient because apparently my googling skills are not very high. One thing that I've found so far is that if you decorate your service methods with the attribute [FromBody], like this:               public AuthenticationResult Authenticate(**[FromBody]**LoginData loginData)     {         return AuthenticationResult.Authenticated;     }      that will grab them from the body. My other task is trying to test this? Is this a task for Fiddler? Or Chrome Dev tools? Another thing I've found so far is that you can only have 1 parameter in the post, is that accurate? Sorry, lot's of questions here. Spent all day yesterday trying to research this and obviously didn't get very far... Edit: So here's what I have so far, this is the "GET" version that we need to convert to a POST (this is Angular calling C# REST API)               $http.defaults.headers.common.Authorization = 'Basic ' + encoded;          var url = $rootScope.serviceBaseUrl + "login/get" + "?username=" + user + "&password=" + password + "&accesstoken=";          $http({method: 'Get', url: url}).success(.....).error(......);      And the REST service:               [HttpGet]         public AuthenticationResult Get([FromUri]LoginModel login)         {             try             {                 AuthenticationService authService = new AuthenticationService();                 AuthenticationResult result = authService.IsAuthenticated(login);                      if (result.IsAuthenticated)                     return result;                 else                 {                     return new AuthenticationResult()                     {                         IsAuthenticated = false,                         User = new User()                         {                             UserId = login.Username                         }                     };                 }             }             catch(Exception ex)             {                 return new AuthenticationResult()                 {                     IsAuthenticated = false,                     User = new User()                     {                         UserId = login.Username,                         Token = ex.Message                     }                 };             }         }      Edit2: I'm getting closer. I've got the response to go through (via Fiddler), but my json array of data that I'm passing is not getting mapped to my complex type. Here's what I've got: In Fiddler:               User-Agent: Fiddler     Host: localhost:42761     Content-Length: 73     Content-Type: application/json     Accept: application/json      "Request Body":               {     "Username": "ganders",     "Password": "hashedPassword"     }      My "LoginData" object is instantiated on the service-side, but my two properties are null...


title: Combining asynchronous and synchronous programming

text: I've got trouble wrapping my head around a certain problem: In my data-flow app (a visual editor), I have both autonomous objects which communicate though ports via unordered simultaneous messages and thus represent an asynchronous system. ![in this picture, f would receive x from the first object, transform and immediately send the transformed value to the next](http://i.stack.imgur.com/MNRFL.png) Still, I also want to use functions which are synchronous, e.g they need input to compute it's value Now the problem is - how do I combine both with a non-trivial system? ![2](http://i.stack.imgur.com/wHG9E.png) In this picture, f needs x and y to compute its value, but during any point in time, only one input may be present (suppose x is present, y is not). Generalize this to higher dimensions I can see a possible way out:   * make x an array X = (x,y) and combine the first two objects resulting in a Type-1 like system ..   * or make f an active object, which caches x,y and then computes   * or make f always compute its value (e.g when only x is present, compute x*y = x*0 ...) * * * So the possibility of futures was mentioned. I'M using Java, so i'll frame my possible solution via Objects ![X is sent, y is missing -> create future \(maybe a copy of f\) waiting for y](http://i.stack.imgur.com/4N34O.png) X is sent, y is missing -> create future (maybe a copy of f) waiting for y ![enter image description here](http://i.stack.imgur.com/JJme0.png) ![enter image description here](http://i.stack.imgur.com/WWuPM.png)


title: DDD / Optimizing a specific service belonging to a specific bounded context regarding hardware

text: Well known is the split of a whole application into several bounded contexts to emerge an Ubiquitous language. while practicing Domain-Driven Design. In general, 1 bounded context = 1 archive file ready to be deployed (JAR / EAR / DLL etc..) My question concerns the bounded contexts deployment regarding hardware optimization: Suppose I want to optimize one specific service within a specific bounded context (optimization could be a more powerful CPU, more RAM, etc..), is it a good practice to create a specific archive file just for it? Meaning to split further the initial bounded context. Thus, in order to deliver it on a specific hardware tunes for its usage. Or should I consider 1 bounded context as being an **indivisible** unit and therefore optimizing the bounded context as a whole even if some specific services doesn't need this increase of hardware power?


title: DATABASE design for storing specifications?

text: I am creating , a site like gsmarena , can any one help me with database design to store mobile specifications like here "http://www.gsmarena.com/asus_padfone_infinity_lite-6120.php" as user can add more custom specification ,


title: Using class like an object in Python

text: I am learning from _Learn Python the hard way_ where I have come across a study drill where they want to know that whether a class can be used like an object. As I have experimented:               class A(object):         def __init__(self):             print "in here"         def cat(self,name):             print "my cat ",name      Here if I write `A.cat(A(),"Tom")`, it works and found out that its call unbound method. Now, does that mean I can assume that classes can be used like an object?


title: Specific class to pass a bundle of data from my Model to Controller or a simple Collection?

text: I am doing an Invoice application implementing MVC pattern design in Java. One of the features my application has to have is showing all info about a Customer: Personal data, Calls, Invoices, TelephoneNumber, etc. My model, which has access to all this data, has to pass and assemble this to pass it to the Controller. Then, my Controller will show it via my View.   I have thought how to make the connection between the Model and the Controller in a pretty way. One of my alternatives is to add every DTO (TelephoneNumber, CustomerData), and Collection of DTO (Collection, Collection, and more) to a Collection. IMHO, this is not a good approach to solve this problem well, because I am creating a lot of dependency in the Controller when receiving this information and casting according to the order of assembling. As I wanted to find another solution, I had the idea of creating a class (Bundle) which wraps me customer's data and then, in Controller's code, I use the methods of this class to get the data I need to display. My question is about if my solution is good or it would be another which will be better. I am not quite sure if the Bundle class will be a solution or just crap.   Thanks.


title: Is there a Javascript library for creating vintage photos?

text: I'm working on a Canvas object in HTML5, and I am attempting to make some photos look "better". I tried VintageJS, an existing photo-retouching Javascript library, and Picozu, a web application cloning some Adobe Photoshop functionalities, but I'm still not happy. Can you help me with an algorithm or point to an existing Javascript library that would allow me to make my photos look like the following example? http://i46.photobucket.com/albums/f137/thanhtu_zx/Untitled-1.jpg ![example of a "vintage" look](http://i.stack.imgur.com/59Uee.jpg)


title: Pair Swapping: What are the Pros and Cons?

text: The general idea that is espoused by most _Agile_ / _XP_ theorists seems to be that pairs should swap regularly. For example each programmer should swap pairs once per day; half the people swap at the start of the day, half the people swap after lunch: due to external factors such as meetings, holidays and the like most people will tend to flip their swap times once or twice per week so that the pair configurations distribute fairly evenly across the team. One rationale behind frequent swapping is that knowledge is spread amongst the team quickly and evenly, rather than having specific skills and knowledge being concentrated in particular individuals - implying that work can continue smoothly if people are either away or leave the company. Another rationale, which is a sort of corollary to the dogma surrounding pair programming itself, is that each time someone swaps on you are getting a new code review by a fresh pair of eyes, so it can only improve code quality. Both assertions sound reasonable; from a management point of view it sounds like you get an increase in both stability and quality, and as such frequent swapping is pretty much standard theory in most _Agile_ / _XP_ books that I've looked at. So, when actually put into practice, what do people actually think about pair swapping from   * A programmer's point of view?   * A manager's point of view? And   * What should determine when someone swaps off of / onto a pair?


title: C# String.format extension method

text: With the addtion of Extension methods to C# we've seen a lot of them crop up in our group. One debate revolves around extension methods like this one:               public static class StringExt     {         /// <summary>         /// Shortcut for string.Format.         /// </summary>         /// <param name="str"></param>         /// <param name="args"></param>         /// <returns></returns>         public static string Format(this string str, params object[] args)         {             if (str == null) return null;             return string.Format(str, args);         }     }      Does this extension method break any programming best practices that you can name? Would you use it anyway, if not why? If I renamed the function to "F" but left the xml comments would that be epic fail or just a wonderful savings of keystrokes?


title: Is there something better than a StringBuilder for big blocks of SQL in the code

text: I'm just tired of making a big SQL statement, test it, and then paste the SQL into the code and adding all the `sqlstmt.append("` at the beginning and the `")` at the end. It's 2011, isn't there a better way the handle a big chunk of strings inside code? Please: don't suggest stored procedures or ORMs. **edit** Found the answer using XML literals and CData. Thanks to all the people that actually tried to answer the question without questioning me for not using ORM, SPs and using VB **edit 2** the question leave me thinking that languages could try to make a better effort for using inline SQL with color syntax, etc. It will be cheaper that developing Linq2SQL. Just something like:               dim sql = <sql>               SELECT * ...               </sql>


title: De-facto standards for customer information record

text: I'm currently evaluating a potential new project that involves creating a DB for typical customer information (userid, pwd, first & last name, email, adress, telfnr ...). At this point, requirements are only roughly defined. The customer DB is expected in the O(millions) of records. In order to calculate some back-of-the-envelope numbers for DB sizing and evaluate potential DB options & architectures, I'm looking for some de-facto standards for these kind of records. **In particular, the std size of every field (first name, last name, address,...) or typical avg for a simple customer record would be great info**. With so many e-commerce websites out there, there should be some kind of typical config that can be reused and avoid re-inventing the wheel. Any ideas? \---- edit ---- The answers seems to be steering towards adopting an standard customer record vs designing your own. I would like to stress that the focus of this question is to locate a **reference** for field sizing for a customer object, and avoid figuring that out on my own.(I've emphasized that part on the original text - **now in bold** -)


title: Static teams or dynamic teams?

text: Is it better to assemble permanent teams of developers within the company that always work together, from project to project, or is it better to have dynamic teams that assemble for a project, and then dissasemble afterwards? My inclination is to treat the entire company as a "platoon" and to assemble "fireteams" for individual projects, choosing from the "platoon" those developers best suited for the project.


title: Designing a hierarchical structure with lots of reads and writes?

text: I am in the process of working on a video on demand system part of it involves the management of a hierarchical tree structure (think windows explorer) which allows users to upload videos, move folders around, create new folders etc. User action will be allowed depending on which permissions they have. In addition to managing the structure (creating folders and uploading videos), subscribers will be viewing content (read access). The number of reads will be significantly more than the writes. My question (and it is big one) is should I store the data in a database (for the writes) and also have some sort of cache which will be used for the reads? or do I use two databases? or is there a better solution? Also I will have to resolve concurrency issues which I think optimistic locking on the database will resolve. I have a fair bit about CQRS over the last few months but not sure if this is the way to go. Any ideas?


title: faster algorithm for finding all subsets

text: This is the algorithm (pseudocode) I have right now for finding all subsets for a given set with length k:               void allSubsets(set[]) {         for (i = 0; i<k; i++) {             for (j = i + 1; j<k; j++) {                 print(set[i...j]);             }         }     }         But it's run-time is O(n^2). Can anybody improve this?


title: Is case after case in a switch efficient?

text: Just a random question regarding switch case efficiency in case after case; is the following code (assume pseudo code):               function bool isValid(String myString){        switch(myString){        case "stringA":        case "stringB":        case "stringC":           return true;        default:           return false;     }      more efficient than this:               function bool isValid(String myString){        switch(myString){        case "stringA":           return true;        case "stringB":           return true;        case "stringC":           return true;        default:           return false;     }      Or is the performance equal? I'm not thinking in a specific language but if needed let's assume it's Java or C (for this case would be needed to use chars instead of strings).


title: git for personal (one-man) projects. Overkill?

text: I know, and use, two version control systems: Subversion and git. Subversion, as of now, gets used for personal projects where I am the only developer and git gets used for open source projects and projects where I believe others will also work on the project. This is mostly because of git's amazing forking and merging capabilities, where everyone may work on their own branch; very handy. Now, I use Subversion for personal projects, as I think git makes little sense there. It seems to be a little bit of overkill. It is OK for me if it is centralized (on my home server, usually) when I am the only developer; I take regular backups anyway. I don't need the ability to make my own branch, the main branch _is_ my branch. Yes, SVN has simple support for branching, but much more powerful support for it makes no sense, I think. Merging can be a pain with it, or at least from my little experience. Is there any good reason for me to use git on personal projects, or is it just simply overkill?


title: What usability issues have you had with VS2010?

text: A few of my friends have noticed some quirks with vs2010... notably the Undo/Redo feature doesn't seem to work reliably... often messing up the code beyond comprehension. What other quirks have you seen? **Update for vs2010 users (nonSP1)** Please post your bugs at Microsoft connect, and a corresponding link here so we can up vote them as needed. https://connect.microsoft.com/VisualStudio?wa=wsignin1.0 **Update for VS2010 SP1 Users** You can download the SP1 for all versions of Visual Studio here. Just be aware that there are compatibility issues mentioned in the readme. Also some people have reported issues with this release. Please report bugs here: https://connect.microsoft.com/VisualStudio?wa=wsignin1.0


title: JSP Model 2 Architecture and Dependency Injection

text: If I'm writing a web application that uses the model 2 architecture, is it possible to use the Google Guice framework (or really any IoC container)? The reason I ask this question is because everything I've researched about DI, IoC, et cetera always uses Spring, Hibernate or some other framework/container in their examples. I'm just using Java classes, controllers, and JSP's to build this application and I can't find any good documentation about the subject.


title: What is the current status of software support for JPEG-2000?

text: The general recommendation to record original scanned images used to be "use TIFF". But programmers need evolution of format for "evolution of software", and I need to evolve my system to change from TIFF to JP2. I have a big image storage (terabytes) for legal and scientific scanned materials, they need original recording. I use some caching rules, but the system need to show (via web download) or to manipulate (ImageMagick and others) original data. I've read an article about migrating image storages from TIFF-lossless to JPEG-2000-lossless and the conclusion is to stay with TIFF. However the article is from 2009 and at the time they found support for the JPEG-2000 format by available software was very poor. The conversions to JPEG-2000 were lossy in the software they tested, and the available software for consuming images did not support the format well. **Is now the time to change from TIFF to JP2, or not?** Is the software support still as flawed as it was in 2009?


title: Which tasks should a beginner, intermediate and advanced rails developer be able to complete?

text: I have been programming ROR for about a year now, and I think I am ready to start working on a project for someone else. The problem is that job postings for contractors don't really tell you which specific tasks you should be able to do at different experience levels (in rails and other technologies), so I don't know where to pitch myself. I think I am somewhere between junior and mid-level, but who knows? So my question is: Which actual tasks should an junior programmer be able to do at, say, $35 an hour, which actual tasks should an intermediate programmer be able to do at, lets say, $75 an hour, and which actual tasks should an advanced programmer be able to do at, oh say, $140 an hour? One or two examples should suffice.


title: What is the proper way to create requirements documents?

text: Right now my supervisor is creating requirements documentation / specs for me using bugtracking software. This seems like a terrible idea to me, all the requirements are on these little tickets and I have to click around on this dumb webform to get at the requirements. What is a sane software solution for requirements / software specs? To be clear, I am building this large software component with quite a few features and these features are being set forth in this bugtracking software.


title: The value of an updated specification

text: I'm at the tail end of a large project (around 5 months of my time, > 60,000 lines of code) on which I was the only developer. The specification documents for the project were designed well early on, but as always happens during development, some things have changed. For example:   * Bugs were discovered and fixed in ways that don't correspond well with the spec   * Additional needs were discovered and dealt with   * We found areas where the spec hadn't thought far enough ahead and had to change some implementation   * Etc. Through all this, the spec was not kept updated, because we were lean on resources (I know that's a questionable excuse). I'm hoping to get the spec updated soon when we have time, but it's a matter of convincing management to spend the effort. I believe it's a good idea, but I need some good reasoning; I can't speak from very much experience because I'm only a year and a half out of school. So here are my questions:   1. What value is there in keeping an updated spec?   2. How often should the spec be updated? With every change made that might affect it, just at the end of development, or something in between? EDIT to clarify: this project was internal, so no external client was involved. It's our product.


title: Increase speed of a VB.net Application to SQL server 2008 and Hamachi VPN

text: Our current Information System (complete with path for pictures for records stored in db) has the following specifications:   * A desktop application was developed in vb.net   * We use SQL server 2008 r2 as the database   * Server specs: Intel xeon processor clocking in at 2.40 ghz, 2 GB RAM and Operating system   of 2008 R2   * Hamachi VPN for our offshore offices (within country).   * Office has 6mb dedicated internet connection. Offshore offices have varied ranging from 2mbps to 1mbps The application made in vb.net is connected to the server via IPaddress(locally) and hamachi public IP (for offshore)(we made sure that the tunnel is direct, not relayed) We found some weird things while users used the application. There are times where there are 5 users (local and offshore) simultaneously using it, and it went great. Then there would be times where even just three active users (still local or offshore) would suddenly experience extreme slowdown (even for something as simple as a select query to database for verification of log-In). For offshore clients we tried to ping them in hamachi and found out that each has speed averaging at 500 bytes per reply. Also, loading records that have pictures in them takes a REALLY long time. Wasn't it supposed to be that if you put image path instead of using BLOB, imaging would be faster? (The applications images is stored in a shared folder on the server, then we map that folder to the client unit). The questions are: based on the given above, how can we exactly speed up the system? Should we improve the server specs? is the internet provider the problem? must we redesign how we manage pictures in the system? What are the bottlenecks and how do we remedy it? Are there any other things that I should be aware of?


title: How can this deterministic linear time selection algorithm be linear?

text: Im trying to understand the basic concepts of algorithms through the classes offered at Coursera (in bits and pieces), I came across the deterministic linear time selection algorithm that works as follows:               Select(A,n,i)     (0)  If n = 1 return A[1].     (1)  p = ChoosePivot(A, n)     (2)  B = Partition(A, n, p)     (3)  Suppose p is the jth element of B (i.e., the jth order statistic of A). Let the “ﬁrst part of B” denote     its ﬁrst j − 1 elements and the “second part” its last n − j elements.     (3a)  If i = j, return p.     (3b)  If i < j, return Select(1st part of B, j − 1, i).     (3c)  Else return Select(2nd part of B, n − j, i − j).      And sorts the array internally in the `ChoosePivot` subroutine to calculate the median of median using a comparison based sorting algorithm. But isnt the lower bound on comparison based sorting `O(nlogn)`? So how would it be possible for us to acheive `O(n)` for the entire algorithm then? Am I missing something here?


title: Are there any situations where having a "data model" in which all your entities are instances of a Map<String, Object>

text: Are there any situations where having a "data model" in which all of the entities are instances of a `Map<String, Object>` would make any sense? How do you explain to someone why having such a "data model" is not such a good idea? It seems like it's an absurd approach to me, could I be missing something?


title: Testing for object equality by comparing the toString() representations of objects

text: Following on from this question \- how do you explain to someone that this is just crazy!:               boolean someMethod(Map<String, Object> context) {         Object object = context.get("someProperty")          Object another = context.get("anotherProperty")               return object.toString().equals(another.toString());     }      Apparently the reason for why `Object.equals(...)` is not used is that "what's contained in the Map is not concretely known, but is definitely known to be one of the primitive wrappers i.e. `String`, `Double`, `Boolean`, etc... and that `Boolean.TRUE` is required to be `equal(...)` to the `String` "TRUE"".


title: building a chat bot for an e-commerce site

text: I was recently talking to a couple of friends who run a modest e-commerce website (Daily visitors: approx. 100,000,). They plan to have an in-site chat module to engage customers. Since the whole operation is run by 3 people at the moment, they probably won't be able to respond to all the queries in a timely manner. The question they asked me was, was it possible to build an automated chat bot which could maybe engage the customers for simple queries and for more complex ones, forward the chat to one of them. Now, I haven't built anything of the sort and it looks like a great challenge that I'd love to take up. There's no set deadline for the moment (which is really great) and this gives time (hypothetically) to learn a few things that may come in handy. My questions are as follows:   * What sort of architecture would this chat bot consist of?      * I was going through this site for a rough idea but I noticed they didn't use a database.     * Is noSQL the standard where chat bots are concerned? If yes, which one's recommended?   * I have am comfortable with Python - is that a good enough language to build this?   * If I wanted to make this project available to more than one person/project, what are the considerations which have to be taken into account so that this bot is adaptable to any site. For example, the people for whom I intend to build this for sell only t-shirts on their site. So they bot would answer questions related to fabrics, designs, colors etc. But tomorrow, if I want to show this bot to someone who, say sells pottery on his site, which parts of the bot should I leave open to learning? Or should I have a separate module which learns the products of the target site? At the moment I am using this question as a starting point. I apologize if there's anything left out. Please let me know if there are more details required.


title: What does the lack of Unicode support in PHP mean?

text: How can the lack of Unicode support in PHP affect a PHP web app?


title: Should programming languages be strict or loose?

text: In Python and JavaScript, semi-colons are optional. In PHP, quotes around array-keys are optional (`$_GET[key]` vs `$_GET['key']`), although if you omit them it will first look for a constant by that name. It also allows 2 different styles for blocks (colon, or brace delimited). I'm creating a programming language now, and I'm trying to decide how strict I should make it. There are a lot of cases where extra characters aren't really necessary and can be unambiguously interpreted due to priorities, but I'm wondering if I should still enforce them or not to encourage consistency. What do you think? * * * Okay, my language isn't so much a programming language as a fancy templating language. Kind of a cross between Haml and Django templates. Meant to be used with my C# web framework, and supposed to be very extensible.


title: Why are most browsers developed in C++

text: It seems like most of common web browsers (Firefox, Chrome, Safari) are developed using C++. My question is straightforward. Why they use mainly C++ rather than any other language? **Edit: What factors must have been considered when its come to C++ Write ability, Cost, Reliability etc. ?**


title: How can I apply regression modeling to analyze the characteristics of Extreme Programming and the Rational Unified Process?

text: I have been given task that has a case study developed by Extreme Programming (XP) and the Rational Unified Process (RUP). I was asked to apply regression models and take some dependent variables and some independent variables in order to compare both XP and RUP. Even though I have been searching, I have not been able to identify dependent and independent variables could be used in software quality testing?