How do Tortoise svn handle concurrent file updation

I don't know much about Tortoise SVN, but have been using it for a while. I understand that it is capable of managing concurrent users on same file, but how does it do that? I am working on a file that another user is using concurrently and he committed couple of times before me, Now my files doesn't have the changes he made. Every time i end up in such a situation I gets a conflict and I am stuck. So is there something else I should do instead of just `committing` and causing `conflict`? Is it safe to do a `update` first and then `commit` ? Will I lose my local changes in this case? Please don't beat me up if this is something basic, a link to some tutorial will be useful in that case :)


When is C a better choice than C++?

I can't imagine that there's any reason not to use the OOP features of C++. It's is just as fast as C, and - what's more important to me - it's transparent, just as C. (I mean "transparent" that I know, what is my source is compiled to. Or, I think, I know.) Is there any reason not to use the power of OOP in C programming? I accept only embedded systems or other restricted platforms as exceptions, where no such memory management is available, which is required by C++. I also accept operating system development. Or programs started writing before C++. Okay, that's all. **UPDATE:** the question is just about C vs C++, not C/C++ vs other languages. I'm using C/C++ just in "final case".


What should a proper Ready for Sprint definition contain?

Teams in our company deal with Product Owners who are in such a position that they cannot spend as much time with us, as we would like, to do proper Backlog Grooming. Thus in order to alleviate some of the time constraints we have begun implementing the art of getting stories "Ready for Sprint" or in other words getting them into a state where we know/understand enough to take them into a sprint. Unfortunately we are still new to what would be a proper definition of 'Ready For Sprint' and so the question of what would be good to keep in mind when getting a story in the backlog Ready for Sprint? [EDIT] In response to answers and comments by Ryathal and Donal Fellows i would like to try explain that we do not intend to actually build the stories. We would like to apply the practice of getting existing stories "Ready for Sprint" as explained by this Blog Post. Product owners should probably be adding to this but as mentioned we are not in a prime position with our product owners (as yet). We have read that you can make definitions such as a story is in Ready state if its effort points are 5 or less, or the story must have Minimum Acceptance Criteria defined, or it must have a Balsamiq Mockup etc. My question is geared towards finding what others have used in their definitions and what has worked for them. :)


How common is pair programming in the workplace?

I've always been intrigued by pair programming, but in 12 years development I've never worked in a place they have employed this practice, so I have always been sceptical as to how people see it. I wonder whether this is because of money/time (Pointy haired boss spotting two people at one computer working on the same code!!!! how dare they!) or for other reasons?


Why is JavaScript not used for classical application development (compiled software)?

During my years of web development with JavaScript, I come to the conclusion that it's an incredible powerful language, and you can do amazing things with it. It offers a rich set of features, like:   * Dynamic typing   * First-class functions   * Nested functions   * Closures   * Functions as methods   * Functions as Object constructors   * Prototype-based   * Objects-based (almost everything is an object)   * Regex   * Array and Object literals It seems to me that almost everything can be achieved with this kind of language, you can also emulate OO programming, since it provides great freedom and many different coding styles. With more software-oriented custom functionalities (I/O, FileSystem, Input devices, etc.) I think it will be great to develop applications with. Though, as far as I know, it's only used in web development or in existing softwares as a scripting language only. Only recently, maybe thanks to the V8 Engine, it's been used more for other kind of tasks (see node.js for example). Why until now it's only be relegated only to web development? What is keeping it away from software development?


How do you manage frequent software releases to multiple clients?

we have a cross-platform middleware product which we typically end up customizing/bug fixing on a per client basis. In some cases, providing updates as often as once/twice per week. We have a lot of trouble efficiently managing and releasing the updates to our clients. I've done some digging, but I can't find anything to specifically address this problem. Can anyone share their experiences - how do you deal with this scenario, or do you know of a good software delivery cms?


What's the *ISTQB* and are they trustable?

I heard that my co-worker want to get ISTQB certification. But I heard it first time. So it's hard to trust it. In fact I can't understanding the concept of qualification for testing software.   1. What is the organization. What's the value of the certification?   2. How do you think about it? Is it trustable publicly?   3. How many company recognize the certification?


Lead developer unable to do INNER JOIN

I had worked in the past for a small company developing web applications. Back then the ~~current~~ lead developer, who is also one of the bosses, told me that he is incapable of making a `JOIN` inside a `SQL` query. I was amazed how a person who has developed and maintain big ecommerce site is incapable of doing that. Are database normalization and functional dependencies a waste of time? Are they only necessary in big demanding projects?


Is checking count/size/length less than 0 necessary in modern languages?

Is checking count/size/length less than 0 necessary in modern languages anymore? For instance, in C# I quote often will check if a collection's count is less than or equal to 0. I assume that this was done in older languages, like C, where you could potentially have a size of less than 0. Is there ever a case where you can have the size/length/count of an object or primitive type be less than 0?


Best way to hide API key in source code

I need some ideas on how to protect a private API key in an application, specifically in a c# .NET application. Firstly, I understand that it is theoretically impossible to hide anything in the source code, so I came up with another idea, but I'm not sure how plausible it is. Anyway, would it be possible to somehow communicate with a web server to verify the private key and then talk back to the application to confirm that it is a legitimate handshake? I'm have two keys to work with: a public key (as the name suggests, it doesn't have to be treated with the same care as the private), and a private key, which needs to be kept secure from others. Any ideas on how I could do this would be greatly appreciated.


Does SRP with ORM provoke SOA?

Sorry about the many abbreviations in the title... My observation is that applications built with an object-relational mapping like Hibernate tend to follow a service-oriented architecture instead of an object-oriented one. Some people (e.g. here) say the Single Responsibility Principle suggests that dealing with reading/writing attributes of persisted objects as well as creating and finding these objects is enough responsibility for one class. Any business logic using such an object should go to separate classes. That leads us to a design with two separate types of classes: state-full but dumb record keeping ones, and logic bearing but state-less ones. Here's why I don't like this kind of design: (1) To me, this separation of data and code is not a goal of object-oriented but is the design of service-oriented architecture. OOD says that operations should go to the classes where the attributes it uses are defined at. (2) Also, it's a bogus solution: whenever the structure of one of the state- full classes changes, I'll have to change all the service classes that use it, too. If I had the logic inside those classes, the change would stay in one class. (3) I'm using an ORM framework which pretty much generates all the code necessary for accessing the persisted data for me into a class. If I wasn't adding the business logic to it, the class would stay rather "empty", i.e. it would contain the generated code only. I know that many programmers follow the service-oriented design, especially when using frameworks that suggest this, like Spring. If I were using such a framework, I'd go with the separation of code and data, too. I don't want to provoke a discussion whether SOA is good or not. I'm interested in the question whether it's good OOD (as per SRP) to separate business logic from classes representing entities.


SQL scripts in TFS without putting them into solutions?

I am working on adding existing SQL scripts to version control. I have Team Foundation Server 2012 set up with Visual Studio 2008 and SQL Server Management Studio 2008 R2 with the MSSCCI. I am fairly new to TFS so I do not know if I am missing an easier way of doing things. Managing SSIS projects and even SSRS projects makes perfect sense with TFS, as a project is needed to use or modify it in Visual Studio/BIDS. You add the project to source control then check in much like saving a solution/project normally on your local machine. SQL scripts seem a little more cumbersome to use with TFS. It seems like I have to create SQL Server solutions to add any sort of sql script to my source control from SQL Server Management Studio (the add to source control functionality). While I can create new solutions in SSMS and add them to source control quite easily, it is a little annoying to have to add all of my existing scripts, which are simply .sql files, to new solutions. Ideally I would like some way to just add the scripts to source control, be able to modify them in SSMS, then check them back in somewhat easily. If this were subversion, I could just commit and check in the single file in Windows Explorer and be done with it, managing and modifying the file however I want. Is there an equivalent in TFS to this?


What makes JVM so much versatile to support so many JVM languages?

JVM supports so many languages other than Java like `Groovy,Clojure,Scala` etc which are functional languages unlike Java(I am referring to _Java before Version 8_ where `Lambda's` are not supported) that doesn't support functional capabilities.On a high level what makes the JVM so versatile that it can support both Object Oriented as well as Functional languages?


How bad would it be to obtain a lock on every object?

Imagine a hypothetical programming environment that is largely like Java or .NET, i.e. object-oriented, garbage-collected, etc., but with one small change: Every time you call a method on an object, a lock is obtained so that no two threads can execute methods on the same object at the same time. The lock is relinquished when the method returns. The lock is also temporarily relinquished when you call Thread.Join (this is just to prevent certain kinds of deadlock situations). How severe would the performance impact of that really be? How badly would this interfere with concurrency? Are there any algorithms/programs that it would be impossible to parallelise in this kind of environment? In my previously posted question, a link was given to this page about the GIL in CPython which claims severe performance and concurrency problems with this. However, it also states that this environment uses reference counting and the increment/decrement of that reference count is an operation that obtains such a lock. Let's not assume that; .NET's GC is mark-and-sweep, not reference- counted.


How to estimate tasks in scrum?

