title: Resources for creating a turn-by-turn navigation system

text: I'm trying to create a kind of turn-by-turn satellite navigation system using the iOS SDK. I get the directions from the server and draw them on the map, then I keep getting location updates from the iPhone's GPS chip. Currently I start by finding the nearest turning point then, each time the user comes within a certain distance of the next turning point, a verbal cue is given and the turning point index is incremented. This is a delicate system and I'd like to make it more robust so I can tell when the user is going the wrong direction etc. Basically I'm looking for some literature about turn-by-turn navigation, in terms of tracking the user's progress and whether they're going the right direction. I'd have thought there's a lot of research out there but I can't seem to find anything apart from simple tutorials on how to use a given SDK or directions API. Can anyone direct me to a good run-through of the various techniques used in software such as TomTom or Google Maps Navigation?


title: Design pattern for overlapping actions and animations?

text: Is there a design pattern for dealing with overlapping UI actions and animations? A few examples:   1. Let's say I have an interactive table row that expands to reveal an extra control when the user clicks on it, and vice versa if they click on it again. If the user clicks on the row while the expand animation is in progress, I want it to stop animating and shrink back to its original size from the place where it stopped.   2. I have a set of rows from example 1 inside a group. When the last row is deleted, I want the group to shrink and then remove itself in a callback. However, while the group is shrinking, the user could still add another row to it. If that happens, I want the group to stop shrinking, expand to the correct size, and add the row.   3. What if I have a sorting function for the UI in example 2? If the user clicks on the sort button, the rows shuffle and animate into their new positions. However, I still want the user to be able to click on table rows, delete rows, and do everything else that my UI allows. The UI should behave sensibly, with the shuffle animation taking precedence. You could automatically fast-forward all animations for a UI element when a new action is performed on it, and/or block user input in all animating UI elements. But that seems inelegant to me. As a user, I really admire UIs that don't stutter or block me from doing what I want — UIs, in other words, that behave like real objects — and I'd like to do the same in my own applications. It seems to me that you'd need to have constraints for each action/animation in order to make this a robust system. For example, you might need to ensure that any changes to your data/state/model happen _only_ in the callback to your animation, not before. In example 2, you can't delete the group in your model as soon as the user clicks the button to delete the last row; it has to be done at the end of the animation, and at the end of the animation only. (Otherwise, if the user decides to add another row during the delete animation, reverting the group delete would be very difficult.) You might also need to design the animation system in such a way that if two animations from two different actions overlap, any mutually exclusive properties would continue animating as before. (In other words, if the user sorts the table while a row is expanding on click, the width expansion should not stop just because the row is moving to its new position.) And what about starting defaults for each animation? If a row fades out when deleted, and then another action implicitly cancels the delete, the fade out should stop and animate back in, even though the other action might not necessarily know about it. There's also the higher-level issue of animations (visual property changes) vs. actions (sequences of events, with potential model changes, that include animations). In example 2, "delete last row" is clearly an action, since the end result is that a group gets removed. However, in most UI libraries, you'd add the callback to the animation, conflating the two. This is also an issue in games. If I need to trigger a grenade throw after my character's throw animation finishes, how do I represent that in my code? How do I place the grenade throw on my timeline without mixing model and view code, while still allowing the animation to slow down and speed up based on external factors? The more I think about this, the more my head hurts, and the more I'm convinced that somebody has already thought this through a lot more carefully than me. Any ideas? (At the moment, I'm mostly interested in this for web UI, but I'm also interested in a general approach for my future, non-web projects.)


title: Common practice to transfer named parameters in Tcl

text: Using Tcl8.5, what is the common practice to transfer **named** variables to a proc/method? Something that will be similar to defining the class members when instantiating a class object _[incr Tcl]_. Something like this:               # Passing 3 parameters: "hello", "how" and "doing".     procName -hello world -how you -doing today     # We can easily add or remove any parameters to/from any location      **Edit #1:**   Same example as above, but more similar to python:               procName hello=world how=you doing=today


title: String and Suffix Matching from a Suffix List

text: I'm having trouble finding an algorithm that matches (or fails to match) a substring of a string to a suffix from a list of suffixes. The hits I'm finding are for suffix trees and suffix arrays, but they are not quite what I am looking for. My particular problem is a fully qualified hostname - possibly malformed - and trying to match the suffix provided by the banned suffix list published by Mozilla. As a concrete example, given `w.x.y.z.example.com`, I need to identify it as hostname `w`, domain `example.com`, and know that `example.com` is valid domain. As a degenerative example, I may need to take `example.com` and know that its a domain with no host, and that matching it to `*.com` would be wrong. And the negative cases only get worse when you factor in suffixes like `pvt.k12.ma.us`, `nasushiobara.tochigi.jp`, `公司.cn` and `السعودیة`. The eventual application will be DNS hostname matching in X509 certificates. Hence the reason there may be malformed input from miscreants. I think this algorithm should run in _m log n_. _log n_ for each lookup into the [sorted] list of suffixes, and _m_ for each DNS label. I think it may be a case of not seeing the forest through the trees. Does anyone know of an efficient algorithm for matching substrings from a list of suffixes?


title: In what way(s) is LLVM Low Level?

text: In what way(s) is LLVM (Low Level Virtual Machine) Low Level? (At the time of writing, I did not find this expansion of the abbreviation "LLVM" on its web site, but on Wikipedia.) Is it called "Low Level" in what is it designed for (a compiler infrastructure) or because it is works on a "lower level" than other tools? As a (kind of) "illustration" of this, is LLVM lower-level than the JVM and CLR, or is it only _designed_ for "lower level" uses?


title: Customer ask firmware source file

text: Recently my company was asked by a customer to develop a control board that includes firmware and PCB layout development. After finishing development the customer will buy the control boards at certain quantity every year. We are now at making contract stage, the customer is wanting my company to handover both the firmware source files and PCB layout files after development. We could give the PCB layout files but we don't want to give the firmware files as we're worried about they may find third party to produce the control board so that we may have nothing. However from the customer point of view, they are concerned that they could be in risk situation if my company for some reason stops selling the boards. Is there any "common" practice to make contract regarding this?


title: Should all developers on a team have equal role/responsibility in writing and updating software design documents

text: I've asked a very similar question few days ago, but because I presented too much of my company's current situation, most answers focused completely on something that I wasn't looking to answer. So I wanted to try again... Given just about any agile team, you always have people with varied a) knowledge of the product b) experience in producing designs and c) general level of competence. So let's say you take an agile team and using the factors (a), (b) and (c) above you come up with an overall score for each engineers (mental exercise only). Now we sort them in ascending order and get a continuous spectrum. So the question I wanted to ask is this: _Should every single person on this spectrum be given equal responsibility as it comes to writing/updating software design specifications?_ I'm not talking about coming up with software design, in agile teams that is usually done by more than one person in a more collaborative setting. But at the end of the day, someone has to go back to his desk open their favorite (and company/team approved) document editor and type it all in. The reason I ask this question is because it seems people on high end of the spectrum tend to produce documents which are more readable, concise but have exactly the information you would want in a design specification so that future people who read it have much more benefit. People on the opposite side of the spectrum tend to produce documents which are not nearly as useful or clear and a lot of times, even with several iterations of design reviews, their work doesn't seem nearly as helpful (so specs they produce become write only dumping ground that no one reads or trusts because of the way they are written). I'm not proposing that the agile team be segregated and only certain individuals given certain roles that will never change. I'm asking... 1) what do you do in your teams with people who have vastly different (a)x(b)x(c) scores 2) Does it make sense to not give equal responsibility to everyone. Instead, give only smaller (or none) update tasks to those on the low end of the spectrum. But then work with these individuals by identifying (a), (b) and (c) factors that they'd need to improve and as those get improved give them more responsibility. Personally, I'm not sold on one way or another, I'm just curious how other teams are dealing with this.


title: When you should NOT use Regular Expressions?

text: Regular expressions are powerful tool in programmer's arsenal, but - there are some cases when they are not a best choice, or even outright harmful. Simple example #1 is **parsing HTML with regexp** \- a known road to numerous bugs. Probably, this also attributes to parsing in general. But, are there other clearly no-go areas for regular expressions ? * * * p.s.: " _The question you're asking appears subjective and is likely to be closed._ " - thus, I want to emphasize, that i am interested in examples where usage of regexps is known to cause problems.


title: Need to process 2 million 100k messages per second and route them to a particular event, delegate or multicast delegate

text: I need to process 2 million messages per second (perhaps in a scale out configuration) and route each message to a N delegates or multicast delegates. **Question** How should I structure my application in C# so that I can achieve the best performance when receiving the message, and routing it to the correct delegate? **Additional Details** Each inbound message has the following properties in the format of a JSON array:   * Customer   * Category   * TopicID   * DateTime   * Data[] Each message will be processed by a delagate function that is interested one or more of those properties. **Simple examples of delegate processing needed:**   * A customer counter function may count the quantity of messages per customer,    * A category counter may count the quantity of messages that counter   * A customer-counter will count messages unique to that customer.


title: Can anyone recommend coding standards for TSQL?

text: We've long had coding standards for our .Net code, and there seem to be several reputable sources for ideas on how to apply them which evolve over time. I'd like to be able to put together some standards for the SQL that is written for use by our products, but there don't seem to be any resources out there on the consensus for what determines well written SQL?


title: What are developer's problems with helpful error messages?