Let's say we have a backlog of User Stories, each with an estimated number of Story Points, and now we're doing the Sprint Planning. Now, the Stories should be broken down into tasks and many Scrum resources suggest that each task should be estimated in person-hours. Since all questions have been discussed by the team at this point, estimating a task should not take longer than a minute. However, since a task should not be longer than a day, assuming a three week sprint with 8 developers means 120 tasks, and taking two hours only for estimations seems to be a bit much to me. I know that experienced teams can skip or short-cut task estimations, but let's say we're not at that stage yet. In your experience, how many tasks are there in a sprint and how long should it take to estimate all of them? (Estimating only half of them doesn't make much sense, does it?) Clarifications: I know the answer depends on sprint length and team size, so let's assume 8 developers and three weeks. The numbers mentioned might be rules of thumb, but even if they are off (eg, more tasks, less time needed to estimate each) we will end up with about 2 hours for the estimation. So maybe the question should be "What percentage of the planning meeting should be reserved for pure task estimation, and don't we have better things to do?"


Is there a formal enumeration of the ways that components can be coupled / depend on eachother?

Say you have               class A {     }          class B {     }      One type dependency is "method parameter":               class A {     }          class B {       public void M(A a) {       }     }      Another is "method returns":               class A {     }          class B {       public A M() {       }     }      Then C, an adapter from A to B, could be identified by a class that exhibits both of the above dependency characteristics:               class C {       public B M(A a) {       }     }      I just seems like something that could be approached with some formal methods and I'd be interested to read about them if they are out there?


Is Neo4j graph database sufficient to itself for all query types?

Neo4j eases relationship traversals => especially useful for a social network for instance. But are there any scenarios when it's advised to associate an additional relational database (or other NoSQL database that isn't specifically oriented graph) for specific query types. In short, can Neo4j be sufficient to itself for all query tasks?


Learning high level languages

I've been actively programming with assembly but now I'm losing motivation. My productivity is simply ridiculously low compared to what others seem to have with high level languages. I know I should start using high level languages but I always return to assembly for some reason. How could I get used to higher level languages and finally become productive? I'd really want to master at least one.


How to make a good bug report for a bug that does not appear on every user?

I found a bug on my XFCE and some other can't repeat the bug, namely http://askubuntu.com/questions/495947/a-logo-disappear-in-xubuntu . How should I report it to the developers if those can't repeat is as well?


Getting A Logo And Graphics For An Open Source Project

I have been working on an open source project for about 2 years. I would like to create a web site, but I am on essentially a zero budget. I also need a logo. My question: How should an open source developer go about improving the project's "visual appeal" without spending a lot of money? Are there graphic designers willing to donate time? How does one find them (if they exist). With a project you spend so much time on - you want to give it a nice looking web site so that it will grab people's eye. On the other hand, you don't want to spend money on something you are giving away for free. Has anyone had any personal experiences they can share?


Pros and cons for choosing between different return types

This is in context of a client-server architecture, although I don't think the architectural setting is needed to put up the problem. I have a function whose output can be classified into different categories:               function makeCar() { /* make a car */ }      Now, in order to decide the structure for the return value of `makeCar`, I have several options: ## Option 1 Return integer values and have a data structure that maps the integer values to different types of cars. Example:                   codeToCar = {                      "1": {                            "model": "Jaguar XJS",                             "color": "Black",                             "year": "1975"                           },                       "2": {                            "model": "Chevrolet Camaro",                             "color": "Blue",                             "year": "1966"                           }                       ...                     }      In this case, the function `makeCar` would return the keys of `codeToCar`. ## Option 2 Return the car object itself and do away with the integer codes. ## Option 3 Return a hybrid structure with some integer codes and some specific values. Example:                   codeToColor = {                        "1": "Black",                         "2": "Blue",                         ...                       }               codeToMaker = {                        "1": "Jaguar",                         "2": "Chevrolet",                         ...                       }       In this case, the function `makeCar` could return                  {         "color": 2,          "maker": 1,          "model": "Camaro"         }      What are the pros and cons of using the different options? ## Edit: I guess I should have elaborated the context more. So basically the function `makeCar` executes on a client browser and the return value of the function is passed to the server in an HTTP request. Any representation for the return type of `makeCar` on the client side would ultimately be translated to a full object representation ( **option 2** ) on the server. The two parameters I chose for comparing between the different options are:   1. Number of bytes transferred over HTTP   2. Extensibility in case new properties are added to cars or new values are added to an existing car property. I, however, would also be interested to know what other parameters could be used ( _in the current context_ ) to compare the options available, alongwith choosing between the different options based on the chosen parameters.


How should I keep track of an elements' state within a window/view?

I am trying to implement a view that contains many elements, whose state change depending on the actions you perform on it. I guess this is something that people often run into so I would like to know what approach works best for you. What I usually do is define several states for my view: {Loaded,Initialized,...} and then set the state of each element for that state. The thing is even the most trivial event,a click on a button for example, makes the state change, so I need a lot of different states, with many of them containing duplicate information since they are very similar to each other. This seems very repetitive and unefficient but has worked for me up until now, when I need a better way of doing this kind of stuff. This issue must have been around for quite a while, so it would be nice to know people's tricks & tips, best-practices, and documents of reference.


Could an internal rep, voting and badges encourage good programming practices?

Just thinking out aloud - we programmers love all this voting/badges/rep stuff so could a scheme like this be introduced into a companies code review process to encourage better coding. Something like   * You (or others on your behalf) can post a review (could be snippet, single commit or series of) for a code review   * Others can comment on it (would be similar to answers in SE)   * Badges can be given/suggested (some would be good, some would be bad like "Comment Desert" or some such)   * You can vote up/down on the code itself and the comments and badges (e.g. if someone suggested a badge and you did/didn't agree) The aim of a scheme like this would be   * Introduce a bit of fun to encourage the use of code reviews   * Improve quality (in this scheme both code reviewee and reviewers are likely to learn)   * Reduce the chance of code reviews sparking 'ego wars'   * Give some metrics to _help_ measure individual performance Could this work? Thoughts?


Have there been studies on the effectiveness of OOP in managing software complexity?

OOP is often regarded as an effective strategy of managing complexity in software, as opposed to non-OOP procedural programming. Have there been any studies testing this notion? Is it proven that OOP often helps manage complexity in large projects?


Which programming languages doesn't use operator precedence besides Lisp like languages?

And what do you think about operator precedences? Would be harder programming in language where the operations are executed in sequential order? Ex.: 2 + 3 * 4 == 20 2 + (3 * 4) == 24 Ok, Lisp family has not precedences by definition. Let's gonna talk about procedural and object oriented languages using this "feature".


Costs of Switching to Java

I'm a C# dev and I have plans of starting to develop apps targeting Android, which of course means Java. I have heard good things about Mono for Android and the idea of reusing my skill set is appealing, however the licensing cost (for now) is a bit prohibitive to me. On the other hand, from what I can see, Java is very similar to C#, so I'm predicting that shifting my skills to it will be more or less easy (easier than shifting to Obj-C I guess). Am I wrong in assuming that? Are there any hidden costs I'm blind to?


In a team practicing Domain Driven Design, should the whole team participate in Stakeholder meetings?

In my experience, a Software Development Team that comprises:   * 1 Project Manager   * 1 Tech Lead   * 1 - 2 Senior Dev   * 2 - 3 Junior Dev (Fresh grad) Only the **Tech Lead & PM (and/or Senor Dev/s)** will participate in a meeting with **Clients, Domain Experts, Client's technical resource**. I can think of the ff potential pitfalls:   * Important info gets lost      1. Human error (TL/PM might forgot to disseminate info due to pressure or plain human error)     2. Non-verbal info (maybe a presentation using a diagram presented by Domain Expert)   * Maintaining Ubiquitous language is harder to build since not all team members get to hear the non-dev persons   * Potential of creative minds are not fully realized (Personally, I am more motivated to think/explore when I am involved with these important meetings) Advantages of this approach:   * Only one point of contact   * Less time spent on meetings? Honestly, I am biased & against this approach. I would like to hear your opinions. Is this how you do it in your team?


Binary Search Programming implementation

Binary Search, as we all know requires the elements to be sorted. But we have to take care of unsorted elements too, in the worst case. If the input size is very large, is it a good idea to sort the elements everytime? Can we not just check the elements that they are not sorted or not and proceed to sorting and proceed to sorting only if they are unsorted?


Estimation Techniques for Linux Kernel Development

I am working in Linux Kernel area and my work includes: code study / Understanding Porting (say from one kernel version to another kernel version) Implementation of new kernel module / Device driver How to do estimation in such Linux Kernel assignments? Is there any technique? How the community is doing?


Is Ubuntu workable as a laptop for an IT consultant?

I work as a consultant programmer, typically in large businesses. I use a Windows Laptop, and many of my colleagues use a Mac. My personal preference would be to run Ubuntu if I could have complete control over my development environment. But I will have occasional need for Microsoft specific products, especially IE. My colleagues that use a Mac often run Windows on a virtual machine for these situations. My question is: Is Ubuntu a workable solution for the laptop of an enterprise programmer? For example, is it as easy to run Windows on a VM on Ubuntu as it is on a Mac? Has anyone out there tried this? Is there any particular reason why Ubuntu would not serve as well as a Mac for development in this environment? Note that I am not doing .NET development, so I am typically dealing with Java that is going to be run on an Apache server and used by clients running Windows.


What language does Introduction to Algorithms by Cormen use?

![enter image description here](http://i.stack.imgur.com/3ZXno.jpg) What language, if any, is used in this book? My school is currently using a terrible book for the algorithms course that I have to take next year and I'd like to convince the department head that Introduction to Algorithms by Cormen is a much, much better book.


Is it legal to imitate how an API looks?

I want to make an open-source graph thing which looks and behaves very similarly to Google Visualization API, but it would be based on Flot. Is this legal, or must I not imitate Google Visualization API?


What does a company typically expect from a Perl developer?

Are there any **common expectations** from perspective employers when they hire a Perl developer? For a student who likes Perl and Linux and would like to get a job as Perl developer, what would you recommend to learn? **I am looking for things that are generic and applicable to most/all Perl positions** , as opposed to specific details of a given company's requirements. In other words, what are the things I should be able to to/know to become more attractive to ANY company looking for a Perl developer.


How Does Download Size Affect Potential Users of Your Product

Does anyone know (or, I guess, I have gut feeling about) how the download size of a software product affects potential users, bandwidth not withstanding? For example: Does a bigger download make them believe that is it more full- featured than it is (like huge .NET Runtimes if deployed with your package)? Reason is, I'm developing a VSTO add-in where there is my add-in (small MB), the VSTO run-time, .NET runtime, and Primary Interops. This could make it more than 70 MB in total size, just for an add-in that does a couple of things well. _But that's all they are - just a couple of things._ With VSTO deployments, I know I could deploy a smaller package size by assuming they've got the .NET runtime (and when they don't, initialize the download/install of that, but it seems like a clunky way to make just an ass out of me). What I really want is for people to just download the app (the trial version) to see if they like it. Is there some kind of magic happy threshold - like users of non-big name apps are more likely to download something that is under 20 MB than 50 MB?


How to get GPS enabled device angle

I am planning to buy a GPS enabled android phone and develop an Augmented Reality application (which will point the locations in front of camera). All i found about GPS is that it just tells the location of the device, how do i get the direction where camera is pointing, and height of device? how to make compass (2D, 3D) with GPS enabled phone? Is responsibility of phone to tell the direction? **(please correct, if i asked this question at wrong place)**


Stack and heap - dynamic allocation question

Sources usually mention that dynamically created variables are allocated on the heap, while functions' variables on the stack. Also the ones on the stack cease to exist automatically when e.g. the function which contains the variable exits. If I understand correctly, data fields of class are on the heap. I do not understand, what is meant by 'dynamic'? As I see it, when the code is running, anything being created is created dynamically on the fly, be it function variables or objects with variables inside them. I would be glad for simple explanation. Thanks


A module which is used by most other modules

I am pursuing object oriented design. So we don't want to use globals but yet sometime we have a module that most other modules use. This means we have to just pass it to all other modules and this can be literally all modules!               class Logger     {     public:         Logger(void);         ~Logger(void);     };               class Calculator     {     public:         Calculator(Logger *logger);         ~Calculator(void);     };               class Taxation     {     public:         Taxation(Logger *logger);         ~Taxation(void);     };      So the idea is that the `Calculator` and `Taxation` modules use the `Logger` module to log everything. Similarly most other modules will use it too, and logging is required everywhere. Is this method okay or should `Logger` be global instead?


What Is The Process of Creating A Bug Bar?

In my company, we're working on adopting the Microsoft Secure Development Lifecycle, and part of the MSDL process involves establishing security and privacy bug bars at the onset of a project. I've heard the concept of a bug bar prior to MSDL, and I understand that it's essentially a definition of what level/amount of bugs you're willing to accept in a final product, but I've never understood how to creating a bug bar for a project. Are there any well documented processes for establishing bug bars that I can learn from? I've tried doing some Googling for examples or real world scenarios of projects defining bug bars at the onset of a project, but I can't seem to get any good results or tips on the process of establishing a bug bar. There are MSDL examples of what appear to be completed bug bars, but I'm interested in learning about the process of defining something like this. For example, for those that have done something like this before, have you defined bugs bars in a very specific way (e.g. saying "There shall be no unauthorized file system access: reading from the file system"), or have you taken a deferred approach of saying when we find bugs we'll rate them on a 1 to 5 scale (5 being the most severe), establish now that no bugs above a 3 shall be shipped, and leave your ranking of bugs until they're discovered? I feel like the trying to do the former is a foolish and impossible activity, but the later is prone to bias towards leniency when a project is coming down to the wire. Again, to wrap all of that up into a succinct question, can anyone provide me with a well documented approach for defining/creating bug bars?


How to completely avoid business logic in DAL?

In our ASP.NET MVC application, we try really hard to separate concerns to each layer (we use DDD). Nevertheless, it seems that we can't avoid having at least some business logic in DAL. For instance, there are named objects, where business requirement is that each name must be unique (but the name isn't a key). If there is a request to create new named object, the service checks whether some object with that name exists in repository, if it doesn't, factory creates new object and repository persists it (we use EF for repositories and stored procedures for query objects). The problem is with race conditions - if two requests come concurrently (it's unlikely, but possible), both requests want to create new object under the same name, in this case both checks come out negative and two objects with the same name would be created. So far, we handle that with constrains in SQL database, so if something like this happens, an exception is thrown in repository - but this approach is simply wrong, since such requirement is strictly business requirement and it shouldn't bubble to persistence layer; if we change such requirement, e.g. that names become case sensitive, such constrain would also have to be changed, etc.). How to implement such scenario correctly? Thanks.


What is the best way to validate the following data?

Lets say I receive an xml request that is sent to my web service and this request contains some data in it such as Hotel Room/Rate pairs (Room = Double Queen, Rate = 10%). The database has all of these Room/Rate pairs stored, so when the xml request comes in, I have to validate them to see if the request contains both the room and the rate in the database. If I receive one room/rate pair and it is not in the database, I fail the message and send back an error response, but if I receive 3 room/rate pairs for example, and 2 are found in the database, but one is not, I would process the succussfull ones and send back warnings for the ones that were not found. The other scenario is if I receive 3 room/rate pair and they all are not found in the database, then I want to send back an error message. What is the best way to approach these scenarios?


Progress bar for unknown number of items

I am working on a survey-based feature in our application and the survey has branching points at any given question depending on the answer given. Each path that a branch can take may not have the same number of questions. So if we evaluated each possible path that can be taken, you may end up with a different number of total questions answered each time. I've been told a progress bar is required for the survey, however I can't imagine how a progress bar could provide meaningful data in this context. We do not know how many questions must be answered until the survey ends without hindsight. Can anyone recommend a good logical solution to implementing a progress bar for such a feature? I don't need specifics. The UI system I'm using, the language I'm using, all of that is irrelevant. I want a strictly mathematical solution to this problem, should one exist. If not, then using things like estimations, averaging, or other "guesstimates" are also good but last resorts. Thanks in advance.


How can I cancel all running mysql queries in a web application?

I am running a web application which has to scan (mysql query on a particular column) a huge MySQL table, which has over 100,000 records. The problem I find that when a user requests another page from the same web application while the results are being fetched from the scan, the browser takes a long time to display the page. How can I cancel the scan (or the mysql query) while the new page is being requested?


Using natural language grammar in fluent API

I'm tinkering with a query abstraction over WebSQL/Phonegap Database API, and I find myself both drawn to, and doubtful of, defining a fluent API that mimics the use of natural English language grammar. It might be easiest to explain this via examples. The following are all valid queries in my grammar, and comments explain the intended semantic:               //find user where name equals "foo" or email starts with "foo@"     find("user").where("name").equals("foo").and("email").startsWith("foo@")          //find user where name equals "foo" or "bar"     find("user").where("name").equals("foo").or("bar");          //find user where name equals "foo" or ends with "bar"     find("user").where("name").equals("foo").or().endsWith("bar");          //find user where name equals or ends with "foo"     find("user").where("name").equals().or().endsWith("foo");          //find user where name equals "foo" and email is not like "%contoso.com"     find("user").where("name").equals("foo").and("email").is().not().like("%contoso.com");          //where name is not null     find("user").where("name").is().not().null();          //find post where author is "foo" and id is in (1,2,3)     find("post").where("author").is("foo").and("id").is().in(1, 2, 3);          //find post where id is between 1 and 100     find("post").where("id").is().between(1).and(100);      * * * **Edit based on Quentin Pradet's feedback** : In addition it seems, the API would have to support both plural and singular verb forms, so:               //a equals b     find("post").where("foo").equals(1);          //a and b (both) equal c     find("post").where("foo").and("bar").equal(2);      For the sake of question, let's presume that I haven't exhausted all possible constructs here. Let's also presume that I can cover _most_ correct English sentences - after all, the grammar itself is limited to the verbs and conjuctions defined by SQL. * * * **Edit regarding grouping** : One "sentence" is one group, and the precedence is as defined in SQL: left to right. Multiple groupings could be expressed with multiple `where` statements:               //the conjunctive "and()" between where statements is optional     find("post")       .where("foo").and("bar").equal(2).and()       .where("baz").isLessThan(5);      * * * As you can see, the definition of each method is dependent on the grammatical context it is in. For example the argument to "conjunction methods" `or()` and `and()` can either be left out, **or** refer to a field name **or** expected value. To me this feels very intuitive, but I would like you hear your feedback: is this a good, useful API, or should I backpedal to more straighforward implementation? For the record: this library will also provide a more conventional, non-fluent API based on configuration objects.