text: It continue to astounds me that, in this day and age, products that have years of use under their belt, built by teams of professionals, **still** to this day - fail to provide helpful error messages to the user. In some cases, the addition of just a little piece of extra information could save a user hours of trouble. A program that generates an error, generated it for a reason. It has everything at its disposal to inform the user as much as it can, why something failed. And yet it seems that providing information to aid the user is a low- priority. I think this is a huge failing. One example is from SQL Server. When you try and restore a database that is in use, it quite rightly won't let you. SQL Server _knows_ what processes and applications are accessing it. Why can't it include information about the process(es) that are using the database? I know not everyone passes an `Applicatio_Name` attribute on their connection string, but even a hint about the machine in question could be helpful. Another candidate, also SQL Server (and mySQL) is the lovely `string or binary data would be truncated` error message and equivalents. A lot of the time, a simple perusal of the SQL statement that was generated and the table shows which column is the culprit. This isn't always the case, and if the database engine picked up on the error, why can't it save us that time and just tells us which damned column it was? On this example, you could argue that there may be a performance hit to checking it and that this would impede the writer. Fine, I'll buy that. How about, once the database engine knows there is an error, it does a quick comparison after-the-fact, between values that were going to be stored, versus the column lengths. Then display that to the user. ASP.NET's horrid Table Adapters are also guilty. Queries can be executed and one can be given an error message saying that a constraint somewhere is being violated. Thanks for that. Time to compare my data model against the database, because the developers are too lazy to provide even a row number, or example data. (For the record, I'd never use this data-access method _by choice_ , it's just a project I have inherited!). Whenever I throw an exception from my C# or C++ code, I provide everything I have at hand to the user. The decision has been made to throw it, so the more information I can give, the better. Why did my function throw an exception? What was passed in, and what was expected? It takes me just a little longer to put something meaningful in the body of an exception message. Hell, it does nothing but help _me_ whilst I develop, because I know my code throws things that are meaningful. One could argue that complicated exception messages should not be displayed to the user. Whilst I disagree with that, it is an argument that can easily be appeased by having a different level of verbosity depending on your build. Even then, the users of ASP.NET and SQL Server are not your typical users, and would prefer something full of verbosity and yummy information because they can track down their problems faster. Why to developers think it is okay, in this day and age, to provide the bare minimum amount of information when an error occurs? It's 2011 guys, come _on_.


title: The suffix Exception on exceptions in java

text: Specifying a suffix of Exception on exception classes feels like a code smell to me (Redundant information - the rest of the name implies an error state and it inherits from Exception). However, it also seems that everyone does it and it seems to be good practice. I am looking to understand why this is good practice. I have already seen and read the question why do exceptions usually have the suffix exception in the class name The question is for PHP and while the responses are probably valid for Java. Are there any other arguments or is it really as simple as explicitly differentiating them? If we take the examples from the previous question - could there really be classes in java with the name `FileNoFound` that is not an exception? If there could be, does it warrant suffixing it with `Exception` ? Looking at a quick hierarchy in eclipse of `Exception`, sure enough, the vast majority of them do have the suffix of exception, but there are a few exceptions. `javassist` is an example of a library that seems to have a few exceptions without the suffix - e.g. `BadByteCode`, `BadHttpRequest` etc. `BouncyCastle` is another lib with exceptions like `CompileError` I've googled around a bit as well with little info on the subject.


title: I need advice developing a sensitive data transfer/storage/encryption system