What is the preferred way of communicating between applications on the same system?

I'm designing a system that is built on several small applications written in python, some of these will be services and others will be programs that only run during special situations. What I need to achieve is to let the server communicate to a service when a certain event occurs with some small amount of data. So that the service knows about the new situation and can take the appropriate action, sometimes immediately and sometimes in the future. I've been looking at memcached, but it seems like an overkill solution for my system (which is just a few separate applications running on a raspberry pi), or writing to files and using something like pyinotify but I don't think that is very elegant and finally I've been thinking about storing state in a database which I also don't like very much. Are there any preferred ways to handle this sort of communication between processes that I haven't thought of(I'm sure there is) or which of the above mentioned ones would be the smartest to go with?


How do cloud platforms-as-a-service measure CPU time?

I'm currently assessing Google App Engine, and one of the answers from Hidden limitations of Google App Engine? stated: > Performance will surprise you. GAE is optimized for many tiny queries and > you get warned if a query takes any CPU time at all. You get 6.5 (at last > check) free hours per day, but it's a mystical number and you should test. > > You'll find that time as you measure it doesn't relate to the CPU or > datastore CPU time, because (for example) under the covers there might be > multiple machines updating indexes during deletes/updates. Some users have > found huge CPU usage when uploading bulk data - many hours of usage for e.g. > 20 min of real time. > > Your Java instance might need to be powered-up if it hasn't been hit in (I > think) 20 minutes. The benefit is that they can pass their smart management > on to you as cheaper costs, but it does mean you'll experience a short > delay, and see a high CPU warning on the first request in a while. > > For many cases, Python datastore access is faster than Java JDO. You'll > likely find that using the low-level API for Java faster. > > Some developers seem to have experienced more datastore errors thank you > would expect (around 0.4-1% maybe?). I haven't yet. I'm wondering what factors go into determining a PaaS's CPU time (like, in this case, the 6.5 hours free that you get with GAE). For example, does it include the total time it takes for the database to transfer data over to the client? Do the costs under this model increase dramatically as you get more users?


SMTP traffic forward/relay?

We have three different networks. Regular, Trusted, Secure. Regular has access to the internet and trusted. Trusted has access to regular, internet and Secure. Secure has access to Trusted. We used to have a local SMTP server but the powers that be decided to move it, externally. Now the secure network does not have access to it. For my own home grown code that runs in secure I have written a .Net Web service to send email. This works great. The problem is that we cannot modify canned applications the best we can do is change the server address and the port of the SMTP server. I set out to write my own SMTP server that basically forwards the message to the external SMTP server. Probably easy enough but it will take some time. I am hoping someone out there knows of a solution that we can purchase or another way of doing what we need.


Will a program ever crash if the main loop is put in a try/catch block

If we have a class main and the constructor of main constructs our setupclass and we put this class in a try catch in main. Theoratically Will all errors go into catch? If they will how will it effect the performance and mantainability? Will the application be crash free?


Does your team develop their supporting tools or this should be outsourced out of it?

By supporting tools, I mean:   * **reference data manager** , like virus definition for anti-virus software   * **test data generator**   * **level builders** for games   * **simulators** or advanced mocking systems > Does the team building the `core product` (in the case above, the game or > the anti-virus) should be part of the development of the `supporting tools` > significantly, or this is a task you would outsourced out of the team to > help it focus on the product? I don't have enough experience to evaluate the pros & cons of each, so I'm hopping you would come up with personal experiences to share, or even studies or papers you read on the subject.


ASP.NET MVC SoC when dealing with back end objects (design decision)

I had a discussion with some peers and even some technical leads in the team around this and Im all for the purist MVC approach. Especially when the project is in its infant stages (its easy to implement a pattern going forward). Im a firm believer that anything to do with the back end should be kept separate from the Views, Models and also the View-Models. A final decision was made to go with using the objects deemed pass-through because they are used everywhere, from the UI all the way back to the back end platform which handles the actual request. Here is a sample illustration of what is going to be implemented: MVC stack <-> Back end platform <-> Can either talk to a database or another 3rd party service And in the above example, a back end request object can be made in the controller level and passed through the the back end platform and there it can get adapted to suit either a database or another service. And when the database/3rd party service responds, its response is taken and adapted to one of our own types. This type will then be returned to the MVC stack. The Views and the ViewModels just use these back end platform types. What Id like to see done: Id like for the controller to pass on the responsibility to an adaptor or indeed a service layer which is responsible for taking in POCOs and creating back end platform objects. Create the request, send it off to the Back end platform. And when it responds, adapt the response into a View or a ViewModel and send it back to the controller. Objects are injected into the controller so its simply a matter of passing the POCOs to another layer to take responsibility of creating requests, sending it off and then returning a response which consists of a View or a ViewModel. Pros and cons. With the current implementation, its convenient and given that we (my company) owns the code that goes from front-end to the back end that gets used. It saves time. Which we don't have much of to get the job done. I don't see the separation of layers here. With the implementation that Id like to see done, I believe it approaches the SoC a bit more and adds down on another layer of adaptation. This is a bit more work. And, from a pure MVC point of view, its using the back end platform objects which are being used in the back end (although it was assumed that these objects will also be used in the front end). I realise this is long and doest have pretty pictures. Apologies. Id like to know what you out there would have done. Cheers.


Test Data in a Distributed System

A question that has been vexing me lately has been about how to effectively test (end-to-end) features in a distributed system. Particuarly, how to effectively manage (through time) test data for feature testing. The system in question is a typical SOA setup. The composition is done in JavaScript when call to several REST APIs. Each service is built as an independent block. Each service has some kind of persistent storage (SQL Server in most cases). The main issue at the moment is how to approach test data when testing end-to- end features. Functional end-to-end testing occurs through the UI, and it is therefore necessary for test data to be set up before the test run (this could be manual or automated testing). As is typical in a distributed system, identifiers from one service are used as a link in another service. So, some level of synchronization needs to be present in the data to effectively test. What is the best way to manage and set up this data after a successful deployment to a test environment? For example, is it better to manage this test data inside each service? Or package it together with the testing suite? Does that testing suite exist as a separate project? I'm interested in design guidance about how to store and manage this test data as the application features evolve.


NodeJS as an avenue towards learning JavaScript

I'm a backend programmer who works mainly in Python. I'll probably never want to be a full time front end developer, but with the goal of growing my skill set, I would like to become at least passably proficient in JavaScript. It seems like a language that is wearing a lot of hats nowadays, and if nothing else, I'd like to a little more knowledgable about 'their world' when I'm working with front end guys. We're using NodeJS for some server side work at my company, and I was curious about it. I've found a few good tutorials and it seems interesting. It seems like it might be a good way to familiarize myself with JavaScript, since it comes at it from an angle that I understand -- server side programming. But I am also a little worried that if I learn both at once, I won't be able to keep track of what's 'Stock JavaScript' vs features that are particular to NodeJS. What do you guys think? Is bootstrapping myself into JavaScript familiarity by learning NodeJS a good idea? Or will I just confuse myself if I jump into Node without a solid understanding of the fundamentals of JavaScript?


I can't program because the code I am using uses old coding styles. Is this normal to programmers?

I have my first real job as programmer, but I can't solve any problems because of the coding style used. The code here:   * Does not have comments   * Does not have functions (50, 100, 200, 300 or more lines executed in sequence)   * Uses a lot of `if` statements with a lot of paths   * Has variables that make no sense (eg.: `cf_cfop`, `CF_Natop`, `lnom`, `r_procod`)   * Uses an old language (Visual FoxPro 8 from 2002), but there are new releases from 2007. I feel like I have gone back to 1970. Is it normal for a programmer familiar with OOP, clean-code, design patterns, etc. to have trouble with coding in this old-fashion way? **EDIT** : All the answers are very good. For my (un)hope, appears that there are a lot of this kind of code base around the world. A point mentioned to all answers is refactor the code. Yeah, I really like to do it. In my personal project, I always do this, but... I can't refactor the code. Programmers are only allowed to change the files in the task that they are designed for. Every change in old code must be keep commented in the code (even with Subversion as version control), plus meta information (date, programmer, task) related to that change (this became a mess, there is code with 3 used lines and 50 old lines commented). I'm thinking that is not only a code problem, but a management of software development problem.


Developing scalable applications using Agile methods

Maybe someone can share from his experience about developing an application that is meant to scale big time where just throwing more money at better hardware isn't a realistic option using development methodologies such as SCRUM and XP.   1. Did you need to rewrite substantial parts of your app because of current framework couldn't scale enough to fit current sprint's stories? how do you avoid that?    2. When do you do stress (or load) testing?    3. In what stage did you make your SMART(TM) design concerning bleeding edge requirements?    4. Did you add more stages to the dev-cycle of write-a-test, code-to-pass-test, refactor?    5. Did you just refactor everything in the end to meet demands?


Does design by contract imply correct output?

Design by Contract says, in terms of the function talking: "you give me all the right parameters and I'll give you exactly this kind of data" ...in essence. So, given that, should I use up resources checking the output? I should check for properties that the function does not guarantee its output possesses, but the properties the function guarantees need not be checked, right? Here's an example:               class Transition_Manager {         string str = generate_non_null_string();         process_using_a_function_that_can't_handle_null_strings( str );     }


Are there flavours of OOP where some or all of the SOLID principles are antithetical to clean code?

I recently had a discussion with a friend of mine about OOP in video game development. I was explaining the architecture of one of my games which, to my friend's surprise, contained many small classes and several abstraction layers. I argued that this was the result of me focusing on giving everything a Single Responsibility and also to loosen the coupling between components. His concern was that the large number of classes would translate to a maintenance nightmare. My view was that it would have the exact opposite effect. We proceeded to discuss this for what seemed like centuries, eventually agreeing to disagree, saying that perhaps there were cases where SOLID principles and proper OOP didn't actually mix well. Even the Wikipedia entry on SOLID principles states that they're _guidelines_ that help to writing maintainable code and that they are part of an overall strategy of agile and adaptive programming. So, my question is: **Are there cases in OOP where some or all of the SOLID principles do not lend themselves to clean code?** I can imagine right away that the Liskov Substitution Principle could possibly conflict with another flavour of safe inheritance. That is to say, if someone devised another useful pattern implemented through inheritance, it is quite possible the LSP might be in direct conflict with it. Are there others? Perhaps certain types of projects or certain target platforms work better with a less SOLID approach? **Edit:** I'd just like to specify that I'm not asking how to improve my code ;) The only reason I mentioned a project in this question was to give a little context. My question is about OOP and design principles in _general_. _If you're curious about my project, seethis._ **Edit 2:** I imagined this question would be answered in one of 3 ways:   1. Yes, there exist OOP design principles which partially conflict with SOLID   2. Yes, there exist OOP design principles which completely conflict with SOLID   3. No, SOLID is the bee's knees and OOP will forever be better with it. But, as with everything, it's not a panacea. Drink responsibly. Options 1 and 2 would have likely generated long and interesting answers. Option 3, on the other hand, would be a short, uninteresting, but overall reassuring, answer. We seem to be converging onto option 3.


Can a Java interface declaration enforce parameter properties?

As far as I know, declaring an interface is like so:               public interface Roots_Squares {         public double square_root( double value );     }      Now... how do you enforce value to have non-negative values? Such a function should avoid negative values right? If someone creates a class that implements this, and that implementation does not handle negative values, and then I use their class with a negative value... well, things break. It then becomes my responsibility to check for negatives when I'm pretty sure the implementor should do the checking.


Web programming most effort?

To create a website   * I create Psd Files for the design (Phase 1)   * I Convert these Psd's to html/css static webpages (Phase 2)   * I add some javascript to these webpages (Phase 3)   * I start the IDE "visual web developper" to start developping (Phase 4) I have studied computer programming for the past five years and now I noticed that the corresponding phase (phase 4) of creating a website takes the least amount time and effort in entire process. All the hard work and effort seems to be focused on the graphical design and especially on converting this design to html/css. My question is, is this a common case? Do I do something wrong in my development steps ?


How to handle divide by zero in a language that doesn't support exceptions?

I'm in the middle of developing a new programming language to solve some business requirements, and this language is targeted at novice users. So there is no support for exception handling in the language, and I wouldn't expect them to use it even if I added it. I've reached the point where I have to implement the divide operator, and I'm wondering how to best handle a divide by zero error? I seem to have only three possible ways to handle this case.   1. Ignore the error and produce `0` as the result. Logging a warning if possible.   2. Add `NaN` as a possible value for numbers, but that raises questions about how to handle `NaN` values in other areas of the language.   3. Terminate the execution of the program and report to the user a severe error occurred. Option #1 seems the only reasonable solution. Option #3 is not practical as this language will be used to run logic as a nightly cron. What are my alternatives to handling a divide by zero error, and what are the risks with going with option #1.


How does Branch Target Prediction differ from Branch Prediction?

I do not understand how BTP differs from BP? Yes I understand BP evaluates whether a conditional is true/false, but surely implicitly this also determines the "target" instruction? If I predict the first branch of an IF to be true, then surely I have just determined the branch target too (the code within the predicted IF branch)??


Am I allowed to use text(snippets) from the iOS Developer Lib for my documentation?

At the moment, I create a Java-Wrapper for Apples *.pkpass-Files (Passbook). Since I need to parse a JSon-File, I planned to add java doc to every field, so one know what exactly this field is in the pkpass and how it should be displayed. (There are some other meta data which are interesting). At https://developer.apple.com/library/ios/documentation/UserExperience/Reference/PassKit_Bundle/Chapters/TopLevel.html#//apple_ref/doc/uid/TP40012026-CH2-SW1 you can see a description of this file format. So, my question is: am I allowed to use text snippets (or the whole text) from the description column when I add also the link to the page into the java doc?


Memento with optional state?

**EDIT:** As pointed out by Steve Evers and pdr, I am not correctly implementing the Memento pattern, my design is actually State pattern. ## Menu Program I built a **console** -based menu program with multiple levels that selects a particular test to run. Each level more precisely describes the operation. At any level you can type back to go back one level ( **memento** ).               Level 1: Server Type?                  [1] Server A [2] Server B      Level 2: Server environment?               [1] test [2] production     Level 3: Test type?               [1] load [2] unit     Level 4: Data Collection?               [1] Legal docs [2] Corporate docs     Level 4.5 (optional): Load Test Type               [2] Multi TIF [2] Single PDF     Level 5: Command Type?               [1] Move [2] Copy [3] Remove [4] Custom     Level 6: Enter a keyword               [setup, cleanup, run]      ## Design ![Design](http://i.stack.imgur.com/BnufH.png) ## States ![States](http://i.stack.imgur.com/OFIvU.png) ## PROBLEM: **Right now the STATES enum is the determining factor as to what state is BACK and what state is NEXT yet it knows nothing about what the current memento state is.** Has anyone experienced a similar issue and found an effective way to handle mementos with optional state?               static enum STATES {         SERVER, ENVIRONMENT, TEST_TYPE, COLLECTION, COMMAND_TYPE, KEYWORD, FINISHED     }      ## Possible Solution (Not-flexible) In reference to my code below, every case statement in the Menu class could check the state of currentMemo and then set the STATE (enum) accordingly to pass to the Builder. However, this doesn't seem flexible very flexible to change and I'm struggling to see an effective way refactor the design.               class Menu extends StateConscious {         private State state;         private Scanner reader;         private ServerUtils utility;              Menu() {             state = new State();             reader = new Scanner(System.in);             utility = new ServerUtils();         }              // Recurring menu logic         public void startPromptingLoop() {                  List<State> states = new ArrayList<>();             states.add(new State());                  boolean redoInput = false;             boolean userIsDone = false;                  while (true) {                 // get Memento from last loop                 Memento currentMemento = states.get(states.size() - 1)                         .saveMemento();                 if (currentMemento == null)                     currentMemento = new Memento.Builder(0).build();                      if (!redoInput)                     System.out.println(currentMemento.prompt);                 redoInput = false;                      // prepare Memento for next loop                 Memento nextMemento = null;                 STATES state = STATES.values()[states.size() - 1];                      // get user input                 String selection = reader.nextLine();                      switch (selection) {                      case "exit":                     reader.close();                     return; // only escape                      case "quit":                     nextMemento = new Memento.Builder(first(), currentMemento,                             selection).build();                     states.clear();                     break;                      case "back":                     nextMemento = new Memento.Builder(previous(state),                             currentMemento, selection).build();                     if (states.size() <= 1) {                         states.remove(0);                     } else {                         states.remove(states.size() - 1);                         states.remove(states.size() - 1);                     }                     break;                      case "1":                     nextMemento = new Memento.Builder(next(state), currentMemento,                             selection).build();                     break;                      case "2":                     nextMemento = new Memento.Builder(next(state), currentMemento,                             selection).build();                     break;                      case "3":                     nextMemento = new Memento.Builder(next(state), currentMemento,                             selection).build();                     break;                      case "4":                     nextMemento = new Memento.Builder(next(state), currentMemento,                             selection).build();                     break;                      default:                     if (state.equals(STATES.CATEGORY)) {                         String command = selection;                         System.out.println("Executing " + command + " command on: "                                 + currentMemento.type + " "                                 + currentMemento.environment);                         utility.executeCommand(currentMemento.nickname, command);                         userIsDone = true;                         states.clear();                         nextMemento = new Memento.Builder(first(), currentMemento,                                 selection).build();                     } else if (state.equals(STATES.KEYWORD)) {                         nextMemento = new Memento.Builder(next(state),                                 currentMemento, selection).build();                         states.clear();                         nextMemento = new Memento.Builder(first(), currentMemento,                                 selection).build();                     } else {                              redoInput = true;                         System.out.println("give it another try");                         continue;                     }                     break;                 }                      if (userIsDone) {                          // start the recurring menu over from the beginning                          for (int i = 0; i < states.size(); i++) {                         if (i != 0) {                             states.remove(i); // remove all except first                         }                     }                     reader = new Scanner(System.in);                     this.state = new State();                     userIsDone = false;                 }                      if (!redoInput) {                     this.state.restoreMemento(nextMemento);                     states.add(this.state);                 }             }         }     }