text: I got closed on SO and told to post this here as it's about general application design as opposed to specific code. ## Intro I'm currently working on a project which involves the daily extraction of data (pharmacy records) from a VisualFox Pro database, and uploading some of it to a WordPress site, where clients of the pharmacy can securely view it. I would like some advice in terms of the general methodology of my software - I am able to code it, but need to know if I'm going the right way about it. I'm writing both the PC software (in C#/.NET 4.5) and the PHP WordPress plugin. (It doesn't matter much that it's in WordPress, the actual code for this will pretty much run separately). ## Question 1: Encryption The current process for encrypting the data server-side I plan to use is based on this article. Summarised, it advocates encrypting each separate user's data asymmetrically with their own public key, stored on the server. The private key to decrypt this data is then itself encrypted symmetrically using the user's password, and stored. This way, even if the database is stolen, the user's password hash needs to be broken, and even then the process needs to be repeated for every user's data. The only weakness, pointed out by the author himself, and the main point of my question, is the fact that while the user is logged in, the decrypted key is stored in session storage. The way the article suggests to deal with it is to just limit the time the user is logged in. I thought a better solution would be to store that key in a short-lived secure cookie (of course the whole process is happening over HTTPS). That way, if the attacker has control of the user's computer and can read their cookies, they can probably just keylog their password and log in, no need to steal the database, while even if the attacker gains access to the server, they cannot decrypt the HTTPS traffic (or can they? I'm not sure.) **Should I use secure cookies or session storage to temporarily store the decrypted key?** ## Question 2: Storage The second thing I still want to work out is how to store the data - this is more of an efficiency problem. Since every user has their own key for encryption, it follows that records for every user must be stored separately. I don't know if I should store a "block" of data for every user, containing encrypted JSON with an array of objects representing records, or whether I should store records in a table with the actual data structure, and encrypt each data field separately with the key. I am leaning towards storing the data as one block - it seems to me to be more efficient to decrypt one big block of data at a time, than perhaps several thousands separate fields. Also, even if I stored the data in its proper structure, I still wouldn't be able to use MySQL's WHERE, ORDERBY etc, since the data would all be BLOBs. **Should I store the data as a big block per user, or separated into the different fields?** ## Question 3: Transfer I extract the data from the DBF file, and essentially make a "diff", whereby I compare the current extracted data from the last day's data, and only upload the blocks of the users that have changed (I can't only upload the records, as I probably will end up storing the users' data in blocks). I also include "delete" instructions for users which have been deleted. This is as there are hundreds of thousands records in the database, totalling over 200mb, and the size increases every day. My current plan is to write all this data to a JSON file, gzip it and upload it to the server. My question is, how do I do that while ensuring the security of the data? Naturally, the upload will happen over HTTPS, and I have an API password in place to only allow authorised uploads, but my main concern is how to protect the data if the server is compromised. I don't want the attacker to just grab the JSON file from the server while it's being processed. One idea I had was to get the server to send me a list of public keys for the users, and perform the encryption in my software, before the upload. It seems to me like that's the only way of protecting that data. I could encrypt the whole JSON file, perhaps with an API key or a special password, but that's moot if the attacker can just access the decrypted file as it's being processed on the server. Is that a good solution? **Should I encrypt the data individually client-side, or is there a way to securely transfer it to the server and encrypt it there?** Thanks in advance for any answers, I'd love to hear from someone who's dealt with problems like this before. Matt **EDIT: I'm pretty decided on 1 and 2 - thanks @Morons. I'll use secure cookies and store data in blocks. My main question is now question 3, would love to get some input on that.**


title: Rigorous Definition of Syntactic Sugar?

text: It seems like in language holy wars, people constantly denigrate any feature they don't find particularly useful as being "just syntactic sugar". The line between "real features" and "syntactic sugar" tends to get blurred in these debates. What do you believe is a reasonable and unambiguous definition of syntactic sugar that avoids it being defined as any feature the speaker/writer doesn't find useful?


title: How to operate a computer without an operating system?

text: How a computer can be used when there is no operating system? What tools or knowledge do I need to do it? Do I have to give all the commands in binary to use computer hardware resources like a monitor?


title: What aspects of a project should be covered when presenting it in an interview?

text: I am working as a .Net developer for a couple of years. I don't have experience in presenting projects but I have an interview and I will be expected to present the projects that I worked on in the past. How much/what kind of technical details should be covered? What other aspects of a project should be covered?


title: BASE_DIR/URL with or without trailing slash?

text: When you have basedir/url constants or variables, do you put a trailing slash? In theory I think ultimately one should, since /path/to/dir/ is a dir while with /path/to/dir if I'm not mistaken the server checks if there's a file called 'dir', and then adds a trailing slash for you. However, I think `$my_url = BASE_URL . '/my/dir/'` looks better than this: `$my_url = BASE_URL . 'my/dir/'` Better yet, this: `<img src="<?php echo BASE_URL; ?>/my/dir/">` looks a lot more readable to me than `<img src="<?php echo BASE_URL; ?>my/dir">`. Obviously this might be personal preference, and fine as long as one is consistent, but what is most common? What approach do you prefer? Any opinion appreciated.


title: Do companies actually send their developers to events abroad?

text: I was looking at the DevConnections conferences and lamenting the fact that the UK one was cancelled as there's absolutely no way I'll be going to any of the others, which got me thinking: **Do any companies actually send their developers to conferences abroad, or is that just a utopian ideal of which I'm irrationally envious?**


title: UML modelling semantics

text: In today's lecture about Modelling techniques with respect to MDD using UML the lecturer stated that it's absolutely necessary to give a (possibly) textual description about the semantics of each diagram you produce. In my opinion it's not necessary to describe semantics of diagram elements which are already standardized by UML. I can see that it's completely appropriate if you extend the standard UML by stereotypes/tagged values for any reason. In contrast, I think that standardization has in the ordinary case the intention to let people reason and talk about diagrams without the need to explain semantics every time. The only precondition is of course that they all rely on the same UML specification. Another point regarding MDD is that using different semantics from time to time for the same diagram kind makes code generation and automatic model transformation difficult in the end.   1. Am I right with this notion?   2. Are there some inherent interpretation ambiguities in UML to make it more general usable?


title: Preparing yourself for Code challenges

text: Just a few days ago I discovered Codility, and I tried their challenges. And I must say. I got my behind handed to me on a platter. I'm not sure what the problem was, but I'll lick my wounds and wait for the solution to come out and compare it with my own. In the meantime, I want to get ready for the next challenge so I'm reading their previous blog posts and seeing how to solve their previous problems. There are a lot of new things I haven't heard about like (Cartesian trees, various sort algorithms, etc.) So, how does one prepare for such challenges (especially the O(x) time and space complexity). What should I read to prepare for such a task?


title: How should modules access data outside their scope?

text: I run into this same problem quite often. First, I create a namespace and then add modules to this namespace. Then issue I always run into is how best to initialize the application? Naturally, each module has its own startup procedure so should this data(not code in some cases, just a list of items to run) stay with the module? Or should there be a startup procedure in the global namespace which has the startup data for ALL the modules. Which is the more robust way of organizing this situation? Should some things be made centralized or should there be strict adherence to modules encapsulating everything about themselves? Though this is a general architecture questions, Javascript centric answers would be really appreciated!


title: Implementation of communication between packages (Java)

text: I'm making a project with 5 packages. The packages can communicate with each other by sending Messages to a central MessageQueue in the Main package and that MessageQueue takes care of all the messages. (cfr.: http://en.wikipedia.org/wiki/Java_Message_Service) Provided this image: ![Diagram](http://i.stack.imgur.com/u26Bo.gif) the packages would be the clients (both publisher and subscriber) and the MessageQueue would be the topic. I'm now implementing the MessageQueue (a.k.a. the Topic in the image above) and packages can already subscribe to Messages and packages can also publish a Message.   Publishing a Message is just adding the Message to a queue 'inside' the MessageQueue. So at a given time during execution there can be 0, 1 or more messages in the MessageQueue and now i must make sure the MessageQueue processes all these messages correctly (and in order). A way of doing this could look like this:               public class MessageQueue {              public MessageQueue(){             //initialising etc.             processMessages();         }              private void processMessages(){             while(/*program is running*/){                 if(queue.isNotEmpty()){                     /*process first message in queue*/                 }             }        }      However, i believe this is not a great design and is sometimes referred to as _busy waiting_?   How could i approach this in a better way (without using any standard APIs ofcourse)? I would also like to apologise that the image isn't embedded, but i need 10 reputation before i can do that. If someone with more reputation could edit my post so that the image is embedded, i would greatly appreciate that.


title: Using WPF rather than WinRT for Windows 8 Pro tablet app: good or bad idea?

text: Our business is considering writing a line of business application for tablets to enable road warriors and executives access our data. This will be primarily used for dashboards, reports and some form filling input: quite typical scenario. Our other apps being built in .Net (WinForms) with lots of related class libraries DLLs (for data access layer, business logic, etc), it seems natural to want to use Windows 8 for this. I am a rather put off by Windows RT as it doesn't implement the whole .Net Framework and seems quite limitating, so we are rather considering the Windows 8 Pro tablets than WinRT ones. However, we want a smooth and pleasant tablet experience and I don't think WinForms would be great for this as not built for touch support. My question is would WPF be good for this? I see there are UI vendors selling touch controls kits but I wonder whether the "touch" experience in WPF is equivalent to the one found WinRT/Metro apps? Probably this could be answered by playing around with the tablet but I unfortunately do not have one at the moment and can't get the budget to buy one until I have settled this.


title: How to use a 3rd party web API

text: I am trying to understand the concept of using 3rd party web API. From what I understand so far, web API look like regular URLs with some parameters etc. Will the client program need to download and install any package/bundle etc from the website/server etc providing APIs and include it with their product or no bundle is needed to download from service provider. the client program just uses the web API URLs (like how we do it in browser) What are the variants in common use? Does it boil down to how much we want to do on client side and how much we want to do on server side? like not downloading anything from web API service provider means everything happens on web API provider side..


title: What is considered a suitable notice period for a software developer?

text: I'm being asked by the company I work for to extend my notice period. I'm not outright against it (in fact it's somewhat flattering in a way) but it has made me wonder what a typical notice period might be for a C# software developer?


title: How to use Git with ASP MVC Code-First Entity Framework

text: **TLDR:** What is an effective way to use Git to handle ASP MVC code-first EF? Which files need to be included for NuGet? Which files should be left out? We have an **ASP MVC code-first Entity Framework** project that we are building as a school project. For our versioning, we are using **Git to Bit Bucket**. The basic workflow to add a feature or revamp code is to create a branch off of a _Dev_ branch, commit to the new branch until finished and intial testing is done, then merge/pull request back into the _Dev_ branch. We have run into issues with the project setup breaking when a user tries to merge changes to the their branch before merging back into _Dev_. Some questions are:   **For the NuGet Packages, what should be included in the Git repo?** There are some files that seem to update every time, forcing Git to go through all of them during a commit. **Should the Entity Framework be included in the repo?** We have the migrations, but they seem to break any time anyone pulls changes onto their machine. **Is there a good way for Git to handle Visual Studio Project (.csproj) Files?** We had a merge nightmare involving project files when one developer pulled changes from the _Dev_ before trying to push back. For our .gitIgnore, we used an ASP and added a few of our own. A copy of it is at Pastebin.com. Also, as for the horrific mangling of project files, we have looked on StackOverflow and saw this: .NET + Git: how I deal with Visual Studio files?. Is this something that would resolve the Visual Studio project files issue?


title: Patterns for undo in multi-user applications on relational data

text: I want to build a web application that will allow multiple users to collaboratively populate the contents of a fairly conventional relational database. (The database will have a fixed schema, which is known in advance). I can see how to define the schema for the necessary object types, relations, and foreign key constraints (items, items as members of categories, links between items, and so on). Basic CRUD operations to instantiate and modify objects are no problem. But for resilience against vandalism and mistakes, I can foresee that it will be necessary to have undo/rollback functionality, so that moderator-level users can undo changes made by other users. I'm having trouble figuring out a suitable approach to take for two key functional pre-requisites:   1. Capturing all the database changes that result from an initial user request. For example, there's a many-to-many relationship between items and categories. Therefore, if a category is deleted (triggered by a user submitting an HTML form), all the category-item relation records corresponding to that category will get deleted due to referential integrity constraints on the many-to-many relation. How can I record all the cascading consequences of an initial operation, so that's it's possible to completely undo it later?   2. How can I isolate undo operations so that a bad action by one user can be undone without also needing to roll back all the beneficial changes which have been made by other users, in between the bad action and the moderator's review? The Undo patterns I've seen described (e.g. "Command" pattern) all assume that there is a stack of commands and undo operations are always applied in strict reverse order of initial application (no support for out-of-order undos). Are there any standard patterns for handling undo capability in relational databases which would help meet these two goals? At the moment, I'm looking for generic algorithms and patterns which help solve the problems listed above, rather than platform-specific details.


title: What is the difference between self-types and trait inheritance in Scala?

text: When Googled, many responses for this topic come up. However, I don't feel like any of them do a good job of illustrating the difference between these two features. So I'd like to try one more time, specifically... **What is something that can be done with self-types and not with inheritance, and vice-versa?** To me, there should be some quantifiable, physical difference between the two, otherwise they are just nominally different. If Trait A extends B or self-types B, don't they both illustrate that being of B is a requirement? Where is the difference?


title: How do you track bugs in your personal projects?

text: I'm trying to decide if I need to reassess my defect-tracking process for my home-grown projects. For the last several years, I really just track defects using `TODO` tags in the code, and keeping track of them in a specific view (I use Eclipse, which has a decent tagging system). Unfortunately, I'm starting to wonder if this system is unsustainable. The defects I find are typically associated with a snippet of code I'm working on; bugs which are not immediately understood tend to be forgotten, or ignored. I wrote an application for my wife which has had a severe defect for almost 9 months, and I keep forgetting to fix it. What mechanism do you use to track defects in your personal projects? Do you have a specific system, or a process for prioritizing and managing them?


title: Why are statements in many programming languages terminated by semicolons?

text: Is there a reason that a semi-colon was chosen as a line terminator instead of a different symbol? I want to know the history behind this decision, and hope the answers will lead to insights that may influence future decisions.


title: Optimal way to implement this specific lookup table in C#?

text: I want to create a lookup table for this data: The "input variables" (what is used to "lookup") are 4 different doubles that can each take on 1 of 200 numbers (the numbers range from 1-1000 but there are only 200 possible numbers that each can be (these 200 possible numbers that each of them can be are known to me)) the doubles are all 2 decimal places. If any one of the four were changed it would slightly change the output variables. There is also 1 integer (enum really) that can take on a value from 1-5. There is a condition on 3 of the input variables that (1/x + 1/y + 1/z must be less than 1.02). Could this be used in a hashing algorithm? The "output variables" (what is returned) are ~30 doubles (mostly 2 decimal places but one has 10 decimal places). (will be packaged in an object) ranging from 1 to 1000 (2 decimal places). I expect there to be ~150 million records. Should I use a big dictionary and load it into memory then I start the program? Would a Database and LINQ be best? Can I use Trees or Hashing in some way to speed it up? I've never had to make a LUT this big before, where speed is a major factor. **Clarification:** Because of the condition that (1/x + 1/y + 1/z must be less than 1.02, see above) there is only ~150 million combinations of input variables. Not ~(200)^4. **Update:** I have looked at some stats (min and max observed values and discovered some relationships) for my input variables and have found that if we call the 4 input doubles A, B, C, D: `A and B have ~200 possible values each,   C has ~50 possible values, and   D has ~120 possible values` Of these, there are several relationships that mean that there are only ~27 million combinations of these rather than the ~150 million I originally thought. So there will be ~27 million records in the LUT. There is also definitely a relationship that I haven't been able to figure out between (A, B, C) and D which will also bring down the number of combinations. Would it be optimal to run the LUT from RAM now that I have reduced the entries from 150 to 27 million (and probably lower)? Now that it's down to 27 million would storing them as ints by multiplying them by 100 (2 decimal places) still be optimal? As DocBrown suggested, I should store the doubles as ints (multiply by 100 because they have 2 decimal places) and then combine the 5 different ints (4 doubles (see above) and 1 enum (value:1-5)) into a key for the LUT. How to do this such that I will have a unique value for each combination of my 5 input variables (the 5 ints) AND this method is open to expansion of each of the input variables, i.e. should I need to expand the double C's combinations to 70 instead of 50 I will need unique key values for the new entries that are result of the expanded number of total combinations of the input variables.


title: What is the best way to INSERT a large dataset into a MySQL database (or any database in general)

text: As part of a PHP project, I have to insert a row into a MySQL database. I'm obviously used to doing this, but this required inserting into 90 columns in one query. The resulting query looks horrible and monolithic (especially inserting my PHP variables as the values):               INSERT INTO mytable (column1, colum2, ..., column90)      VALUES     ('value1', 'value2', ..., 'value90')      and I'm concerned that I'm not going about this in the right way. It also took me a long (boring) time just to type everything in and testing writing the test code will be equally tedious I fear. How do professionals go about quickly writing and testing these queries? Is there a way I can speed up the process?


title: Dependency analysis for tests

text: Google built a testing system that can infer which tests need to be run after a change. In their own words: > ... we built a continuous integration system that uses dependency analysis > to determine all the tests a change transitively affects and then runs only > those tests for every change. > > ... > > ![enter image description here](http://i.stack.imgur.com/wVwpL.png) Inspired by that, I have created a tool for Python that also uses dependency analysis to detect which tests need to be run. The difference is that it is not tied to a CI system. It is meant to be run locally and looks for file changes since the last time the tests passed, instead of looking at commits on the version control system. Visual Studio 2010 has a featured called "Test impact analysis" that "inform the developer of what tests they should run to verify the code changes they are making". My question is: Is there a name for this approach? I believe I read somewhere that this is called "Incremental Testing", but I cannot find the reference anymore.


title: Masters vs. PhD - long

text: I'm 21 years old and a first year master's computer science student. Whether or not to continue with my PhD has been plaguing me for the past few months. I can't stop thinking about it and am extremely torn on the issue. I have read http://www.cs.unc.edu/~azuma/hitch4.html and many, many other masters vs phd articles on the web. Unfortunately, I have not yet come to a conclusion. I was hoping that I could post my ideas about the issue on here in hopes to 1) get some extra insight on the issue and 2) make sure that I am correct in my assumptions. Hopefully people who have experience in the respective fields can tell me if I am wrong so I don't make my decision based on false ideas. Okay, to get this topic out of the way - money. Money isn't the _most_ important thing to me, but it is still important. It's always been a goal of mine to make 6 figures, but I realize that will probably take me a long time with either path. According to most online salary calculating sites, the average starting salary for a software engineer is ~60-70k. The PhD program here is 5 years, so that's about 300k I am missing out on by not going into the workforce with a masters. I have only ever had ~1k at one time in my life so 300k is something I don't think I can accurately imagine. I know that I wouldn't have all of that at once obviously, but knowing I would be earning that is kinda crazy to me. I feel like I would be living quite comfortably by the time I'm 30 years old (but risk being too content too soon). I would definitely love to have at least a few years of my 20s to spend with that kind of money before I have a family to spend it all on. I haven't grown up very financially stable so it would be so nice to just spend some money…get a nice car, buy a new guitar or two, eat some good food, and just be financially comfortable. I have always felt like I deserved to make good money in my life, even as a kid growing up, and I just want to have it be a reality. I know that either path I take will make good money by the time I'm ~40-45 years old, but I guess I'm just sick of not making money and am getting impatient about it. However, a big idea pushing me towards a PhD is that I feel the masters path would give me a feeling of selling out if I have the capability to solve real questions in the computer science world. (pretty straight-forward - not much to elaborate on, but this is a big deal) Now onto other aspects of the decision. I originally got into computer science because of programming. I started in high school and knew very soon that it was what I wanted to do for a career. I feel like getting a masters and being a software engineer in the industry gives me much more time to program in my career. In research, I feel like I would spend more time reading, writing, trying to get grant money, etc than I would coding. A guy I work with in the lab just recently published a paper. He showed it to me and I was shocked by it. The first two pages was littered with equations and formulas. Then the next page or so was followed by more equations and formulas that he derived from the previous ones. That was his work - breaking down and creating all of these formulas for robotic arm movement. And whenever I read computer science papers, they all seem to follow this pattern. I always pictured myself coding all day long…not proving equations and things of that nature. I know that's only one part of computer science research, but that part bores me. A couple cons on each side - Phd - I don't really enjoy writing or feel like I'm that great at technical writing. Whenever I'm in groups to make something, I'm always the one who does the large majority of the work and then give it to my team members to write up a report. Presenting is different though - I don't mind presenting at all as long as I have a good grasp on what I am presenting. But writing papers seems like such a chore to me. And because of this, the "publish or perish" phrase really turns me off from research. Another bad thing - I feel like if I am doing research, most of it would be done alone. I work best in small groups. I like to have at least one person to bounce ideas off of when I am brainstorming. The idea of being a part of some small elite group to build things sounds ideal to me. So being able to work in small groups for the majority of my career is a definite plus. I don't feel like I can get this doing research. Masters - I read a lot online that most people come in as engineers and eventually move into management positions. As of now, I don't see myself wanting to be a part of management. Lets say my company wanted to make some new product or system - I would get much more pride, enjoyment, and overall satisfaction to say "I made this" rather than "I managed a group of people that made this." I want to be a big part of the development process. I want to make things. I think it would be great to be more specialized than other people. I would rather know everything about something than something about everything. I always have been that way - was a great pitcher during my baseball years, but not so good at everything else, great at certain classes in school, but not so good at others, etc. To think that my career would be the same way sounds okay to me. Getting a PhD would point me in this direction. It would be great to be some guy who is someone that people look towards and come to ask for help because of being such an important contributor to a very specific field, such as artificial neural networks or robotic haptic perception. From what I gather about the software industry, being specialized can be a very bad thing because of the speed of the new technology. When it comes to being employed, I have pretty conservative views. I don't want to change companies every 5 years. Maybe this is something everyone wishes, but I would love to just be an important person in one company for 10+ (maybe 20-25+ if I'm lucky!) years if the working conditions were acceptable. I feel like that is more possible as a PhD though, being a professor or researcher. The more I read about people in the software industry, the more it seems like most software engineers bounce from company to company at rapid paces. Some even work like a hired gun from project to project which is NOT what I want AT ALL. But finding a place to make great and important software would be great if that actually happens in the real world. I'm a very competitive person. I thrive on competition. I don't really know why, but I have always been that way even as a kid growing up. Competition always gave me a reason to practice that little extra every night, always push my limits, etc. It seems to me like there is no competition in the research world. It seems like everyone is very relaxed as long as research is being conducted. The only competition is if someone is researching the same thing as you and its whoever can finish and publish first (but everyone seems to careful to check that circumstance). The only noticeable competition to me is just with yourself and your own discipline. I like the idea that in the industry, there is real competition between companies to put out the best product or be put out of business. I feel like this would constantly be pushing me to be better at what I do. One thing that is really pushing me towards a PhD is the lifetime of the things you make. I feel like if you make something truly innovative in the industry…just some really great new application or system…there is a shelf- life of about 5-10 years before someone just does it faster and more efficiently. But with research work, you could create an idea or algorithm that last decades. For instance, the A* search algorithm was described in 1968 and is still widely used today. That is amazing to me. In the words of Palahniuk, "The goal isn't to live forever, its to create something that will." Over anything, I just want to do something that matters. I want my work to help and progress society. Seriously, if I'm stuck programming GUIs for the next 40 years…I might shoot myself in the face. But then again, I hate the idea that less than 1% of the population will come into contact with my work and even less understand its importance. So if anything I have said is false then please inform me. If you think I come off as a masters or PhD, inform me. If you want to give me some extra insight or add on to any point I made, please do. Thank you so much to anyone for any help.


title: Checklist for starting an open-source project

text: To start an open-source project is not just to throw up the source code on some public repository and then being happy with that. You should have technical (besides user) documentation, information on how to contribute etc. If creating a checklist over important things to do, what would you include on it?


title: Data Mining Books

text: I'm passionate about _data mining_ , I have read some books like _Programming Collective Intelligence_ , and I would like to know more good **books** , specially practical ones, **about _data mining_** in conjunction with _AI_. Any tips will be appreciated as well. Thanks.


How can NSObject contain an NSString if NSString is an NSObject               /* NSObject.h     Copyright (c) 1994-2012, Apple Inc. All rights reserved.     */          (NSString *)description;      NSObject has a property named 'description' that is an NSString but isn't NSString an NSObject? How is it that this works?


title: How to use specific Request Header

text: I am learning how to work with XMLHttpRequests. I know that request.setRequestHeader() is an important factor. I just don't understand why. It took me a while but I have at least found a list of Headers here and here, but I still don't understand what each one of them does, and what value goes with each. Is there a resource that gives an example and explains what they are for?


title: Iteratively improve software architecture & quality in an agile process?

text: Or to put it another way how to ensure that architecture or quality doesn't suffer, doing agile. Some of the understandings in handling architecture in agile are below(generally applies to testing as well) *** Do architecture until risks fall off your radar * minimal design up front, so that you will not pay a horrible price for reasonable change requests. * "just enough" architecture/infrastructure per each feature/requirement** (The above were found in searching other related StackOverflow questions) * * * A **hypothetical example/scenario** is that there is a requirement to develop a order processing module in the existing system. The below guidelines are negotiated and agreed upon.   1. The architecture for module should be able to handle processing of 10 orders in the span of a minute.   2. Time to market is 4 weeks, planning is done to handle 2 sprints of 2 weeks.   3. The Business is satisfied with average performance expectations. Once the module is delivered, lets say the following improvements/changes are requested.   * Improve the processing to 15 orders per minute.   * Improve performance by 25%.   * Time to market is 2 weeks. So assuming the further requirements from the customer/business come and which are welcome, but in future as the iterations go on, the architecture needs to be overhauled, and testing the quality of the module also becomes more time consuming. * * * _And the above is not a happy result, as estimations increase, and there is an understandable inability to meet further expectations or requirements quickly. Even if it can be done in the given timeframe with sufficient quality, just wish that we could have done something about it well before and not face this situation at this point of time._ _In hindsight, architecting to scale in the first iteration would be ideal, but that was not the goal and focus. The focus is always on Time to market, and on acheiving on meeting the business/customers expectations in a given timeframe. Unfortunately, in the long run it does take a toll on development._ **What can be done to avoid the mentioned pitfall in the example, in improving the architecture or testing process iteratively?**


title: Comparison with an outsourced dev center

text: We are part of a software company which was just acquired by a larger one. This company has a large development center in India; we are based in Europe. We don't yet know what will happen with our projects, maybe they will be outsourced, maybe not but I want to know if we can rival an indian programmer as what salary is concerned. I know there are a lot of factors involved here, not just the salary issue, but I just want to get an ideea of the difference. Can someone mention salaries (in euros or dollars) and associated years of experience. I found some info on the web but it is not that recent. Thanks in advance!


title: Should developers "own" the build server(s)?

text: The build server at our company sucks. The build agents (there are a dozen of them, each is a separate VM, and apparently they are all living on their own ESX server) are SLOW. The web interface is SLOW and is running on a Windows VM, also on ESX. Everything is SLOW, SLOW, SLOW. Artifact upload sometimes fails for unknown reasons. Sometimes the web interface reports in the UI that it has run out of memory and it seizes up then crashes. It seems like IT is rebooting it at least once every day. Today they are rolling back a minor update because it has caused problems. Currently IT owns the hardware that the build servers run on and we have zero visibility into that. We do have admin control over the software. We (the developers) are constantly complaining about it but nothing seems to really improve. Does it make sense for developers to own the build server(s)? IT doesn't really have as much incentive to make them reliable and fast as developers do. In order to get IT to fix the problems we have to complain to our managers and then they have to talk to their managers who then tell IT to fix it. We can report problems to IT directly but that just doesn't seem to work to get things fixed because IT has lots of other things they need to deal with. Also, the developers are the ones who are actually using the build system and are probably a lot more familiar with it than IT. How does it work at other companies? We are about a 150 person company. So probably half of that is engineering, but a third of that is probably hardware, so we have maybe 40 or so devs.


title: Correct way to undo the past few git commits including a merge?

text: My team is working with git for the first time and has really messed up our git remote due to our inexperience. I'm trying to help educate them on git to solve the problem in the long term, but in the meantime, the commits that have been made are totally wrong. We haven't made very much progress at all, and I don't see the value in retaining these commits when they could cause confusion/additional problems down the line. The most recent commit was a merge between the master branch and a second branch that one of the team members unintentionally created. If I try to revert, git states that I must be using the -m flag, but I'm not sure whether I should be reverting or trying to rebase in this case, or how I would do it given the structure of the past couple of commits. What is the best way to resolve this issue and how should I go about doing it?


title: Project size vs. Team size

text: I'm a freelance solo web developer/designer/iPhone app maker by night (IT technician by day) and i'm interested in developing a social network site to go public (like Facebook, fingers crossed for half a billion users). But i'm concerned that i'm not going to manage this on my own, being only able to dedicate weekends/evenings to it. I would class my self as an intermediate web dev but by no means have i written something as large scale as an online community. When does a project become too big for one person and when do you bite the bullet and hire someone/team up with another web dev?


title: Is this a good task for machine learning - grouping pieces of DNA based on sequence?

text: Say I have a list of 50 DNA sequences all of the same length (6, 8 or 16 bps/ chars). I want to group these to sets of say 5 or 6 sequences per set. I have some criteria that need to be met based on the sequence: 1) There has to be at least three mismatches (different characters),               ACGTAC     ACTTAT       has 2 mismatches - positions 3, and 6 , so would not meet the criteria 2) if we say A and C are red C and T are green (the laser colours on the sequencing machines), then we must have a green and red laser in each position.               ACACTG     AATGAC     CCATGC      is equivalent to (r is RED, g is green)               RRRRGG     RRGGRR     RRRGGG          So the last four positions match the criteria (we have a red and a green in each position), but the first two positions are all red, so this set would not meet the criteria. I have tried brute forcing this, and it works, but after the set size gets big enough, the number of combinations needed to check gets huge. So would this be a suitable task for some "machine learning" algorithms. Is there a type of algorithm / process that I should be looking at in particular? (I just started a Coursera course, but the problems being discussed just now are linear regression, which seems to be a different class of problem).


title: Spring JDBC Template without DAO?

text: I am rather new to writing applications that interact with databases, and I'm curious about a project I'm working on. I have to write a very simple web app which is going to be displaying metric data based off a handful of various queries (probably not over 15) to various database tables. Based on my own research, Spring JDBC Template seemed like a good technology to go with based on the rather simplistic nature of my project. Every example I see for using it though seems to involve the use of the DAO pattern. I was under the assumption that usage of the DAO pattern wouldn't be necessary for what I'm doing, but it seems extremely pervasive in the examples, so perhaps I'm mistaken. What criteria would be used to evaluate whether I should be implementing a DAO pattern with Spring JDBC Template for my project?


title: Going from webforms, VS 2008, 3.5 framework to the "next level" based on my goals

text: I've got a few choices to make as I develop some business websites that will run for the next two to three years. Currently I run ASP.NET 3.5 with Visual Studio 2008. I do my development rather crudely in WebForms because that's what I learned and am most productive with. I don't use Membership or any other frameworks in my projects. I use a simple class that maintains a few session keys for each user based on basic database tables for users and roles. (I have about 3,000 users). So far I've kept the data simple, using ADO.NET against SQL Server and a data access class (Circa 2000, I know) to build my sites. My questions are as follows:   1. Under what conditions would I be better off moving to MVC?   2. Under what conditions would I find LINQ and ORM a better way to go than standard ADO.NET?   3. Would I benefit, in my current state of development, from going from Studio 2008 to Studio 2010?


title: Floyd's algorithm

text: Is it possible(expected) for an individual to figure out(having never seen it before) the algorithm if asked at an interview? What other problems have equally interesting solutions? Edit: Due to the confusion of the actual algorithm I am referring to, it is the Floyd's cycle-finding algorithm, aka, tortoise and hare algorithm.


title: How to experience gradual improvement of knowledge while a newbie does .NET maintenance programming?

text: I started my career as a software developer about 6 months ago. This is my first job, and I am the only developer in this company. I gained .NET knowledge by self study and also by doing some university projects. Our systems have old foundations based on an earlier version of .NET, and I'm starting to feel that I am not improving since I am a maintenance programmer here. Everything is old and my manager is not really taking any chances on gradually improving the software. What is your opinion? What should I do? I am newbie and also work hard to find my way through. There is no other developer, not even a senior one to help me here. I need your advice on my situation. And one last thing, can I get a new job with doing maintenance programming? I mean don't managers say that you do not have the experience of developing a new software from scratch? I feel redundant, what do I do?


title: Is there certain payoffs between working for a company in the IT industry, and working for the IT department of a company in some other industry?

text: I am a software engineering student and am in the process of making some career choices. I need to understand what the major differences are in the above two scenario. Anyone with experience of both, insight from you would be really helpful. Thanks in advance.


title: Choosing a rate to charge a client for training their programmer

text: We've been put in a bit of a difficult situation and I'm trying to figure out the best way to deal with it and how to charge for it. We've built a custom web app for a customer and I've been maintaining it for the last 1.5 years. They sent email an email a couple weeks ago saying they've hired a developer and would like to take the project in house. (Nothing had been mentioned regarding taking it in house before.) I was of course surprised as I had expected to be working on the project for another year or more. I met with the developer a week ago and went over the basics of the site. After my offer (including suggestion of a different rate) and follow-up email, they asked me if I'd be willing to do some training on how to continue development of the app using the libraries/techniques currently used. (The developer is experienced with the language, but not with the libraries.) I'm wondering how much I should charge for 1-on-1 training tailored specifically for the site and the libraries (libraries which are reusable)? I'm thinking the training would between 3 and 6 hours, depending on how much the developer's skill level. Here are my difficulties in coming up with the rate:   * We're going to be loosing 10s of thousands of dollars by not having the client and project any more (not to mention future opportunities). So in part, I'd like to replace some of this income through training.   * I'm essentially training someone to do what we do and giving them the opportunity to compete against us. They are a reasonably large company that has the possibility of competing against our company directly, although it's not likely our 2 companies will be direct competition.   * We've spent years learning the libraries (50% external and 50% ours) and the technology behind them (which we haven't been paid for directly).   * I'm not sure what the going rate for training is the area, specifically for 1-on-1 training.   * I want to do the right thing because there is a slight possibility of affecting other business relationships. My first thought was to to charge something around 5 times the rate we're charging them currently, but I have a feeling they'll think this is high. (We're not terribly concerned with getting the contract to do the training, but it would be a unique opportunity where we could learn as well.) Thanks for your suggestions and ideas. I know this is a bit of a subjective question, but I'm just looking for suggestions or something I'm not thinking of.


title: Is it wrong not to create Javadoc for my code?

text: I do a lot of Java programming at my work (I'm an intern) and I was wondering if it is generally a rule to create javadoc to accompany my code. I usually document every method and class anyways, but I find it hard to adhere to Javadoc's syntax (writing down the variables and the output so that the parser can generate html). I've looked at a lot of C programming and even C++ and I like the way they are commented. Is it wrong not to supply javadoc with my code?


title: Why hasn't Caja been popular?

text: Google released Caja around 2008(Capability JavaScript). It is still mainly a laboratory language. But XSS and other attacks would be prevented if there was widespread integration of Caja.


title: How and when to use UNIT testing properly

text: I am an iOS developer. I have read about unit testing and how it is used to test specific pieces of your code. A very quick example has to do with processing JSON data onto a database. The unit test reads a file from the project bundle and executes the method that is in charge of processing JSON data. But I dont get how this is different from actually running the app and testing with the server. So my question might be a bit general, but I honestly dont understand the proper use of unit testing, or even how it is useful; I hope the experienced programmers that surf around StackOverflow can help me. Any help is very much appreciated!


title: How many user stories per person should be completed per sprint?

text: Just ran across this figure, and wondering if there's another well know source than would help confirm these numbers: > Based on data I analyzed on successfully finished sprints, I determined that > a team should average around 1 to 1-1/2 user stories (product backlog items > of any sort, really) per person per sprint. SOURCE: Mike Cohn's Blog on "Should the Daily Standup Be Person-by-Person or Story-by-Story?"


title: Responsive Design vs. Separate applications/views

text: I'm involved in a project for a redesign of an existing site. The Designer Team delivered us -the Engineering Team- four separate HTML/CSS prototypes of how the site should look:   * On a Desktop Browser.   * On a Table Device, a similar but simplified design of the Desktop View   * A High-Tech Smartphone, the design is mobile-app like and very different from the Desktop and Tablet designs. Also, less content is shown there.   * A Low-End Smartphone, a simplified version of the precedent design but still very similar. My first impulse was build one HTML/CSS prototype using Responsive Web Design, and merge the prototypes made by the Design Team, but now i'm having some concerns:   * Merging disparate prototypes might produce low-quality code.   * We might be sending code/files to some mobile devices that they don't need.   * We need to handle the situation where -for example- some option must be present in Tablets but must be hidden in Smartphone. Using CSS to hide can be bandwidth waste, so maybe there's a need of some server side code. Because of that, the idea of building two different Web Applications -or even better, handle two Views in a same web application using some server side Framework like Spring Mobile\- was being considered. I am not an expert on Responsive Design, so I wan't to know what's the best approach is this situation or the standard way to tackle this problem. **PS:** If it's worth saying, I'm building a Portal using WebSphere Portal as Portlet Container and building the Portlets using Spring Portlet MVC.


title: Create an automated program to check a site every day

text: Is it possible to create an automated program that will visit a web page every day? I'd like to make it run in the background (preferably non-visibly) when my computer loads and I have internet connection and navigate to a specific web page. I would think it would be pretty simple, but I'm not sure what language I'd use or what means to do it. Is it possible and by what means could I do it? **Edit based off of comments below** The only functionality the program would need to have is to 1. check to see if it's logged in and 2. log in if it's not. I'd only be using Windows. I'm interested in using existing programs or creating a program myself (for the experience). I'm a noob when it comes to using OSes and machine-based programming (I'm a web guy). Essentially I just thought it'd be a cool thing to create and good practice to learn more OS/offline programming Added thought: I'd also like to make sure it runs once per day, when it turns on (if it was off) or at a specific time if it's been on, but somehow check to see if it's been ran earlier in the day sometime


title: Is a Factory class still a Factory class if the objects it returns already exist?

text: I can't decide what to name my class. So far I've labelled it up as a Factory, but I am not sure. Here is the class. As you can see, it exists to return a concrete type of an Interface (`ResolveRegistrationIssue`) based on the argument supplied to the getter method (`ResolutionFamilyEnum`):               @SuppressWarnings("serial")     @ManagedBean(name = "resolveIssuesFactory")     @ViewScoped     public class ResolveIssuesFactory implements Serializable {              @ManagedProperty(value = "#{resolvePrimaryIssuesFactory}")         private ResolvePrimaryIssuesBean resolvePrimaryIssuesBean;              @ManagedProperty(value = "#{resolveSecondaryIssuesBean }")         private ResolveSecondaryIssuesBean resolveSecondaryIssuesBean ;              @ManagedProperty(value = "#{resolveTertaryIssuesBean }")         private ResolveTertaryIssuesBean resolveTertaryIssuesBean ;              public ResolveRegistrationIssue getResolutionBean(                 ResolutionFamilyEnum familyEnum) {                  //null safety             if(null ==familyEnum) {                 throw new IllegalArgumentException("The family which determines the Resolution Bean to be used may not be null.");             }                  if (familyEnum.equals(ResolutionFamilyEnum .PRIMARY)) {                 return resolvePrimaryIssuesBean;             } else if (familyEnum.equals(ResolutionFamilyEnum .SECONDARY)) {                 return resolveSecondaryIssuesBean;             } else if (familyEnum.equals(ResolutionFamilyEnum .TERTERY)) {                 return resolveTertaryIssuesBean;                         } else {                 throw new IllegalArgumentException("Could not determine the correct Resolution Issue bean for the provided family.");             }         }      Now, I understand that a Factory class accepts arguments which define the entity to be **developed** and then **delivered** (returned). However in my case, my entities are already developed, as they are EJB references. Thus this method only delivers them. So is this still a Factory?


title: How can I "inspect" C++ code?

text: For reference, I am a JavaScript developer learning C++. The browser is a pretty powerful debugger, and I can easily place a breakpoint in my code, hover over a variable or expression and get the value of that expression. Is this even possible in C++ or am I in a different world entirely? I'm starting to write a bit of C++ code for an online course, and debugging with Code::Blocks gives me very opaque information. For example, I see stuff like this: `0x8049bc3 push ebp` in the 'watches' window. Even if I write something like `int foo = 3;`, I have found no way of telling that `foo` is 3 while I'm stepping through my code. Am I missing something?


title: License issue of Spring Data Neo4j?

text: If I use Spring Data Neo4j to develop a software, and I want to publish it for commercial use with charging, does there exist any license issue? I survey many posts about the license issue of Neo4j and Spring Data Neo4j. It seems Neo4j has two versions, community and enterprise, respectively. The Community version is GPL-3.0, and the enterprise version is AGPL-3.0. Spring Data Neo4j is Apache License-2.0. The role of spring data neo4j in my software: 1.It is only part of my software to deal with storing relationship and searching data. 2.I will combine it with MongoDB or DB2.


title: C++ Web Development for REST API

text: I've been a C# developer for long time, focused on ASP MVC the most. Two years ago, basiclly due to the lower costs and ease of deployment/management I began to migrate my projects to linux using Node.js for serving HTML and Mono for all the backend operations. They talk to each other using HTTP REST API. As my skills in Linux have improved more and more I find this Node.js/Mono combination kind of weird. Mono is a great thing but there are issues now and then, more related to the implementation itself than the language. Now I have like three weeks available in between projects and I would like to dive into C++ as my backend. I have tried some Python and I really liked it, but I require fastest responses, that's why C++ came to me. Java is not an option, because although the language itself is pretty close to C#, it has a bunch of stuff I really wouldn't like to bother with (Maven to name one) and at the end of the day, that would decrease my productivity, at least while I become more proefficient on Java (just configuring Eclipse for a Jersey tutorial took me like 2 hours!). I really don't need anything fancy, since all that node.js does for me is serving html/css/javascript, some real time notifications (socket.io) and that's it. My backends are more reading from tables, complex SQL transformation and validation of the data the client sends. The template engine I use is Jade which is cool since I type less, but I wouldn't mind to switch to plain HTML. 99% of the job in my projects is done using Angular.js via JSON calls. Most of them are single page applications with lots of logic on the client and consuming REST API's. I really would like to cut all Mono/.NET dependencies and develop on something more native to Linux. At the same time I would like to say goodbye to Node.js as well in trade for one backend to serve my API and static HTML pages. If you have been here before, please let me know what are the current choices and anything that would help me on this experiment. Thanks a lot in advance for taking the time to read my concerns. EDIT: I forgot to mention I read about Casablanca project. It looks promising but again, it belongs to Microsoft under the covers of the white open source, just what I have been avoiding lately.


title: Is there any particular reason for the use of lists over queues in functional programming languages?

text: Most functional programming languages such as Scheme and Haskell use lists as their main data structure. Queues are identical to lists, except for the fact appending to the end - not to the begin - has constant time. Every algorithm that is written elegantly using lists with `head` and `tail` can be written elegantly using queues with `init` and `last`. Considering appending to the end is more common than the opposite, I'd guess queues are more natural than lists. Is there any reason lists have always been preferred?


title: Use of a profiler tool to aid in the analysis of a brute force algorithm in Java

text: I was asked to profile (using some tool, such as YourKit or JVisualVM) a couple of implementations of the Traveling Salesman Problem (find the minimum path that visits all the given set of cities), in the context of a Algorithms Analysis and Design graduate course. Taking in consideration the brute force approach of the algorithm, I'm wondering, though, how to best use the tools (for instance, JVisualVM) to analyze the spatial and temporal complexities of the algorithm. If I'm not in error the algorithm has spatial complexity of O(n), as it basically grows linearly with the number of cities, while it is O(n!) in temporal complexity. The math isn't the issue here. After playing for a bit with both the referred tools, I'm having some hard time understanding how can they be of any use to my problem. Sure I can see which methods are being used the most and which % of the time is being used in each one of them, and what is the actual memory footprint, so that can be all be regarded as hints where to optimize. But other than that, and other than seeing the % of the CPU which is actually being used (or IO accesses, which never occur in this program), I can't see how can I actually learn something about the algorithm with these tools than the math before referred didn't. What should be my main concerns when using profilers to the analysis of algorithms? Also, I've put basic time recording capabilities embedded in my program. Maybe I could use the profiling tools to better do that job? Thanks


title: Is there a resource for beginning programming student misconceptions?

text: Many programmers tasked to teach a beginning programming class have forgotten a lot of the things that they didn't know or wouldn't know back before they learned how to program themselves. And there are lots of ways to not understand a topic. But some seem to pop up very often among students, no matter what common beginning programming language or textbook is used. An answer to this question lists several misconceptions or lack of conceptions that seem to occur more when teaching programming to people who have zero programming background: What is the best way to teach beginners? (such as confusion about the difference between the environment when a program is written and when it is run, that (basic block) program code executes sequentially, the difference between a variable and its contents, etc.) Another example are the questions from new programmers who simply assume that ordinary variables (in C, Python, etc.) can exactly represent common fractions (1/100ths). Is there an online list or book that covers these concepts, that have to be taught above and beyond the syntax and semantics of the chosen programming language and IDE?


title: Designing storage service data structure for decoupled models sharing same data

text: Surely most of you remember the Norton Commander application where similar (sometimes the same) data is displayed in separate decoupled views. I'm building a web application that follows the same principle. The amount of data is too big to be fetched/displayed entirely on the page, and potentially overlapping subsets of data need to be displayed in separate views. My architecture looks like this: > >                                ┌──────── EventBus ────────┐ >                                │             │            │ >                                │      StorageService      │ >                                │       ╱          ╲       │ >                          PresenterLeft┤            ├PresenterRight >                             ╱     ╲    ╲          ╱    ╱      ╲ >                       ViewLeft   ModelLeft      ModelRight   ViewRight >   The application creates both presenters and passes them the instance of EventBus and StorageService. The presenters, in their turn, create their respective models and views. The StorageService is passed down to models. The communication between presenters is done via the EventBus. In this scenario the left side has no awareness of the right side, yet models should possess the same information without a need to do a double round trip to the server. To achieve this I use the StorageService. Models implement the `model.fetch()` method which asks the storage for data. If the same data was previously requested, the storage will simply return it acting like an in-memory cache. Here comes the actual question. **In the above context, how to design a data structure for a _network-wise efficient_ storage service for the following use case:**   1. Left model requests `GET /files?limit=100`   2. Right model requests `GET /files?limit=110` (but actually I only need the last 10) My attempted approach was:   * store the requests made by models   * for every additional request, do my best to figure out the request diff   * do the diff request (e.g. `GET /files?offset=100&limit=10`)   * store the fetched items under `{"files": {"id1": item1, ..., "id110": item110}}` Unfortunately the above steps don't help, because there's no relation between the url and the ids. When a model requests the next set of values, I never know if they are actually in the in-memory cache. Of course, I could use the per-url in-memory caching strategy, but then I would have duplicate entries in the cache, which is something I'd like to avoid. What are your thoughts? I feel like I'm reinventing the wheel here. Is there a better/simpler/commonly-accepted method? Perhaps my architecture is flawed...


title: Bug once in a while, but high priority

text: I am working on a CNC (computer numerical control) project which cuts shapes into metal with help of laser. Now my problem is once in a while (1-2 times in 20 odd days) the cutting goes wrong or not according to what is set. But this causes loss so the client is not very happy about it. I tried to find out the the cause of it by   1. Including log files    2. Debugging   3. Repeating the same environment. But it wont repeat. A pause and continue operation will again make it to run smoothly without the bug reappearing. How do I tackle this issue? Should I state it as a Hardware Problem?


title: Multiple var statements in JavaScript

text: Writing a single var declaration per function is considered to be good for readability and maintainability. But, when I went through some of standard libraries, their dev version doesn't strictly follow this. For example, Underscore code has multiple var statements in many function which are spread randomly and declared as required. Is there any reason to not to follow the single-var-rule?


title: Question about the no-endorsment clause on the BSD license

text: I'm developing a non-free library and I want to use Bcrypt.Net in it. The clause in question:   * Neither the name of BCrypt.Net nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. To what extent does this mean I can't use the name of Bcrypt.Net? For instance, could I say "the only ASP.Net authentication library capable of using Bcrypt" or can I even include "supports Bcrypt for password hashing" in promotional materials? Note: I do not actually modify any of Bcrypt.Net's code


title: Where to put comments, class declaration or constructor?

text: For a given class, where should the comments about the purpose of the class go?               /// <summary>     ///       <----------------- describe the class here (1)?     /// </summary>     public class Message     {       ...       //class members here       ...       /// <summary>       ///      <--------------- or here (2)?       /// </summary>       public Message()       {       }     }      If I go with the first option, the purpose of the class is very easy to find when I open the file, it's in the same place, on approximately the same line. When you have lots of classes, this is easier for the eyes. You don't have to scroll down past the members to find the constructor If I go with the second option, I get Intellisense when creating an object of the class, stating it's purpose and explaining the parameters, which is very nice. From what I can tell, I can't get both advantages by using just one method. The only solution I can think of is putting the same comment in both places, but that's just duplicate information and I don't like it.


title: Can Scala be considered a functional superset of Java?

text: Apart from the differences in syntax, can Scala be considered a superset of Java that adds the functional paradigm to the object-oriented paradigm? Or are there any major features in Java for which there is no direct Scala equivalent? With major features I mean program constructs that would force me to heavily rewrite / restructure my code, e.g., if I had to port a Java program to Scala. Or can I expect that, given a Java program, I can port it to Scala almost line-by-line?


title: How should one prepare to allow others to add languages?

text: Seeing as many, many open source products are offering translations in multiple languages, I decided I may want to design my application around this requirement. I currently have a niche application that has positive reviews - In English. If I wanted to expand the audience to allow users who speak other languages in, I need to find translators who also program. That's not what this question is about. What technique is standard for allowing Joe Developer who speaks English and French, to add in the French language for all the text, and how should I allow them to submit the changes? Is a separate text/language file the way to go?


title: If someone was making software, able to display content in any written language, what would they have to consider?

text: I know you'd have to use Unicode. And that Japanese is read vertically and reverse of English. What are some of the things one would have to take into consideration?


title: Scrum meeting - dealing with the last question

text: In the 5/15 minute scrum meeting the 3 questions are asked. For the last question "what impediments are getting in your way" If a dev has problems - the xyz is going to have problems, this is likely going to draw the meeting out past 15 mins and could go into a hour long discussion. Is it the scrum masters job to help this user, is there something to stop this from going on more than 15 mins. Thoughts?


title: Difference between complexity and performance guarantee

text: I'm a bit confused with the performance guarantee and complexity of selection sort. I checked through internet and the complexity of selection sort is O(n^2). This O(n^2) is in terms of time complexity, am i right? So how about performance guarantee? Is the performance guarantee in my case measured in terms of swapping or in time complexity as well? If the performance guarantee is in terms of swapping, so best case of swapping is zero swaps (the array is already sorted) and the worst case of swapping is n-1 step? The performance guarantee is then equal to (n-1)/0=undefined, am I correct? Please correct me if im wrong...or is the performance guarantee is in terms of running time? Then performance guarantee will be (n-1)/(n-1) = 1? Can someone please clear my doubts?


title: Is Business Intelligence (BI) the Right Job Title?

text: There is a department at my company called Business Intelligence (BI). They mostly build reports and configure SSRS, SSIS and related Microsoft technologies. Most of them barely understand SQL (even though they work with databases all day long) and fewer know anything about writing software. At other companies, BI had very little to do with IT. I am curious if my current company is simply mislabeling/misunderstanding what these folks do. Or is this what BI is really all about? If they aren't true BI, does anyone know what the proper name for their position is? It will be helpful when trying to hire new people so we don't end up wasting their time.


title: Should entities be accessible from all layers of an application?

text: I am googling this issue now for weeks, but cannot find a good discussion. It boils down to this: As POCO entities used in a dbContext are in fact a definition of the database, shouldn't they be constrained to the Data Access Layer and not be visible outside it? On the other hand: it is convenient to hide some POCO entities in the ViewModels. so that changed properties can be passed back easily to the Data Access Layer. I find many examples of Entities that make their way into the user interface, but also many examples of where AutoMapper is used to map the properties of a ViewModel to an Entity. Can someone point me to some good working examples or discussions that could help me make a well informed choice?


title: When is it worthwhile to replace working mature code with frameworks+patterns

text: I fear that frameworks in many cases have become a fashion or trend and are being abused. In many ways people are sacrificing speed just because they want to keep up with every single lib that comes out. I am for a more conservative approach that only makes use of new libraries and frameworks when it absolutely makes sense. Related: When NOT to use a framework **Case** We have a Tomcat6 Servlet production that has been ongoing development since 2008 and there are many hours of work behind it. The code is very mature but it does not use any frameworks. A new team member loves using frameworks and patterns for everything. Except for the love of frameworks, they also love cutting edge new releases and even proposed migrating from Tomcat6 to somethiong newer (JBOSS,GLASSFISH, or TOMCAT8). I would never move a core production service to a container/server/web-server that just came out. Not against refactoring code to keep it clean though! I am against adding frameworks and patterns that add delay to production code servicing thousands of requests per second. **Serialization to stream (JSON/XML) while maintaining backwards compatibility** When a request comes, we produce both XML and JSON documents containing data related to the request params. Since we maintain backwards compatibility for older clients changes must not break older support. Since we also support both JSON and XML, we make use of the Jackson but also KXML libraries. For both formats we have 2 different serialization methods that use the **streaming API**. Except for being faster, I also find it is MUCH more flexible for maintaining backwards compatibility. I like to use a sysyem of Major and Minor version. All minor changes to the backend that cause changes to the serialized document I add with IF statements in the serialization method. Once quite a few changes have accomulated (over 1 year), we add a new serialization method. So, all requests specifying version=1.00 to 1.99 are sent to serializeJSON1. All requests using version 2 to 2.99 are sent to serializeJSON2. I've heard the argument that we should use ANNOTATIONS and MAP to objects. I find this very distastefull as I have read streaming is the fastest. The streaming API allows you to make necessary changes on the fly while MAPPING would require to store multiple versions of the same data as different objects, or jump through other hoops.                output.startTag(null, TagTable.PRODUCT);           output.startTag(null, TagTable.ID);      output.text(ID);      output.endTag(null, TagTable.ID);           output.startTag(null, TagTable.DESCRIPTION);           if (locale != null && Translations.containsKey(locale) && version >= 1)          output.text(this.DescriptionURL + "/" + locale);      else          output.text(this.DescriptionURL);           output.endTag(null, TagTable.LONGDESCRIPTION);           if (version >= 1 && version < 1.5) {          output.startTag(null, TagTable.POPULARITY);          output.text(String.valueOf((int) this.pop));          output.endTag(null, TagTable.POPULARITY);      } else if (version >= 1.5) {          output.startTag(null, TagTable.RATING);          output.text(String.valueOf((int) this.rating));          output.endTag(null, TagTable.RATING);      }      In the specific 3 cases above I really don't see the point to replace working mature code with frameworks/libs/patterns that may add additional overhead and cost additional development time. So, when is it worthwhile to replace working mature code with frameworks+patterns?? Comments? **Update: Some benchmarks** For the first two examples posted previously, using REST and HASHMAPs does not make overly that big a difference in performance but does make the code more readable. Now for the more interesting issue about serialization when used in a hotspot. Since the actual servlet in question had too much other code I made a toy example to test streaming vs mapping. The code is available at: http://stackoverflow.com/questions/21781540/ By all means test it, change it, run it. What is very interesting is that the Just in time optimizer in java ends up making the difference negligable over time. So, here is how the percentage between mapping and streaming changes the more iterations there are.               Iter    Stream  Mapping     0       36,71%  63,29%     20      44,75%  55,25%     40      45,65%  54,35%     60      45,95%  54,05%     80      46,24%  53,76%     100     47,09%  52,91%     120     47,09%  52,91%     140     47,37%  52,63%     160     47,64%  52,36%     180     47,92%  52,08%     200     47,64%  52,36%     220     47,92%  52,08%     240     47,92%  52,08%     260     47,92%  52,08%     280     48,19%  51,81%     300     48,45%  51,55%     320     48,45%  51,55%     340     48,45%  51,55%     360     48,45%  51,55%     380     48,45%  51,55%     400     48,45%  51,55%     1000    48,72%  51,28%     2000    49,24%  50,76%     3000    49,24%  50,76%     4000    49,49%  50,51%     5000    49,75%  50,25%     6000    49,75%  50,25%     7000    49,75%  50,25%     8000    49,75%  50,25%     9000    49,75%  50,25%      I also re-ran one more time have first 20 iterations more detailed:               0   39,76%  60,24%     1   41,18%  58,82%     2   40,83%  59,17%     3   40,12%  59,88%     4   40,48%  59,52%     5   40,83%  59,17%     6   40,83%  59,17%     7   40,83%  59,17%     8   40,48%  59,52%     9   40,12%  59,88%     10  41,52%  58,48%     11  42,53%  57,47%     12  42,86%  57,14%     13  42,86%  57,14%     14  43,18%  56,82%     15  43,50%  56,50%     16  43,50%  56,50%     17  43,82%  56,18%     18  43,82%  56,18%     19  43,82%  56,18%     20  44,75%  55,25%      After 10,000 iterations (or calling JSON generation code 1000 times) here is the screenshot from VisualVM profiling (visualVM snapshot NPS file): ![enter image description here](http://i.stack.imgur.com/gjl61.png) So, if this optimization behavior holds up in Tomcat servlets as well, it means there really is **no point NOT to use mapping** (and many other convenience functions/libs since the JVN will optimize over time). **Conclusions** Based on the answers/comments, I think at the end of the day whether to rewrite working production code is affected by business requirement, and specific cost-benefit analysis for each project. Based on the benchmarking, it turns out avoiding some libs/frameworks may make no difference in the long run due to JIT JVM optimizations. **Update: After leaving code running all night** ![enter image description here](http://i.stack.imgur.com/7ESGK.png) After 275,137 iterations and approximately 30,000 MS:               Mapping -   19,80%     Streaming -  80,20%      I really wonder what JIT optimizations happen here and whether the behavior holds for a servlet.


title: enum for Java reference types

text: I need a simple `enum` declaring the Java reference types, as:               public enum ReferenceType {         STRONG, SOFT, WEAK, PHANTOM;     }      Does such `enum` exist somewhere in the Java API or a general utility library such as Guava ? I have not been able to find it in either place, although I found third party projects that declare it (e.g. google-guice: RefrenceType). I just try to avoid polluting my project with silly classes/enums that may exist somewhere else. **UPDATE** I found that Guava in fact used to have this, but they dropped it: http://tinyurl.com/ndaqpet


title: DB Design: How to link a single column to a collection of entities

text: I have a db design question that I am sure has been quite extensively covered but I cannot find a good answer already. The problem is how to efficiently link a single school course to a collection of textbooks, a course may have 0 books and it may have 10. The problem here is that multiple courses can use the same textbook as well. My first thought was to include the textbook tables PK as a FK in the courses table. Then the courses table has a composite PK of course id and textbook id. The problem with this approach is that the courses table could potentially have a lot of columns, and then I am repeating the entire course row for every textbook addition, in addition to having to set a fake textbook_id for courses that do not have a textbook. **courses**   * course_id   * course_name   * FK textbook_id   * PK(course_id, textbook_id) **textbook**   * textbook_id   * textbook_name  My next thought was to have a table that has 10 columns for textbooks, that I use for linking a course to all the textbooks. But, I'm not sure if there is a better approach (this will end up using less space), when I think about this I think why not have textbook1, textbook2 columns in the courses table in the first place. **courses**   * PK course_id   * course_name   * FK textbooks_ids **course_textbook**   * FK course_id   * FK textbook_1   * FK textbook_2   * FK textbook_3   * FK textbook_4 **textbook**   * isbn   * textbook_name A bit of background as well, using MySql, Hibernate ORM, and writing a separate search indexer. Anyone have any suggestions on a better approach or thoughts on which of these two approaches is better? Thanks in advance for the help


title: How to end my dependency on .NET?

text: I have been developing Windows GUI applications since many years and jumped into .NET in early 2005. .NET is a undoubtedly a remarkable platform and I am still using it, but with a variety of technologies out there, I don't want to remain dedicated to this camp. I want to learn new languages with which I can develop GUI applications. I am learning Ruby and just installed Python. I read about WxRuby, a framework for developing Windows GUI app. in Ruby. I am searching for a similar framework for Python. Apart from that I want to know which language is more suitable for a production-level GUI app. I doubt that Ruby is more focused on Web platform with it's glamor, Ruby on Rails. I know that I may not get those rich .NET classes and that impressive Visual Studio IDE, but still I want to follow the road less traveled. I don't want to go with IronPython and IronRuby, however sometime later, I may dip hands to explore them.