Two contradicting definitions of Interface Segregation Principle – which one is correct?

When reading articles on ISP, there seem to be two contradicting definitions of ISP: According to first definition ( see 1, 2, 3), ISP states that classes implementing the interface shouldn't be forced to implement functionalities which they don't need. Thus, fat interface `IFat`               interface IFat     {          void A();          void B();          void C();          void D();     }          class MyClass: IFat     { ... }      should be split into smaller interfaces `ISmall_1` and `ISmall_2`               interface ISmall_1     {          void A();          void B();     }          interface ISmall_2     {          void C();          void D();     }          class MyClass:ISmall_2     { ... }      since this way my `MyClass` is able to implement only the methods it needs ( `D()` and `C()` ), without being forced to also provide dummy implementations for `A()`, `B()` and `C()`: But according to the second definition ( see 1 , 2, answer by Nazar Merza), ISP states that `MyClient` calling methods on `MyService` shouldn't be aware of methods on `MyService` that it doesn't need. In other words, if `MyClient` only needs the functionality of `C()` and `D()`, then instead of               class MyService      {         public void A();         public void B();         public void C();         public void D();     }          /*client code*/           MyService service = ...;     service.C();      service.D();      we should segregate `MyService's` methods into _client-specific_ interfaces:               public interface ISmall_1     {          void A();          void B();     }          public interface ISmall_2     {          void C();          void D();     }          class MyService:ISmall_1, ISmall_2      { ... }          /*client code*/     ISmall_2 service = ...;     service.C();      service.D();      Thus with the former definition, the goal of ISP is to " _make the life of classes implementing IFat interface easier_ ", while with the latter the goal of ISP is to " _make the life of clients calling methods of MyService easier_ ". Which of the two different definitions of ISP is actually correct? **@MARJAN VENEMA** **1.** > So when you are going to split IFat into smaller interface, which methods > end up in which ISmallinterface should be decided based on how cohesive the > members are. While it makes sense to put cohesive methods within the same interface, I thought with ISP pattern the needs of the client take precedence over the "cohesiveness" of an interface. In other words, I thought with ISP we should lump within the same interface those methods needed by particular clients, even if that means leaving out of that interface those methods that should, for the sake of cohesiveness, also be put inside that same interface? Thus, if there were lots of clients that will only ever needed to call `CutGreens`, but not also `GrillMeat`, then to adhere to ISP pattern we should only put `CutGreens` inside `ICook`, but not also `GrillMeat`, even though the two methods are highly cohesive?! **2.** > I think that your confusion stems from the a hidden assumption in the first > definition: that the implementing classes are already following the single > responsibility principle. By "implementing classes not following SRP" are you referring to those classes that implement `IFat` or to classes that implement `ISmall_1` / `ISmall_2`? I assume you're referring to classes that implement `IFat`? If so, why do you assume they don't already follow SRP? thanks


How long for a java developer to be able to start programming in C#?

I am working on a project that will be acquiring four new Java developers (mid-to-senior level). They will be responsible for writing code for web services and an event-driven UI. This is a .NET project using C# and WPF. We have ten weeks to create a substantial amount of new functionality. Project management has called our time line "aggressive but achievable." The new developers have limited to no experience in .NET. Assuming the new developers are very-talented, how many weeks before they can begin contributing to the project? Or are we doomed? I realize I'm giving very few details, but I would welcome even the roughest of estimates.


How do you phrase “it's open source, submit a patch” so that it's friendly?

In the answers of _What's the canonical retort to "it's open source, submit a patch"?_, many people voiced the opinion that simply asking people to submit a patch is arrogant and rude. But it seems to me that as a developer on any open source project, you will see many more feature requests on the mailing list than you could possibly implement. So when a user says, "I would like to see feature X", the truth of the matter is usually that the chances of it getting implemented are pretty slim unless they submit a patch themselves. Also, sometimes a little encouragement might be all that's needed to turn a user into a contributor. On the other hand, you don't want to scare (potential) contributors away by coming off as rude. So how would you say "please submit patches instead of asking for features" in a friendly manner? **Update:** Thanks for all the suggestions! I see most of them require pretty lengthy explanations. But since I'd rather avoid either (a) explaining the same thing every other day (it just takes too much time), or (b) using snippets that I paste into email (it gets impersonal real quick), I wonder: Has anyone written this up in a document that I can link to? (Project-specific things like how to write tests, compile the code, and submit the patch still need to be documented of course, but I think those technical issues should go into CONTRIBUTING.txt anyway.)


Need help with algorithm for sorting list

The answer is probably obvious but not to me at this moment, so I was wondering if somebody who is better with sorting algorithms can help lead me in the right direction. This is not homework, I am legitimately trying to work within an existing design for something work related. Essentially I start with an unordered list of data objects that represent something similar to forum comments. These objects MAY explicitly have one and only one direct parent. In other words > Parent (1...*) ----------- (1...1) Child A child has a reference to its parent, however a parent cannot see its children (explicitly). Typically when sorting a list one would pass a comparator which given any two data objects in the collection should return an integer number that represents the distance between the two objects in a graph. The distance between two completely unrelated comments will be based on the Timestamp value of the data object. The issue is that any two data objects can and should only be compared by timestamp with other data objects from the same parent branch. Here is an example: > DO1 - Time(1000ms) > > |___DO3 - Time(5000ms) > > DO2 - Time(2000ms) DO1 and DO2 compared will result in a negative number so those two are sorted correctly relative to each other. DO3 to DO1 is likewise correct because I can assume that any branch above a comment must be less than. The problem comes with comparing DO3 to DO2. I thought that I should compare the highest order parent to DO2 in this case and that works until there are DO children under DO3. I am trying to figure out if the current object graph is even enough information for a comparator to correctly return an appropriate number for any two comparisons. Perhaps the comparator needs to be initialized with the unordered list first so that it can build a tree structure where I can see a list of children from any given parent explicitly? Or perhaps I need to refactor? At this stage I am not concerned about performance. Thank you.


Should a programmer worry about the technology stack of the shop?

This question might only be applicable to entry/junior level positions. Question:   * Let's say you're a Java/Open Source developer. Should you consider positions where the technology stack of the shop is C++/.NET?   * Lets assume that the shop is interested in hiring you because they are impressed by your strong algorithmic skills. And the fact that you are a Java programmer does not matter to them at all. The question is - Should this be an issue that should bother an entry/junior level developer? Should the applicant then make an acceptance decision based on other criteria such as the domain that one would be working on? Perks? Salary? Career growth? etc.?


Alternative IDEs

After seeing http://www.kickstarter.com/projects/ibdknox/light-table I'm wondering if anyone has come across other alternative methods of developing. When working on embedded things Notepad++ was ample, which isn't necessarily an IDE but it is a different way of handling things from using Xcode, Visual Studio, or Eclipse. And even JDeveloper follows the same design as those. As OS X and other OSes change, along with website methodologies, app structures, frameworks, can we start changing how we develop? I've also seen quite a few "code on your iPad" apps. Will we eventually move away from coding as we know it? Will there be a split? Can something like Light Table bring even low level C++ coding into the next generation of enterprise or embedded level development? Especially since I feel like a small minority who even takes advantage of some non-default IDE settings such as custom syntax coloring (once you go Zenburn you don't go back)


How to determine the priority and severity of a "code improvement"?

We have "priority" and "severity" fields in our bug tracking system. We define severity as "how it impacts the user" and priority as "how it impacts the product". My question is about how to categorize a "code improvement" task in severity and priority. Suppose the improvement does not change any behavior but makes it a "better code". We anticipate a long term maintenance improvement overall but it's hard to quantify. When we use our definitions for priority and severity, a code improvement gets the lowest values for both unless you introduce some hard to predict long term benefits into the picture. Therefore it implies that code improvement is a frivilous task and should never be attempted. However I believe it's cruical to constantly improve and refactor the code, because:   * Software development is itself a continuous learning process and without improving the code you can't get better at it.   * A team should be proud of their code.   * Future maintenance will take less time and over the long run savings will be significant. Or do you think such tasks should never be created and such improvements performed only "on demand", "when associated with a bug"? Even if it's associated with a bug, wouldn't that be a discussion point on a code review, e.g. "why did you do this drastic change in structure?".


Why is it unrealistic to expect all browsers to support the same standards?

Ideally, we would have different browsers supporting the same standards and same code producing the same result on all browsers. That hasn't happened yet. What are the reasons why?


Which spoken languages should I try to support in my android application?

I'm developing a small android app, which is regional independent. I'm curious, which language should I try to support? At the moment I'm only sure to support the languages I speak fluently. This is German and English. But what about French, Spanish or Japanese...? Are there any statistics out there to help determine which to support? P.S.: Should I use maybe crappy automatic translation, if I don't know a native speaker, or should I forget about it otherwise?


How to deal with necessary workarounds in software?

Even with detailed specifications for exchanging data between computer programs, chances are that data generated by older versions of programs do not conform 100% to the specification, or that they use old obscure features which few people know how to implement them. As a result, companies have to keep a library of "odd specimens" for testing their software. In good software design, these quirks can be confined into a small layer of libraries called "Abstraction Layer". However, most abstraction layers cut off too many functionalities (in order to prevent the higher level software from touching the unstable parts of the lower level software). Sometimes it is not possible to completely hide away the unstable parts. What are the strategies for coping with such necessary workarounds? _((Please pardon my poor language skills.)_


Is converting/casting a boolean to int a good idea?

**Note:** Even though this contains Python, it's not specifically about Python. It's more generally about expecting a certain behaviour from a language which is not necessarily the same across compilers/interpreters. * * * So I came across this question: > How do I convert a boolean to int in Python? Can I just do `int(mybool)`? My response was to write:               1 if mybool else 0      My reasoning was that blindly "casting" to `int` would rely on the internal implementation of the compiler/interpreter. And who knows, if running through a different interpreter `int(mybool)` might return something else. Explicitly stating the value for a "truthy" value and for a "falsey" value will always yield the expected behaviour. This is surely something which one can consider for most languages. Am I too picky about this? I know that I have written `int(mybool)` myself in the past. And that question made me think: Was that okay? Given that this is a very common case, are the compilers/interpreters smart enough to to "the right thing" for bool -> int conversions? Now, for the special case for duck-typing languages like Python, `int(mybool)` might certainly be a really bad idea, but other languages are a bit clearer on their typing.


Is there a good way to communicate the intent that a class only contains referentially transparent methods?

My workplace mostly uses C# for writing code. I'm trying to figure out a good way to indicate that a class with referentially transparent methods is intended to be referentially transparent (i.e., given the same set of arguments, you will always get the same return value) for future maintainers. I've considered just using static classes for classes that are intended to only contain referentially transparent methods but received pushback from my colleagues as they prefer an approach to unit testing where all classes depending on are stubbed out which they use constructor DI to accomplish. I don't see a disadvantage to not stubbing out referentially transparent functions for unit testing since they are almost always in-memory anyway but I've been unable to convince my colleagues of that. Our class names use typical OO pattern names like DTO or Factory or Controllers and Models for namespaces. I'm not aware of any pattern names in OO that would indicate the sort of intent I am going for (i.e., to not introduce side-effecting operations or depending on things that read out of the db or filesystem).


Syncing objects to a remote server, and caching on local storage

What's the best method of sycing objects (as JSON) to a remote server, with local caching? I have some objects that will pretty much just be plain-text with some extra meta-data. I was thinking of perhaps including a "last modified date" for both Local storage and Remote storage. This could then be used to determine which object is the most recent. For example, even though objects will be saved to both local and remote when they are saved, sometimes the user may not have internet access, or the server may be down, or any other number of things. In this case, the last modified date for remote storage would be reverted to its previous date. Local storage would remain as it is. At this point, the user could exit the application, and when they reload the application would then look at the last modified dates of the local and remote storages, and decide. Is there anything I'm missing with this? Is there a better method that I could use?


How important is using the same language for client and server?

I have been evaluating architecture solutions for a mobile project that will have a web-service/app in addition to native apps and have been looking at various libraries, frameworks, and stacks like Meteor, this being a sort of "open stack package framework", is tightly bound with Node.js. There is a lot of talk about the benefits of using the same language both client and server side, and I'm not getting it. I could understand if you want to mirror the entire state of a web application on both client and server but struggling to find other wins... Workflow efficiency? I'm trying to understand why client/server language parity is considered to be a holy grail. Why does client/server language parity matter in software development?


Contradiction of layered design and global data access for analytics reporting

While developing an application (mobile app for Android), our team always strives to use best development practices such as interfaces, layering and separation of concerns. When it comes to reporting analytics events from our app, the requirements sometimes force us to send events with data that is stored and managed by multiple different app "components". Some of this data is not directly available at the component/layer that does the reporting, **nor at any central location** in the application. To me, this seems like it contradicts all the efforts of architecture and design that were made during the development of the application. **My question is** : What is the correct way to deal with this issue? Is the problem in the requirements we received, or is it a common issue that a layered/modular application sometimes needs to make things "global" ? if so, what is the way to solve this issue while still reaping the benefits of development best practices?


How to deal with or survive with the information overload

I will better explain my question. I have been struggling with this for long time Everytime i want to read something for e,g book on java , then i find so much stuff like many tutorials , many ebooks that i am not able to decide which one to choose. I spend some time reading one , then 2 and so on and in the end i leave and gain nothing. I like the old days when we had only few resources like one hard book and at least i finish that from start to finish and gained much but now days there is so much information that mind jumps from one source to other and gain nothing what should i do


Why multiple calls to same classes' Constructor from within a Constructor wouldn't work?

Please have a look at following snippet:               public class Foo {     int digit;     String name;          Foo (int d, String n) {         this(d);         // cannot do following.         //compile-time error: Constructor call must be first statement in a Constructor          //this(n);     }          Foo (int p) {         digit = p;     }          Foo (String q) {         name = q;     }      What would be the reason of this restriction? I understand why call to Constructor (both in a Constructor or in a method) has to be first statement - the object should be initialized properly before it is used. What I don't get is compiler not allowing calling multiple constructors of the same class from within a constructor. I don't see any problem with this construct - both regarding initialization and invarients. It'd be great if someone can shed some light on what I am missing here... Thanks!


1. How to explain DependencyProperty using real world analogy?   2. Why is it needed?


When creating an library published on CodePlex, how "bad" would it be for the unit-test projects to rely on commercial products?

I have started a project on CodePlex for a WebDAV server implementation for .NET, so that I can host a WebDAV server in my own programs. This is both a learning/research project (WebDAV + server portion) as well as a project I think I can have much fun with, both in terms of making it and using it. However, I see a need to do mocking of types here in order to unit-testing properly. For instance, I will be relying on HttpListener for the web server portion of the WebDAV server, and since this type has no interface, and is sealed, I cannot easily make mocks or stubs out of it. Unless I use something like TypeMock. So if I used TypeMock in the unit-test projects on this library, how bad would this be for potential users? The projects are made in C# 3.5 for .NET 3.5 and 4.0, and the project files was created with Visual Studio 2010 Professional. The actual class libraries you would end up referencing in your software would of course not be encumbered with anything remotely like this, only the unit- test libraries. What's your thoughts on this? As an example, I have in my old code-base, which is private, the ability to just initiate a WebDAV server with just this:               var server = new WebDAVServer();      This constructs, and owns, a HttpListener instance internally, and I would like to verify through unit-tests that if I dispose of this server object, the internal listener is disposed of. If, on the other hand, I use the overload where I hand it a listener object, this object should not be disposed of. Short of exposing the internal listener object to the outside world, something I'm a bit loath to do, how can I in a good way ensure that the object was disposed of? With TypeMock I can mock away parts of this object even though it isn't accessed through interfaces. The alternative would be for me to wrap everything in wrapper classes, where I have complete control.


Cloning of website

I'm a freelancer in a freelance job site and I started the work with a client in a project with a contract on this freelance job site. Until now all is OK.Firstly I started but developpement of some issues and I guessed he want relooking a site already exist on line,today in the next task of job I found that the client wants to clone the site from another one not relooking and he is not the admin of the site to clone. He will provide me a different template (not the same logo and color) but with the content about the same. My questions are:   * If this method of cloning is illegal, will it be his responsibility to deal with the legal issues? Maybe I'll create for him just the server side code. Will that mean I'll have any responsibility if the admin of the other site asks him about the copyright violation?   * Can I do this in a painless way? I'll make him the code, and when the contract is done, will it be OK for him to launch the site by his own name and domain? Please I make some modifications,can I have a serious answer and please reply just if you are sure and maybe you had the same issue...


Should I refactor large functions that mostly consist of one regex?

I just wrote a function that spans approximately 100 lines. Hearing that, you are probably tempted to tell me about single responsibilities and urge me to refactor. This is my gut instinct as well, but here is the issue: The function _does_ one thing. It performs a complex string manipulation, and the function body consists mostly of one verbose regex, broken up into many lines that are documented. If I broke up the regex into multiple functions, I feel like I would actually _lose_ readability, since I am effectively switching languages, and won't be able to take advantage of some features regexes offer. Here now is my question: **When it comes to string manipulation with regular expressions, are large function bodies still an anti-pattern?** It seems like named capture groups serve a very similar purpose to functions. By the way, I have tests for every flow through the regex.


What's the best way to hold features in a database?

taking for example an application that holds **Companies** and as we move along time, more and more features are needed. I do tend to hold everything in the `Companies` table, but I rather get some input as I'm starting a new project and was wondering if I should keep those in a `CompanyFeatures` table: ![enter image description here](http://i.stack.imgur.com/4qCrV.png) Should I have 2 tables, or this flow is enough? I have the same for users, each user has it's own on/off feature (when a feature can be user specific), should I continue to keep them there, or should also create a `UserFeatures` table to hold such information? Every time I get a company, all of their associated features information needs to be "glued", but it's an easy join and the query will be cached for the next request... Querying the DB should never be a problem, my question is more about design patterns and if such information should have it's place.


Is it possible to build a single game to run in Facebook & Google+?

I was asked by my customer to build a Facebook game. The game would be something similar to Mafiawars.com where the game is hosted on a server and run through a frame on Facebook. The thing is after several days of negotiations with the customer and near the finalization of the requirements he mentioned something strange. He said that if the game was successful on Facebook then we may add it to Google+ too. I thought he meant that we'll develop a new version for Google+, but he refused as he argued that the game should be able to support both sites and he won't pay for the same game twice. Now I haven't developed neither Facebook nor Google+ games before, so I don't know if it is possible to build a single Facebook/Google+ game.   How would you react to such requirement? How would you design such an application? **Notes**   1. I confirmed with the customer that he wasn't talking about using Open ID he wanted full integration (sharing post, friend requests,..etc.)   2. I really don't want to lose that customer for numerous reasons (He even agreed to extend the project time to compensate for the time I need to learn Facebook/Google+ APIs)


When to use Interface variable = new class variable OOP

I saw often people use this code like               interface IAnimal      {         void die();     }          class Cat : IAnimal      {         void die() { ... }         void meow() { ... }     }          IAnimal anAnimal = new Cat();     Cat aCat= new Cat();      C# knows for sure anAnimal.die() works, because die() is defined in IAnimal. But it won't let you do anAnimal.meow() even though it's a Cat, whereas aCat can invoke both methods. Why and when we should write this kind of code:               IAnimal anAnimal = new Cat();      What is the advantage?


Using a GPLv3 Python module, will my entire project have to be GPLv3 licensed?

I'm working on a small project right now that I plan on releasing under an open-source license (haven't decided which yet). The question I have is that one of the Python modules I use is licensed under GPLv3. Since I'm not making any modifications to the library (using it as-is), can I still license my project under a license of my choosing or will I be forced to also make it GPLv3?


How to measure the success of a small software project?

I'm part of a 7 person software development team which supports a company with a few thousand staff. Our team is putting together a quick review process for measuring the success of a software project. Projects are mostly internal, which means our "customers" are more often than not other staff. Projects are reasonably small (generally 100 to 1000 hours). Our review process will need to have a few aspects to it, probably including:   * A questionnaire sent to the customers (filled in by people in a variety of roles if possible, such as managers who may not be users of the software, and users), looking at the ease of use, quality of documentation, incident response, value for money, reliability.   * Cost compared with the budget. Estimated development time compared with actual time would be looked at here too.   * Security, if applicable.   * Maintainability, such as how easy it is to log in as a particular user to replicate problems, and how easy the code is to follow.   * Technical documentation, such as instructions on setting up development environments and test data. Is there anything glaring I've missed, or anything that should have a particularly strong (or weak) focus?


Why do Core Data sqlite table columns start with 'Z'?

I was looking at the sqlite table that Core Data generates and noticed that all table columns start with 'Z'. I realize this is an implementation detail, but I was curious as to why that's the case and if there was a design decision involved in this. Anyone happen to know or guess why? Here's a sample schema output of Core Data sqlite database:               sqlite> .schema     CREATE TABLE ZPOST ( Z_PK INTEGER PRIMARY KEY, Z_ENT INTEGER, Z_OPT INTEGER, ZPOSTID INTEGER, ZUSER INTEGER, ZCREATEDAT TIMESTAMP, ZTEXT VARCHAR );     CREATE TABLE ZUSER ( Z_PK INTEGER PRIMARY KEY, Z_ENT INTEGER, Z_OPT INTEGER, ZUSERID INTEGER, ZAVATARIMAGEURLSTRING VARCHAR, ZUSERNAME VARCHAR );     CREATE TABLE Z_METADATA (Z_VERSION INTEGER PRIMARY KEY, Z_UUID VARCHAR(255), Z_PLIST BLOB);     CREATE TABLE Z_PRIMARYKEY (Z_ENT INTEGER PRIMARY KEY, Z_NAME VARCHAR, Z_SUPER INTEGER, Z_MAX INTEGER);


Which Web API routing attribute style is preferred?

You can do it this way:               [Route("api/DeliveryItems/{ID:int}/{CountToFetch:int}")]      ...calling it like so:               http://localhost:28642/api/deliveryitems/N/N      ...which has the benefit of the routing attribute documenting exactly which args the methods needs. Or you can do it this way:               [Route("api/DeliveryItems")]      ...calling it like so:               http://localhost:28642/api/deliveryitems?ID=N&CountToFetch=N      ...which has the benefit of having a clear "separation of concerns" (or perhaps "separation of context" or "separation of intent"), so that path info is one thing, args are another, and never do the twain meet (in the routing attribute string, at any rate). Any powerful reasons to opt for one style over the other?


Does the GPL allow anyone to obtain GPL software without paying for it?

I've spotted a nice WordPress (GPL) theme for sale. I know somebody who bought it. I have 2 questions:   1. Has the company selling it the obligation to send the source code to whoever (customers or not) ask it?   2. Can the person who bought it give me a copy for free which I could use in production?


Ways of Gathering Event Information From the Internet

What are the best ways of gathering information on events (any type) from the internet ? Keeping in mind that different websites will present information in different ways. I was thinking 'smart' web crawlers, but that can turn out to be extremely challenging, simply because of the hugely varied ways that different sites present their information. Then I was thinking of sifting through the official twitter feeds of organisations, people with knowledge of events .. etc and look for the event hash tag, grab the tweet and dissect it to grab the relevant information about the event. Information I am interested in gathering is: **Date** and **Time** of Event, **Address** where Event is being held, and any **Celebrities (or any famous people) attending** the event (if any). The reason to ask here is my hope that experienced folk will open my eyes to things I've missed, which I am sure I have.


Is there a limit on the number of threads that can be spawned simultaneously?

Yesterday I came across this question: How can i call robocopy within a python script to bulk copy multiple folders?, and I though it might be a good exercise for multithreading. I though of spawning as many threads as files needed to be copied, each routine having an exception handling system to prevent the whole copying process from crashing (and log -using mutex on the log file - if there was an error). My question: **Is there a limit on the number of thread you can spawn almost simultaneously? If yes, what is the limiting factor?** My question is focused on PC desktop, but I welcome any answer on different hardware (embedded systems, calculus clusters, etc.).


What is the order analysis of the following (using a list of primes)

I have the following program: Iterate `x` from 1 to `N`. Check to see if `x` is prime. If it is, add it to a list of primes. The way I check to see if it is prime is iterating through the current list of primes, and seeing if they can divide `x` evenly. What is the order analysis of this program? I don't think it is `O(n^2)`, because the growing list of primes certainly doesn't increase at the rate of `n`. I don't it is `O(nlog(n))`, either. How would I perform order analysis of the function?


What is the difference between functional relational programming and functional programming?

After reading both this thread and the linked paper, I don't understand how FRP (functional relational programming) is different from (FP) functional programming. Does FRP augment or replace FP? Can FRP be implemented as a library in an FP language?


Is comparing an OO compiler to a SQL compiler/optimizer valid?

I'm now doing a lot of SQL development at my new job where as before I was doing Object Oriented desktop app stuff. I keep running across very large scripts (thousands of lines) and wanting to refactor in some way. I am seeing that SQL is a different sort of beast and it's probably fine to have these big scripts for the most part but while explaining this to me people are also insisting that the whole _idea_ of refactoring is bad. That stuff like the .NET compiler are actually burdened by refactored code and that a big wall of code is more efficient and better design than code designed for reuse, readability and scalability. The other argument is that OO compilers are almost dangerously inefficient and don't have efficient memory management or runs too many CPU instructions compared to older "simpler" compilers and compared to SQL. Are these valid complaints? Even _if_ some compiler like a C compiler is modestly more "efficient" (whatever that means on this high of a level without seeing code) would you want to write applications in C over C# or Java? Is comparing an OO compiler to a SQL compiler/optimizer even valid?


Do software developers know what engineers actually do?

Software development is often contrasted with the traditional branches of engineering, most commonly civil or mechanical engineering. For example:   * "Software development isn't like engineering, it's like craftsmanship!"   * "Software development isn't like engineering, but it should be!" Do software developers understand what it is that engineers do and how they do it? At least, do they understand it well enough to be able to make an informed comparison with what software developers do?


Is it normal for a company to have programmers on such a rigid schedule?

So I've been working at this job for a couple of months. I'm a little frustrated because I do my best work from 2 to 7. In previous jobs, I've come in at 9:30-10:00 and leave at 7. Some companies have been okay with this, others have not. But my current company insists on my being there at 8:30. Any deviation from this is a big deal. Is this typical? I have colleagues who are more 9:30 to 6:30, 10:00-7:00 guys...but maybe that is just startup culture? I don't see why, given that I don't meet clients, etc. what the advantage to having things be so rigid could be. I also don't see why if there is 15 to 20 minute variation sometimes in coming in, why people don't just assume that I will adjust when I leave... Are these unreasonable expectations as a developer or am I missing something?


Authentication with If/Else

For keeping the "Administration Panel" secure to those who are logged in, for my web application, is the best practice to use an If/Else Statement?               if($_SESSION['logged_in'] == true) {        include '../styles/templates/admincp/header.php';        include '../styles/templates/admincp/content.php';        include '../styles/templates/admincp/footer.php';     }     else {        include '../styles/templates/login.php';     }      Is this how the "professionals' (such as CMS creators, etc) do this authentication style? OR is there a completely better route and method to the If/Else statement to authenticate pages for logged in users to access?