Should I choose Doctrine 2 or Propel 1.5/1.6, and why?

I'd like to hear from those who have used Doctrine 2 (or later) and Propel 1.5 (or later). Most comparisons between these two object relational mappers are based on old versions -- Doctrine 1 versus Propel 1.3/1.4, and both ORMs went through significant redesigns in their recent revisions. For example, most of the criticism of Propel seems to center around the "ModelName **Peer** " classes, which are deprecated in 1.5 in any case. Here's what I've accumulated so far (And I've tried to make this list as balanced as possible...):   * Propel      * Pros        * Extremely IDE friendly, because actual code is generated, instead of relying on PHP magic methods. This means IDE features like code completion are actually helpful.       * Fast (In terms of database usage -- no runtime introspection is done on the database)       * Clean migration between schema versions (at least in the 1.6 beta)       * Can generate PHP 5.3 models (i.e. namespaces)       * Easy to chain a lot of things into a single database query with things like `useXxx` methods. (See the "code completion" video above)     * Cons        * Requires an extra build step, namely building the model classes.       * Generated code needs rebuilt whenever Propel version is changed, a setting is changed, or the schema changes. ~~This might be unintuitive to some and custom methods applied to the model are lost. (I think?)~~ \-- Not true; custom methods aren't lost because the generated class is a base class; Propel provides an entity class specifically for extension.       * Some useful features (i.e. version behavior, schema migrations) are in beta status.   * Doctrine      * Pros        * More popular       * Doctrine Query Language can express potentially more complicated relationships between data than easily possible with Propel's ActiveRecord strategy.       * Easier to add reusable behaviors when compared with Propel.       * DocBlock based commenting for building the schema is embedded in the actual PHP instead of a separate XML file.       * Uses PHP 5.3 Namespaces everywhere     * Cons        * Requires learning an entirely new programming language (Doctrine Query Language)       * Implemented in terms of "magic methods" in several places, making IDE autocomplete worthless.       * Requires database introspection and thus is slightly slower than Propel by default; caching can remove this but the caching adds considerable complexity.       * Fewer behaviors are included in the core codebase. Several features Propel provides out of the box (such as Nested Set) are available only through extensions.       * Freakin' HUGE :) This I have gleaned though only through reading the documentation available for both tools -- I've not actually built anything yet. I'd like to hear from those who have used both tools though, to share their experience on pros/cons of each library, and what their recommendation is at this point :)


flat files vs. RDBMS database, few read/writes, few changes

I have to handle data from long term (years, decades) climate monitoring stations. The data flow usually starts with raw data (voltages, etc.) plus quality check information (pressure, temperature, flow rate, etc.) generally recorded @ 1Hz. Then, the data are assigned a quality flag (human and/or program), processed (apply calibration curves) and flagged. So, we basically end up with 2 datasets : raw and processed data. New data are typically added once a day (~500Ko/day/instrument). Simultaneous queries are not likely to ever happen. I wanted to go for a RDBMS (we have a MySQL server) and have some experience in database design, but the IT guy keeps telling me that flat files will to the job just as well. I suspect him to try to make his life easier when it comes to backup/upgrade the MySQL. There are not so many links between data, they don't change much, but the quality flags will change. A RDBMS is easier to compare data from different instruments on a "many days" scale, compared to daily text files. Well, what would you advise ? Thanks.


how to work with people who thinks procedurally in an object oriented project

I'm working on a project which heavily uses OOP Design principles. But, one of my colleague tends to do everything in procedure oriented manner. I gets irritated by seeing procedure oriented code wrapped in a class and lose my temper. But, losing temper won't make anything better. I need some ideas, advices and tips on how to make people think in terms of objects.


Refactoring an existing abstract class and its parameters

I have an `abstract class A` which declares an abstract method `doStuff`. Currently there are many classes that inherit from `A` and implement `doStuff`. The class' instances are initialized at run-time via `AFactory` based on user input. Originally all the classes had the same single parameter (the user input). But now I have an additional parameter that only a new class that inherits `A` needs. So breaking it down I though of the following logic:   * The interpreter class that generates instances based on user input(using `AFactory` of course) was not aware of this extra parameter.     * Trying to push it into the class interpreter class would be really awkward because then I would have to know when to pass it to the factory which defeats the whole purpose of having a factory in the first place.     * Sending it blindly into the Factory hoping it _might_ do something with it seems quite ugly as well.   * **My current solution:** Meanwhile I've decided to refactor `A.doStuff(Param param)` into `A.doStuff(AParams params)`. `AParams` can hold what ever parameters needed and `doStuff` can ignore then if they're not interested in them. This also seems a bit awkward to me , and remids me of sending structs in WIN32API that can hold a lot of ugly useless parameters and I'm not fond of it. Is there a more elegant way to approach this problem ? Or some design pattern that I've overlooked and solves this? **Notes** :   * We're using Java 1.7   * The class' names are silly in order to emphasize the theoretical design issue they do have normal indicative, meaningful names in reality :)   * I did search quite a lot but having figured out that it's quite hard to search the web for specific abstract theoretical issues (as opposed to why is `X` throwing `Exception` in this code) I've decided to ask anyway so I'm sorry if this is a duplicate. **Edit 1** :   * **Clarification:** I need to pass a subclass-specific argument to the `doStuff` method. **EDIT 2** :   * I did not fully understand Kilian Foth's intention so I've written some Java-pseudo-code to help me better explain the problem/understand your solution. So: This is a skeleton of my problem. This is a skeleton of my solution. This is what I _think_ might be Kilian Foth's solution, but I'm not sure.


why getMonth() starts with 0

I was coding a function to remove a day from a date value in javascript and i was kind of surprise that javascript's getMonth() starts from 0 for January to 11 for December. Why javascript's getMonth() starts with 0?


Is there a way to get the version of Ubuntu that Google uses for development? Even better would be a full up VMWare or Virtual Box Virtual Machine image that might include a full complement of preinstalled tools as well.


Class Design and Separation Of Concerns

I'm working on an MVC application and am wondering about the best way to design one of my models. I have a class called RightLeftPersonToggle which represents two select list boxes on the page. The user is able to move "persons" between the left and right box using buttons between them. This class can represent both a vehicle driver or manager so the load and save code is different for each type. The class is below.               public class RightLeftPersonToggle     {         public RightLeftPersonToggle()         {             LeftList = new List<Person>();             RightList = new List<Person>();         }              public List<Person> LeftList { get; set; }         public List<Person> RightList { get; set; }         public string LeftListTitle { get; set; }         public string RightListTitle { get; set; }         public string PropertyName { get; set; }     }      I'm wondering what the best way to handle the loading and saving of the lists is. I've come up with two solutions but I'm not sure on which one is best. 1) The controller (or parent model) is responsible for loading and saving both LeftList and RightList. The RightLeftPersonToggle class has no knowledge of that code and remains exactly like the code above. 2) RightLeftPersonToggle gets two methods (one for save and one for load) which take functions as parameters to tell it how to do its job.               public void LoadAndFilterLists(Func<List<Person>> leftListFilter, Func<List<Person>> rightListFilter)          public void LoadSaveLists(Func<List<Person>> leftListSave, Func<List<Person>> rightListSave)      Solution number one keeps the code more simple in my opinion while solution number two seems to provide better sepration of concerns since RightLeftPersonToggle should know how to load and save itself. Keeping in mind the fact that RightLeftPersonToggle doesn't always load and save data the same way, which of my proposed solutions would be considered best practice? Do you have any other recommendations for improvement?


Implementing unit testing at a company that doesn't do it

My company's head of software development just "resigned" (i.e. fired) and we are now looking into improving the development practices at our company. We want to implement unit testing in all software created from here on out. Feedback from the developers is this:   * We know testing is valuable   * But, you are always changing the specs so it'd be a waste of time   * And, your deadlines are so tight we don't have enough time to test anyway Feedback from the CEO is this:   * I would like our company to have automated testing, but I don't know how to make it happen   * We don't have time to write large specification documents How do developers get the specs now? Word of mouth or PowerPoint slide. Obviously, that's a big problem. My suggestion is this:   * Let's also give the developers a set of test data and unit tests   * That's the spec. It's up to management to be clear and quantitative about what it wants.   * The developers can put it whatever other functionality they feel is needed and it need not be covered by tests Well, if you've ever been in a company that was in this situation, how did you solve the problem? Does this approach seem reasonable?


is there any elegant way to analyze an engineer's process?

Plenty of sentiment exists that measuring commits is inappropriate. Has any study been done that tries to draw in more sources than commits - such as:   * browsing patterns   * IDE work (pre-commit)   * idle time   * multitasking I can't think of an easy way to do these measures, but I wonder if any study has been done. * * * On a personal note, I do believe that reflection on one's own 'metrics' could be valuable regardless of (or in the absence of) using these for performance eval. I.E. an un-biased way to reflect on your habits. But this is a discussion matter beyond Q&A.


Design patterns frequently seen in embedded systems programming

I don't have any question related to coding. My concerns are about embedded systems programming independent of any particular programming language. Because I am new in the realm of embedded programming, I would quite appreciate responses from those who consider themselves experienced embedded systems programmers. I basically have 2 questions.   1. Of the design patterns listed below are there any seen frequently in embedded systems programming?      * Abstraction-Occurrence pattern     * General Hierarchy pattern     * Player-Role pattern     * Singleton pattern     * Observer pattern     * Delegation pattern     * Adapter pattern     * Facade pattern     * Immutable pattern     * Read-Only Interface pattern     * Proxy pattern   2. As an experienced embedded developer, what design patterns have you, as an individual, come across? There is no need to describe the details. Only the pattern names would suffice. Please share your own experience. I believe the answers to the above questions would work as a good starting point for any novice programmers in the embedded world.


using blocking APIs with non-blocking server

We are using Tornado for our system (behind nginx) -- and everything is working fine. Now we need to integrate a client lib (for Neo4j Graph DB) into our system. The problem is that it is blocking. My question is:   * is it OK to use blocking libs in non-blocking environment   * what are the possible ramifications if we do so   * how much work is involved if we decide to roll our own async lib I know there is Node that does everything in non-blocking fashion. But we can't go there because our core is written in Python.


Commit whole project or commit files?

I used to commit files which I want to group. But one of my colleague said that committing whole working project is better than committing files. I think it makes sense but if I commit like that sometimes I have to commit several different works at once. What is the best practice to commit?


What is a good way to learn about multicore programming at the kernel level in Linux?

I am interested in multicore programming at the kernel level. I expect this affects many areas and is probably different for each architecture. What are some must read sections of the kernel? If I wanted to compare and contrast code for an Intel I7 and an ARM Cortex-A9 MPCore where would I find the differences?


Mirror virtualized development environment

I work alone in some iOS projects in a local environment. I have been thinking in a way to be able to share my development environment between my Mac Mini and my MacBook. I mostly work at home in the Mini but sometimes I need to do a demo or work outside and I would like to have the development environment mirrored in both. I have think in using a virtual machine (via VirtualBox) with just my development tools installed. Then I could synchronize that VM with some software between both computers so I will always have the exact environment no matter what computer I use. Is there any good reason not do do this way? I have not used virtualization too much so I have no background on the subject. ¿What about licenses?¿Is there need to have duplicated licenses in both VMs? This are my requirements: -Don't need to setup two environments. Just setup one and have the job done in the other(installing or updating apps, change settings, etc). -Don't depend on having a connection when working away from my home. My basic setup will be:   * Mac Mini: i7 dual Core, 8Gb. OSX Mountain Lion Host OS:   * MacBook: 2.4 Core 2 Duo. 4Gb. OSX Lion Host OS.   * Virtual Box with Mountain Lion guest OS in both machines.   * XCode5, Simulator, Texwrangler, MAMP, etc.


Mac or Linux for a secondary work machine?

I am a freelance web developer geared towards Ruby on Rails. The main components of my current working environment are a 27" **iMac** , **Textmate** and **git** /github (which is not going to change any time soon). What I am looking for is a nice little/portable laptop that will allow me to make a quick `get-in/fix-something/test/push/get-out` dance when not at home (home is where I work from). I am fairly familiar with Linux and Vim and I think I can easily work with both environments (OSX and Linux). Granted that the laptop will only be used occasionally and in a hurry, **is there something I should be worried about when working with OSX and Linux at the same time?** (mind you that the laptop will solely be used for work and thus there is no requirement for it to be able to manage my photo library) **Anyone had an experience with a relevant setup?** * * * **EDIT:** I would like to stress it a little more since some answers have diverged from it. **What I am looking for is help for a secondary machine for RoR, not a primary one** Thus:   * battery life is not an issue - I believe 2-3 hours is all I'm going to require of it, so the clear Mac hardware advantage evaporates   * I'm not compiling any code - no fast CPU needed (I'm not really familiar with what is needed for compiling)


System that splits passwords across two servers

I stumbled upon this news article on BBC,   * RSA splits passwords in two to foil hackers' attacks **tl;dr** \- a (randomized) password is split in half and is stored across two separate servers, to foil hackers that gained access to either server upon a security breach. Now the main question is, how would this kind of system would be made... _codespeaking_ , for PHP which I commonly develop on my web applications, the database password is normally stored in a configuration file, i.e. config.php with the username and password, in that case it is understandable that the passwords can be stolen if the security was compromised. However when splitting and sending the other half to the other server, how would this go on when making a communication to the other server (keeping in mind with PHP) since the other server password would be stored in a configuration file, wouldn't it? In terms of security is to keep the other server password away from the main one, just exactly how would the main server communicate, without exposing any other password, apart from the first server. This certainly makes me think...


C++ : Lack of Standardization at the Binary Level

Why ISO/ANSI didn't standardize C++ at the binary level? There are many portability issues with C++, which is only because of lack of it's standardization at the binary level. Don Box writes, (quoting from his book Essential COM, chapter _COM As A Better C++_ ) > # C++ and Portability > >   >  Once the decision is made to distribute a C++ class as a DLL, one is faced > with one of **the fundamental weaknesses of C++** , that is, **lack of > standardization at the binary level**. Although the ISO/ANSI C++ Draft > Working Paper attempts to codify which programs will compile and what the > semantic effects of running them will be, it makes no attempt to standardize > the binary runtime model of C++. The first time this problem will become > evident is when a client tries to link against the FastString DLL's import > library from a C++ developement environment _other than_ the one used to > build the FastString DLL. Are there more benefits Or loss of this lack of binary standardization?


License of current JDK

I am wondering which license the current JDK 7 ( **NOT** the OpenJDK) is using as I know it was once under GNU GPL but with the change of the Distributor License for Java I would like to know whether they changed the allover license, too.


What do you do when you encounter an idiotic interview question?

I was interviewing with a "too proud of my java skills"-looking person.   1. He asked me " _What is your knowledge on Java IO classes.. say.. hash maps?_ "   2. He asked me to write a piece of java code on paper - instantiate a class and call one of the instance's methods. When I was done, he said my program wouldn't run. After 5 minutes of serious thinking, I gave up and asked why. He said I didn't write a main function so it wouldn't run. ON PAPER.   3. [I am too furious to continue with the stupidity...] Believe me it wasn't trick questions or a psychic or anger management evaluation thing. I can tell from his face, he was proud of these questions. That " _developer_ " was supposed to " _judge_ " the candidates. I can think of several things:   1. Hit him with a chair (which I so desperately wanted to) and walk out.   2. Simply walk out.   3. Ridicule him saying he didn't make sense.   4. Politely let him know that he didn't make sense and go on to try and answer the questions.   5. Don't tell him anything, but simply go on to try and answer the questions. So far, I have tried just 4 and 5. It hasn't helped. Unfortunately many candidates seem to do the same and remain polite but this lets these kind of "developers" just keep ascending up the corporate ladder, gradually getting the capacity to pi** off more and more people. **How do you handle these interviewers without bursting your veins? What is the proper way to handle this, yet maintain your reputation if other potential employers were to ever get to know what happened here? Is there anything you can do or should you even try to _fix_ this?** **P.S.** Let me admit that my anger has been amplified many times by the facts:   1. He was smiling like you wouldn't believe.   2. I got so many (20 or so) calls from that company the day before, asking me to come to the interview, that I couldn't do any work that day.   3. I wasted a paid day off.


OpenGL programming vs Blender Software, which is better for custom video creation?

I am learning OpenGL API bit by bit and also develop my own C++ framework library for effectively using them. Recently came across Blender software which is used for graphics creation and is in turn written in OpenGL itself. For my part time hobby of graphics learning, I want to just create small-small movie or video segments; e.g. related to construction engineering, epic stories and so on. There may be very minimal to nil mouse-keyboard interaction for those videos, unlike video games which are highly interactive. I was wondering if learning OpenGL from scratch is worth for it or should I invest my time in learning Blender software? There are quite a few good movie examples are created using Blender and are shown in its website.   Other such opensource cross platform alternatives are also welcome, which can serve my aforementioned purpose.


Is having two conditions in an IF statement faster than having two separate IF statements?

I just wonder if having two conditions in an IF statement executes faster than having it separated into two like these: ### Single Statement, two conditions               if ( (conditionA == true) && (conditionB == true) )       //Do something;      ### Two statements               if ( conditionA == true )       if ( conditionB == true )         //Do something      Or are they just the same when compiled? Both of them have the same code, only the `if` statement part is different. There won't be any other code under `conditionA` in the second example (two statements), only afer `conditionB`. Does this have an effect on PHP and JavaScript?


Are operators just "special" methods?

Here's what is meant by operators and methods. Attempting to keep the questions as simple and open ended as possible, since the question is more about the conceptual nature of operators and methods NOT how a language has decided to implement them. **Proof of Concept:** This example in Ruby is more of a proof of concept than anything else. EXAMPLE: In Ruby, "`1+2`" is equivalent to "`1.+(2)`", meaning the object "1" implements a method called "+" with object "2" as the method's argument.


What is the best way to generate an accurate release changelog?

I'm working on some projects where I'd like to supply an accurate changelog with each release, but I haven't found a method for collecting the changelog that would work without hassle. The problem is mostly when the time between versions is long and each version ships with a lot of features and bug fixes, and when the software has several branches being developed at the same time. Some options I've considered:   1. Build the changelog from commit messages and require developers to write the messages as if they would be writing a line for the changelog (which they would effectively be doing).      * Might not work when there are multiple branches and merging between branches (might be hard to know which commits have ultimately ended up in the release).   2. Require that for each change in the code there should be a corresponding ticket in the bug tracking system. The changelog could be written based on the tickets.      * The devs might find it frustrating to make a ticket for even minor changes, especially if making the ticket takes longer than fixing the bug.   3. Require that the developers always update the changelog (as a text file in project root) at the same time when they make changes to the code.      * Feels like manual labor that could be automated.   4. Have the project manager take the diff of the current version and the previous one and write the changelog at that point based on what they see that's been changed.      * Extra work for the person responsible for the release and it might not be obvious what the practical effect of a change is just by looking at the code.   5. Ship only the features that have been planned for the release; you can write the changelog even before you start coding.      * Not a real option unless you're using the waterfall model. I've used each of these or a variation of them in the past but they have been too unreliable, laborous or rigid. Does anyone have a magic bullet or good ideas on how to solve the problem?


How important is to initialize a variable

How important is it to initialize variables? Does proper initializing avoid memory leaks or have performance advantages?


Sublinear Extra Space MergeSort

I am reviewing basic algorithms from a book called Algorithms by Robert Sedgewick, and I came across a problem in MergeSort that I am, sad to say, having difficulty solving. The problem is below: > _Sublinear Extra Space_. Develop a merge implementation that reduces that > extra space requirement to max(M, N/M), based on the following idea: Divide > the array into N/M blocks of size M (for simplicity in this description, > assume that N is a multiple of M). Then, (i) considering the blocks as items > with their first key as the sort key, sort them using selection sort; and > (ii) run through the array merging the first block with the second, then the > second block with the third, and so forth. The problem I have with the problem is that based on the idea Sedgewick recommends, the following set of arrays will not be sorted: {0, 10, 12}, {3, 9, 11}, {5, 8, 13}. The algorithm I use is the following:   1. Divide the full array into subarrays of size M.   2. Run Selection Sort on each of the subarrays.   3. Merge each of the subarrays using the method Sedgwick recommends in (ii). (This is where I encounter the problem of where to store the results after the merge.) This leads to wanting to increase the size of the auxiliary space needed to handle at least two subarrays at a time (for merging), but based on the specifications of the problem, that is not allowed. I have also considered using the original array as space for one subarray and using the auxiliary space for the second subarray. However, I can't envision a solution that does not end up overwriting the entries of the first subarray. Any ideas on other ways this can be done? **NOTE:** If this is suppose to be on StackOverflow.com, please let me know how I can move it. I posted here because the question was academic.


What is thread safety?

What is it? I was reading Effective STL and came across it. I have also Googled it, but couldn't get any helpful info.


Reverse a queue using an extra queue

You are given 2 queues, Q1 and Q2. Q1 is already filled with n elements. Q2 is empty You have to reverse all the elements in Q1. You cannot use any other space apart from Q2. only operations permitted would be Q.enqueue() and Q.dequeue() Time complexity - O(nlogn) i found this question on a less popular website. http://www.questiondiscussion.com/questions/64/questiondiscussionchallenge- reverse-a-queue-using-an-extra-queue few answers are also there. i am not able to understand the solutions, can anyone help me with is question ?


"Immutable" interfaces

I am confused about the notion of immutability. Consider the following structure of a simplistic calculator: ![Class diagram](http://i.stack.imgur.com/uKV21.jpg) Here are the interfaces:               interface IOperationalInterface {         int Sum(int a, int b);     }          interface IAuditInterface {         int SumInvocations();     }      `IOperationalInterface.Sum` should compute the sum of two integers and `IAuditInterface.SumInvocations` should return the total number of received `Sum` calls. Here is a trivial implementation:               class CalculatorImpl : IOperationalInterface, IAuditInterface {         private int invocations = 0;              public int Sum(int a, int b) {             invocations++;             return a + b;         }              public int SumInvocations() {             return invocations;         }     }      Is `CalculatorImpl` immutable? Obviously not, because its state changes with each invocation of the `Sum` method. Is the `Sum` operation pure? According to Wikipedia it is not, since it changes the state of a mutable object, and that side-effect is observable through the `IAuditInterface`. Obviously the `SumInvocations` operation is also not pure, since it may return different results. In summary, `CalculatorImpl` is mutable and all of its methods are impure. However, from the viewpoint of `CalculatorClient`, who talks to it only through the `IOperationalInterface`, it appears to be immutable and the `Sum` operation appears to be pure in the sense that it could not observe any side effects _through that interface_. On the other hand, from the perspective of `AuditClient`, it is completely different: it is obvious that the object implementing the `AuditInterface` is mutable and its `SumInvocations` operation is impure, and _this follows directly from the specification of the`IAuditInterface`_. So, it is possible to partition an interface/specification of a mutable class such that some parts of it will appear mutable and some not. In this case, considering only the `Sum` operation and leaving out the requirement that the invocations should be counted, we get something that does not have any side- effects. Now, on implementing the `CalculatorClient` one can take into account the fact that the object behind the interface _appears_ to be immutable. At least one could not tell the difference. So my question is: does it make sense to talk about "immutability" of interfaces or is it a bad idea? How else can I communicate the fact that there will be no observable side-effects through that interface? And if it's bad, what could go wrong? **UPDATE** Thanks for your answers/comments! I see now that there is no way to say that the `IOperationalInterface` is pure; the conditions of purity are much too strong to apply in this case. However the question remains whether there is a weaker notion (maybe "immutability"?) which is applicable.


Is object oriented programming ALWAYS a good way for large projects?

Is object oriented programming always the good way for all types of projects? Is this methodology the best suited for large projects like compilers, interpreters and other large systems? Most of the compilers are written in C so I can't see any compilers written in the object oriented method. I think OOP benefits the most in places like LOB, simulations where you can consider everything as an object. But is it really useful in all places? Also OOP can lead to inefficient code than procedural code. Not to mention that design patterns sometimes increase the complexity of design.


Is storing types in the database an anti pattern?

A little background on where this question is coming from. In my current .NET application I'm working on some features related to archiving a certain type of business entity called a "Project". Depending on the situation what has to be archived, and the exact actions involved in archiving can vary wildly. My basic idea is to create an entity called an ArchiveSchedule which basically stores data saying this kind of project should be archived after this amount of time. I want to encapsulate my queries for selecting all the objects to archive and the commands for actually archiving off into their own objects that inherit from some common interfaces. There will be multiple archive queries(select items based on various properties, or whether they've been archived before and later restored, etc), and multiple archive commands(ie commands that send data to different interfaces, some that perform deletes, etc.). What I'm considering doing is including on the ArchiveSchedule, references to the actual .NET type corresponding to the query and command I want to use for this schedule. Then when I want to actually run the queries and commands I use reflection to build up the object and execute the command or query. Is this basic strategy of storing type information in the database and then using reflection to create the objects and inject dependencies an antipattern? Or is there a better way to do it? Note:I know there are some issues with just storing the type name or namespace, because those might change during refactoring, but I believe those could be mitigated fairly easily using a GuidAttribute on the class definition and storing the guid instead, so I'm curious if there are more fundamental issues beyond that.


Functional Reactive/Relational Programming – Is there a difference?

I've been using Reactive Cocoa (by GitHub), a Functional _Reactive_ Programming API for use with the Cocoa libraries for a while now, but have just read "Out of the Tar Pit", the paper that supposedly presents the concepts behind it, and I am a little confused. The paper presents (as I understand it) Functional _Relational_ Programming, where relations between data are created with conditions that should be enforced by the FRP system to reduce the amount of 'accidental' logic and state needed. My question is, are these two concepts - FR(eactive)P and FR(elational)P essentially the same thing (with the former just being an implementation of the latter) or is there a core difference between the two? Unfortunately at the moment my knowledge of the area isn't good enough for me to differentiate them enough. If there is a difference, it appears to be something to do with, as the name suggests, reacting to changes in data. Certainly, Reactive Cocoa (and Rx in C#) have the concept of creating _signals_ which are triggered on changes in data, and can be used to continuously modify a value over time. Is this the difference? If not, what is? (Please excuse the poor tagging, I can't find relevant tags and can't create them yet - please update the tags to something more appropriate if you can.)


A simple algorithm for finding duplicate floats

We have N numbers(real numbers(float)).They can be positive or negative or anything we do not know except the fact that there is exactly one number which has a duplicate and the rest all are distinct. I would like to know the fastest one to find the duplicates.Can anyone help ? Thanks


What the white box testers create test cases against?

I'm wondering, what are the white box testers using to create test cases? The actual code? Some kind of diagrams? I mean, if I am given a task to create test cases for complete branch coverage, is it possible they give me a code? Because I saw something like that:               Reader r=null;     if(condition)     {       r=new Reader();     }     r.toString();      There is an obvious bug as the last statement should be in the body of the If statement. It will be easily exposed by false-decision test case of the condition. But is it not more like unit tests? What is then the white box testers goal of testing? Wikipedia article on white-box testing states: > The tester chooses inputs to exercise paths through the code and determine > the appropriate outputs. I understand this as you choose inputs to reach the coverage and reveal possible bugs. But isn't it simple unit testing done by developers?


Can unlimited number of vacation means the same as 0 vacation time in practice?

Programmers sometimes get a little burned out and a little vacation can help. It used to be many hi-tech companies give 10 vacation days and 10 sick days per year. But in recent years, I have seen vacation and sick days combined to become Paid Time Off (PTO). Each year may be 15 days or 12 days. (plus 1 floating and 9 fixed holidays such as Thanksgiving, Xmas, and New Year day) ( **Update** : California doesn't not require any sick day for any company at all, so companies, to stay competitive, may not want to have sicks days and end up losing to other companies) And then I know some companies have unlimited vacation time, such as Netflix or Zynga, but then an experienced programmer told me many VPs in hi-tech companies also have unlimited vacation, but because they are so busy, practically in a year, they don't take any vacation at all. It is also a bit strange that if unlimited is the policy, then what if Peter wants Dec 1 to Jan 1 for Xmas vacation, and John wants Nov 20 to Jan 1? How do people decide what is fair if they can decide the length when it is unlimited? It resembles a little bit like program such as FTP, where if the bandwidth is set to 300k/s, then it is 300k/s, but when it is set to 0, that means it is unlimited. So "unlimited" in this case is also the same as "zero". I'd like to find out how it is in different companies? Is your company or your post or what you hear about unlimited vacation and how it is like in real practice?


Simple real-world PHP OOP example?

I'm trying to learn PHP OOP, but when I've followed tutorials, all the examples seem to involve things like:               class Human {         $_sex;              public function setSex($sex) {             $this->_sex = $sex;         }              public function getSex() {             return $this->sex;         }     }      (Pointless example, but hopefully you get what I mean -- An object has properties that are stored in the object.) I've never come across a web application where I've needed to create objects about humans, dogs, cars, or any of the other weird examples you find when reading tutorials about OOP... So I'm trying to find a similarly simple, but more realistic, project with which to learn OOP. I've chosen a website for an internet comic (e.g. XKCD.com). (This would allow people to view the comic, but also the author to edit and update it.) So how would this translate to real-world PHP OOP? My initial instinct would be to break the objects down thusly:   * Catalogue    * Episode  Where the `Catalogue` class would contain methods pertaining to all the episodes of the comic, e.g. `getMostRecentEpisodeID()`, `deleteEpisode($episodeID)`, `addNewEpisode($newEpisode)`, etc. etc. And `Episode` would contain methods pertaining to the individual episode, e.g. `getEpisodeComments($episodeID)` (if the website allowed people to leave comments on individual episodes), `editEpisode($episodeID)`, `getEpisode($episodeID)`, etc. Is this right, or have I made an absolute hash of what OOP is for? **Edit:** Rather than just giving me a list of examples, it would really be helpful if your answer made specific reference to the problem I'm trying to solve. Thanks.


Why database as queue so bad?

I've just read this article, and I'm confused. Let's imagine 1 webapp and 1 distinct application acting as "worker", both **sharing the same database**. Oh, I said "sharing"..but what does the article warns about? : > Fourthly, sharing a database between applications (or services) is a bad > thing. It’s just too tempting to put amorphous shared state in there and > before you know it you’ll have a hugely coupled monster. => disagree. There are some cases where distinct applications still be part of the same unit, and therefore, notion of "coupling issue" makes no sense in this case. Let's continue: The webapp handles client HTTP requests and may update at any time some aggregates (DDD term), generating the corresponding domain events.   The goal of the worker would be to handle those domain events by processing the needed jobs. The point is: **How should events data be passed to the worker?** The first solution, as the read article promotes, would be to use RabbitMQ, being a great message-oriented middleware. The workflow would be simple: Any time the web dyno generates an event, it publishes it through RabbitMQ, which feeds the worker.   The drawback would be that nothing guarantees the **immediate consistency** between the commit of the aggregate update and the publishing of the event, without dealing with the potential sending failures... or hardware issues; that is another main issue. Example: It would be possible that an event was published without a success of the aggregate update...resulting in an event representing a false representation of the domain model.   You could argue that global XA (two-phase commit) exists, but it's not a solution that fits all databases or middlewares. So what could be a good solution to ensure this immediate consistency? :   IMO, storing the event in database, in the same local transaction than the aggregate update.   A simple asynchronous scheduler would be created and responsible of querying current unpublished events from database and send them to RabbitMQ, which in turn populates the worker. But why needing an extra scheduler in webapp side and by the way: why needing RabbitMQ in this case?? By this solution, it appears logically, that the RabbitMQ could be unnecessary, especially because the database is shared.   Indeed, whatever the case, we saw that the immediate consistency **involves** a polling from database.   Thus, why wouldn't worker be responsible directly for this polling? Therefore, I wonder why so many articles on the web criticizes hardly database queuing, while promoting message-oriented middleware. Excerpt of the article: > Simple, use the right tool for the job: this scenario is crying out for a > messaging system. It solves all the problems described above; no more > polling, efficient message delivery, no need to clear completed messages > from queues, and no shared state. **And immediate consistency, ignored ???** To sum up, it really seems that whatever the case is, meaning database shared or not, we need **database polling**. Did I miss some critical notions? Thanks


Biggest obstacles to working on a group project

I'm doing my first group project in a class where most quarters 40% of the students have failed. I believe the reason for this is the poor quality of teaching in the class. For example, the instructor did not know that scriplets in JSP was bad practice. (I learned JSP this week and I know that.) He didn't know that Swing GUIs were supposed to go on the EDT. He didn't know that static imports were bad practice. I could go on. The project is to design a web application for a quiz website. There is a lot of extra credit available, and it is possible to get 200%. This is my first group project. I am worried about the failure of most of my peers, and I want to avoid it. **What obstacles might I face when working on a project like this and how can I overcome them?**


How to stop / avoid Over Time on a Scrum Team?

Actually, I'm helping a small software shop on their Scrum Implementation. Recently the Scrum Master reported me that he has a problem because the Team is working **Over Time** to achieve the Scope (Committed Backlog). So they have an **Unreal Velocity**. My formal question(s) is / are:   1. Apart from speaking about on the Retrospective Meeting; do you think that is a good idea to implement some hard-blocks to avoid Over Time?   2. If so, what techniques / tools do you suggest?      * Revision Control system (SVN, GIT, HG, etc...), blocks by hours (8 to 5)     * Work station blocks by hours (8 to 5) or cumulative hours (up to 8 hrs/day)?     * Other(s)...   3. Or, maybe, do not hard-block this kind of things; but implement some **"Penalty System"** for **Unjustified Extra Hours**? * * * First: Tks all for your fast responses. @Baqueta (and others with similar questions): No they are not been paid for Extra Hours. My first advise to them was to review their estimates because _maybe_ they were underestimating. This was my favorite advise: > **If they have an interest in working overtime, remove it.** Development > isn't something you can do for 60 hours a week and stay productive, and > there are numerous studies out there that prove this. If overtime pay is the > issue, get rid of it and improve their base pay so they're getting what > they're worth. Also, I think that the root problem (for this team), is a combination of the following: >   1. The developers are being told what they must achieve in a sprint/aren't > being consulted on what's achievable/are being ignored when they say there's > too much work. >   2. The developers are consistently underestimating how much time tasks > will take/how many units of work are involved in each task. > **Summary:** I'll talk to the Team to review their estimates, and with the P.O. because I feel that _they are not being consulted_ about the scope, as you mentioned.


What units are story points estimated in?

I am reading about a case study about a team that estimates tasks or "story points" as they call them based on the effort needed to complete them. What the units are these "story points" estimated in? I believe this notion of "story points" stems from a process called "agile development."


Prepare source code handover plan

Our company is about to acquire a source code of a huge product. What are thing to take into consideration when the handover starts, to make sure we have everything and be capable to maintain that product in the future?


How do companies keep websites hidden when in development?

I am new to this and also a new 19 year old PHP developer that just got hired so I am unsure as to how this works. Many companies when developing their websites keep their sites hidden from being indexed. What are some ways html5/css and then php/mysql work is hidden from search engines? If I am not wrong, these are the techniques:   1. Offline development: using local storage to render html/css; not sure how PHP/mysql would work with that.    2. Using .htaccess to prevent access   3. Using VPN to prevent access.


Would working for an "adult website" hurt my future employability?

I am considering taking a software engineering job at a pornographic website. While I have no moral objections to the industry, will it be a red flag on my resume?


When to deprecate and when to delete in Java

As part of a refactoring effort or just ongoing development, a particular method or maybe an entire class may become obsolete in some sense. Java supports the `@Deprecated` annotation to indicate that there's probably a better way to handle the functionality in question. I imagine this is particularly useful in public API's where the effects of removing parts of an API might not be known. For a non-public API and a project that uses revision control systems (so deleting can be undone in some sense), when is it appropriate to deprecate rather than deleting the obsolete element(s)?


Separating words in a string

How do I separate words in a string? In the following I have a random sample of words in a string extracted from text file with over a million words. Here's the string: "intervene Pockets Jerusalemand tissues powerful days gadgets rate invention heated Stewartis find communal working lots internal They caused noise offer goand big jumps lose galaxies All Mall birth child world spin killed produced great center Dont pretend Africa solution times cursor good night professional problem refugees talk" As you can see, the third word is "Jerusalemand." My goal is to separate "Jerusalem" and "and", and do the same thing for any other words that are stuck together. Only thing that I could think of as of now is to compare every word in the string to a dictionary (SCOWL perhaps?), and if a segment of the word matches a word in the dictionary, I'll have to split the words to make them independent. As an example, for "Jerusalemand" I'll loop through every character until a match is found in the dictionary for "Jerusalem," then I can separate that from "and," in turn completing the separation. Shouldn't there be a better way to do this?


Virtualized Development Environments in Enterprise Networks

We are attempting to implement a development environment using virtualization for a small team of 4 developers within an enterprise organization. This would allow us to set up separate development, testing, and staging environments - as well as allowing access to new operating systems that are requirements for systems or tools we are evaluating. We re-purposed an existing workstation- class machine, threw in 24GB RAM and RAID-10, and were doing fine until we attempted to get the machine added to the domain. Now we are beginning the war that all enterprise developers since the beginning of time have had to fight - the fight for local control of a development and testing environment. The network and IT admins' have raised concerns ranging from "ESX Server is the enterprise standard" to "servers are not allowed on client VLANs" to "[fill-in-the-blank] is not a skill set currently possessed in the local or enterprise IT organization". We could justify production-class hardware and formal IT support if we had to, but it would take time and involve a whole lot of headache. Even then it might take months to formally get IT resources assigned by treating this as a production system - and even if we did, we would likely lose the local control we need. I imagine that many of you have had similar struggles over developer control of non-production environments - and virtualization in particular - so my questions are as follows:   1. What strategies and arguments have helped you win over the infrastructure (IT & Network) folks to allow these types of silos to exist within enterprises which have standard network and security policies in place that would generally (and understandably) preclude this type of non-(centrally)-managed infrastructure?   2. Have you found this to be a matter of technical justification - or more of a political struggle for control and ownership?   3. If you ended up with a IT-managed development environment, how much of a roadblock has it been for day-to-day development and testing?   4. Has anyone ended up moving their development environment to a disconnected VLAN or entirely separate network to avoid these network access struggles? Also, this is not a Hyper-V vs. ESX holy war (we would be fine with either - but Hyper-V was selected since it is "free" with MSDN for these purposes [yes, VMWare has free tools too - but the good management tools generally aren't], and would be easier to manage by the local developers in a "Microsoft Shop") - so arguments for or against either are outside the scope of this question. This is also less of a virtualization vs. physical hardware - I suppose the same question could be asked without the virtualization component to the equation. Also assume that the dev team has already made assurances to either manage patch management and antivirus, or integrate with the existing enterprise systems if they will support it. This scenario, with different questions, is also posted on SF to hopefully elicit the opposing viewpoint.


How do I start correctly in building database classes in c#?

I am new in C# programming and in OOP. I need to dive into web applications for my company, and I need to do it fast and correct. So even that I know ASP.NET MVC is the way to go, I want to start with some simple applications with ASP.NET Webforms and then advance to MVC logic. Also regarding my db classes: I plan to create common database classes in order to be able to use them either from WinForms or ASP.NET applications. I also know that the way to go is to learn about ORM and EF. BUT I also want to start from where I am feeling comfortable and that is the traditional ADO.NET way. So about my Data Access Layer classes:   * Should I return my results in datasets or arraylists/lists?   * Should my methods do their own connect/disconnect from the db, or have separate methods and let the application maintain the connection?


Implementing FUSE for deduplication

I am new to FUSE and using python-fuse for writing a file system for data deduplication. Let's say, I have a directory named "metadata" and in that directory, there is a file foo and a directory "data". Data contains a data chunks having unique names. These chunks are obtained from the process of data deduplication. foo contains a list of filenames present in data directory. I am taking a metadata directory and exposing it under the mountpoint drive. Till now, I have implemented a `readdir()` method such that If ls command is invoked on a drive, it would only display foo. Now I want to do a following thing. When foo file is read, it should display all the data(combined) from every file whose name is in foo. How do I implement a `read()` method? I have the following idea: Method has the signature `def read(self, path, length, offset, fh)`.               Open a file and read the list.          initialize empty buffer.          For everyItem in list append the content of file named everyItem to the buffer          return buffer      Am I going in right direction? As I want to write a read only fuse, is implementing only `read()` method sufficient?


Access JSON object in different Languages

I have a Java code which is writing some data in string format to Messaging queue. Now any one can subscribe to this queue and fetch this data. Here the client fetching this data can be written in any programming language. I was planning to expose this data in JSON format, but then as per my understanding I have to expose my Bean Object, as the Object is needed to parse this JSON string. And in this case I am limiting client to be Java only. I don't want to have any of such a limitations, so now I am looking to expose this data as XML. Any other way so that I can still use JSON here?


How to combine search words? AND or OR?

I have a basic search in my webpage. When I designed it, I chose to combine the search box inputs with OR. For example: A search for `foo bar` will be translated to `foo OR bar`, so every entry which includes foo or bar will be shown. I did this because I thought that a search should return as much as possible and leave it to the user to search with AND (a search for `foo and bar` will return only the entries that contain both). When the customer tested it, he tried a lot to search for 'foo bar' and wasn't able to find the right entry because the search returned to much. It seems confusing to him that a search for `foo bar` could return entries where one of the search inputs is included and not both. What is the best way to combine search words (when the user doesn't provide any combining info)? Should I use `foo AND bar` or `foo OR bar`?


Algorithm to arrange objects so that the total length of edges between them is minimized?

We are given a list of edges between a set of N vertices. There are atmost three edges joining a vertex. We have to arrange all the vertices on a straight line with the positions numbered from 1 to N so that the sum of the length of all the edges is minimized.   The length of an edge a,b is the difference between the positions of vertices 'a' and 'b' on the line. There are atmost 12 vertices. The algorithm should work within the time limit of 1 second. This is the actual problem. I have tried solving this problem by trying all the permutations and finding out the total cost of each edge. But this work only for 8 out of the 12 test- cases to the problem. Because in the worst case the total number of operations is proportional to 12! * 18. The size of N is very small so I think the solution might be similar to trying all the possibilities.   I don't need the complete solution to this problem because I want to try to come up with it myself but only a hint on how can I optimize my algorithm so that it works within the time limit. Thanks.


Can I deploy a Google App Engine application to my own server?

I am getting started in web application development and am considering using Google App Engine. It's great that I can deploy the web app to the Google servers, but is that my only option? Can I use an authentication system different than the Google services?


Employer admits that its developers are underpaid and undervalued. Time to part ways?

My employer recently posted an opening for a C# Developer with 3-5 years of experience. The requirements and expectations for the position were fair, up until the criteria for salary determination. It was stated clearly that compensation would depend ONLY on experience with C#, and that years of programming experience with other languages & frameworks would be considered irrelevant and not factored in. I brought up my concern with HR that good candidates would see this as a red flag and steer away. I attempted to explain that software development is about much more than specific languages, and that paying someone for their experience in a single language is a very shortsighted approach to hiring good developers (I'm telling this to the HR dept of a software company). The response: "We are tired of wasting time interviewing developers who expect 'big salaries' because they have lots of additional programming experience in languages other than what we require." The #1 issue here is that 'big salaries' = Market Rate. After some serious discussion, they essentially admitted that nobody at the company is paid near market rate for their skills, and there's nothing that can be done about it. The C-suite has the mentality that employees should only be paid for skills proven over years under their watch. Entry-level developers are picked up for less than $38K and may reach 50K after 3 years, which I'm assuming is around what they plan on offering candidates for the C# position. Another interesting discovery (not as relevant) - people 'promoted' to higher responsibilities do not get raises. The 'promotion' is considered an adjustment of the individuals' roles to better suit their 'strengths', which is what they're already being paid for. After hearing these hard truths straight from HR, I would assume that most people who are looking out for themselves would quickly begin searching for a new employer that has a better idea of what they're doing in the industry (this company fails in many other ways, but I don't want to write a book). Here is my dilemma however: This is the first official software development position I've held, for barely 1 year now. My previous position of 3 years was with a very small company where I performed many duties, among them software development (not in my official job description, but I tried very hard to make it so). I've identified local openings that I'm currently qualified for, most paying at least 50% more than I'm getting now. Question is, is it too soon for a jump? I am getting valuable experience in my current position, with no shortage of exciting projects. The work environment is very comfortable, and I'm told by many that I'm in the spotlight of the C-level guys for the stuff that I've been able to accomplish during my short time (for what that's worth). However, there is a clear opportunity cost to staying, knowing now with certainty that I will have to wait 3-5 years only to be capped at what I could potentially be earning elsewhere this year. I am also aware that 'job hopper' is a dangerous label to have, regardless of the reasons. UPDATE: I've just accepted an offer at another company, paying significantly more and with even cooler projects. Thanks to all for the insightful responses.


Is it customary to write Java domain objects / data transfer objects with public member variables on mobile platforms?

We performed a code review recently of mobile application Java code that was developed by an outside contractor and noticed that all of the domain objects / data transfer objects are written in this style:               public class Category {         public String name;         public int id;         public String description;         public int parentId;     }          public class EmergencyContact {         public long id;         public RelationshipType relationshipType;         public String medicalProviderType;         public Contact contact;         public String otherPhone;         public String notes;         public PersonName personName;     }      Of course, these members are then accessed directly everywhere else in the code. When we asked about this, the developers told us that this is a customary performance enhancement design pattern that is used on mobile platforms, because mobile devices are resource-limited environments. It doesn't seem to make sense; accessing private members via public getters/setters doesn't seem like it could add much overhead. And the added benefits of encapsulation seem to outweigh the benefits of this coding style. Is this generally true? Is this something that is normally done on mobile platforms for the reasons given above? All feedback welcome and appreciated -


Is ASP.NET MVC slow as compared to traditional approach?

I create three folders in the Project Explorer of any IDE that I use. I name them: App Layer, Business Layer and Data Layer. The App Layer holds all the UI stuff, the Business Layer holds all the classes dealing with business logic and the Data Layer holds the classes for DB connectivity and queries. I am new to MVC pattern and when I attempted it on VS2010 with ASP.NET, I found it far more complicated with all sorts of nested folders created. I was already separating the logic and the UI in my old style. What differed in the MVC is that you can use Routing to directly call methods via URL (Correct me if I am wrong), but in that case I assume the performance of the MVC application slows down. It is just an overhead to call a method via URL and than the method queries the DB. Isn't the performance of ASP.NET MVC a bit slow? Even though manageability is good but the learning curve is also very steep?


Should I strictly follow every single HTML and CSS Standard?

A few years ago I considered myself somewhat of a web developer, knowing the basic 3 languages (HTML, CSS, JS) and lots of PHP. Moving on from simple text to actual websites was a pain because of the so called "standards" out there, which at the time were ridiculously complicated for me. It pretty much boiled down to this (minus the IE related stuff): ![Web development in a pie chart](http://i.stack.imgur.com/aVD7a.gif) Standards are there to replace old ways of doing things in a simpler way. However when trying to actually implement some of the stuff (Entirely CSS based layout for example), it took me 10x longer to actually do it then if I did the simpler and still working solution. If it rendered the same, then why should I use the more complicated example that takes 10x longer and breaks once you change browsers? This sparked many long religious debates in ##php, ##css, and ##js in Freenode IRC and actually got me banned from ##css because I messed with their little world over there. My question: Should I follow every single standard and coding conventions even if they take me 10x longer but get me the same result as the simple one? * * * For the poll tag, those of you who have websites of any size (huge or small), do **you** follow all the standards?


How do I give a free copy of my iPhone app?

I'm just about done writing an iPhone application and submit it to the App Store for approval. I'm going to sell the app for a price, but I'd like to be able to give out a few free copies on occasion, kind of like a promotional offer. I know when you go to one particular coffee establishment, they have gift cards available to feature various artists. You type in a code and it immediately "purchases" and downloads the song for you. I'd like to be able to do something similar to this for my own app. Is this possible?


Dynamic programming algorithm for finding minimum spanning tree

I know cool greedy algorithm like brokuva, kruskal and prim's exists for finding minimum spanning tree but I am curious to know a dynamic programming algorithm for finding minimum spanning tree.I am not able to come up with such an algorithm. If someone already have it please let me know the explanation for your algorithm along with the code.Or can anyone argue the other way round why no such dynamic programming algorithm cannot exist.


How does accumulating large amounts of business logic on the model objects make building strong service contracts harder?

I heard a couple of times that putting business logic in database models is bad down the road. I just read this in blog of a Rackspace employee: _The Django ORM also tended to have us accumulate large amounts of business logic on the model objects, which made building strong service contracts even harder._ But it seems logical to me that if you have an `Invoice` model to encapsulate a lot of invoicing logic there. Seems very similar to what we've been taught in OOP. Could you show me how this is wrong? Please include a practical example if possible. **Benefit of "put logic in models"** What I see as a big benefit of putting logic in models is that users of the models don't have to worry about how they can use stuff, they just use it and it works, can't break anything. Let me elaborate with an example: So if you don't put logic in models, then you probably have this code elsewhere, let's say it's in `api`. If you want to change a state of an `Invoice`, what do you do? Do you do `invoice.state = new_state` or do you read the `api` code to see if there's some method there that changes the state? This is confusing and error prone. How do you fix this issue then?


How to organize a larger project with several sub-projects and their dependencies?

As a software developer until now, I've mostly worked on projects that were quite "monolithic" with hardly any dependencies on other projects, without building automation (no Make, Ant, Maven, etc.) and kept on a simple version control system (mostly Subversion) with just a few easily managed version branches. Now together with some friends I'm planning a project that is intended to run on multiple platforms (mostly mobile: Android, iOS, Kindle, Windows, etc.), thus written in several languages and on different development platforms. This will lead to many dependencies: All projects sharing the same resources (e.g. images) or projects dependent on each other (e.g. a core Java library project used by the Android and other Java based implementations). So what I need is some basic information on how to answer questions such as: How would the VCS be structured? Would a client-base or a decentralized VCS be better? How to decide building automation system(s) to use? Since this quite an open question I guess for now it would be great if you could point me to any books or web resources that you can recommend for this topic.


Requirment Analysis Communication

Someday s ago we was discussing about the current project, and suddenly sir and my senior started talking about the new feature to add in the project , and i become lost :). i was not able to find how i should provide my input for the new feature. So i want to know what things should be discussed for developing new feature in project and how we can contribute in requirement talk of new features. Please suggest.


Are there drawbacks to taking a job where I will be using a unique programming language?

I just graduated from college with a degree in CS, so I would like to find a job where I can learn more about the field and build up some professional experience. I've interviewed at a company that uses their own in-house programming language, and I don't think any others use it. They have not mentioned using any other languages or what they use for a development environment. What should I be concerned by taking a job like this? If I were to switch jobs later, would I have to start looking for entry level positions again because I haven't gained any language-specific experience?


Store history in SQL database column

We have a database that stores the process/history of particular machines. What I mean by that is that we have "started", "updating", "shutdown", and so on for all the computers in the company. The requirement is to have the history available in the right order. Simple enough. My approach was to have a simple database table like this:               counter  | machine | time | process | ...      1       | PC1     | ...  | started       2       | PC2     | ...  | updating      1       | PC1     | ...  | updating      The query will be very simple because I can simply sort by the counter. My colleagues suggested a very different approach. My gut feeling says it is wrong but I don't have enough arguments against it. Can you help define what is wrong with it? Instead of using multiple rows for the process of a machine, they want to write them sequentlly into the same field. Same goes for the time field. Their main arguement is that we save storage               counter  | machine | time        | process | ...      1       | PC1     | ... ... ... | started updating shutdown      2       | PC2     | ... ... ... | started updating


Use of # in answers/documentation when referring to methods of a class

When looking through Java documentation or answers for Stack Overflow / programming forum questions, I often see people referring to methods like `String#format`, `Object#clone` etc, rather than `String.format`. Is this something to do with it being a non-static method, or is this just some convention? This is quite hard to search for due to most search engines ignoring the '#' symbol so I apologise if this is a duplicate question.


How to organize points on a sphere in bins and navigate between bins?

I'm having trouble coming up with a suitable way to navigate through a set of star coordinates in the Equatorial Coordinate System. My goal is to display those which are within a given range of horizontal coordinates. The display is square with about 10 degrees "length" in each direction. I thought about binning the stars in clusters of sufficiently large (but small enough) equal right ascension and declination, so I can display one or more bins at a time on the display (one if the display is showing the center of a bin, four if the display is showing the point connecting adjacent bins). The binning is simple, but how can I navigate between bins in order to select the right ones for the display? This appears to be a problem around the poles, where many bins touch each other. The application is being written in C++ and will have to run on a microcontroller, so resources (memory and CPU time) are very limited. Coordinates can be read from an SD card and the format may be custom, so if the algorithm imposes any constraints on that, that's fine. * * * **Additional thoughts:**   * The tiles that divide the celestial sphere into bins also have constant (not necessarily equal) size and are generated together with the lookup structure.   * insertion time is not important. The structure used for finding the right bin does not change during runtime and can be loaded from the SD card to RAM at startup.   * The word I was missing was "tiles". Gamedev SX has a [tiles] tag and there are some questions and answers there; I'll have a look at those. * * * **And another one:** Digging through the Gamedev [tiles] tag didn't reveal a lot that I could use for spherical coordinates. It also looks like I'm not familiar enough with the underlying theory to come up with a suitable solution. Another idea I had was to add information about all adjacent bins to each bin, so that when the display's view is moved I can just scan through all neighbours to find the next one that the display is "centered" on. I think this is similar to a graph, but decentralized.


Mental schema for SQL queries

While preparing SQL introductory material, I've ended asking myself about the line of thought followed by a developer when writing a query. I believe it could be too valuable from a beginner's point of view. Let me illustrate the subject with an example. For the sake of brevity, I won't include the database schema, hoping for the query to be descriptive enough by itself. Suppose we want to write a query for retrieving all _new_ customers from the last quarter. Typical. Me, the first thing I think about is the set of entities involved, beginning with the ones corresponding to the requested data. So, as I want to get customers, first of all I write the following query skeleton:                   SELECT           FROM Customers AS NewCustomer          WHERE       There immediately follow the remaining **entities**. In this fictional context, a new customer is any customer having placed an order for the first time:                   SELECT           FROM Customers AS NewCustomer     INNER JOIN Orders AS RecentOrder      LEFT JOIN Orders AS OlderOrder          WHERE             AND OlderOrder.Id IS NULL      With all the entities identified, I proceed writing the **relations** between them:                   SELECT           FROM Customers AS NewCustomer     INNER JOIN Orders AS RecentOrder             ON RecentOrder.CustomerId = NewCustomer.Id      LEFT JOIN Orders AS OlderOrder             ON OlderOrder.CustomerId = RecentOrder.CustomerId            AND OlderOrder.PlacementDate < RecentOrder.PlacementDate          WHERE             AND OlderOrder.Id IS NULL      Once I'm finished with the entities, it's time for me to define whatever **restrictions** to be applied over the resulting data set:                   SELECT            FROM Customers AS NewCustomer     INNER JOIN Orders AS RecentOrder             ON RecentOrder.CustomerId = NewCustomer.Id      LEFT JOIN Orders AS OlderOrder             ON OlderOrder.CustomerId = RecentOrder.CustomerId            AND OlderOrder.PlacementDate < RecentOrder.PlacementDate          WHERE RecentOrder.PlacementDate BETWEEN @fromDate AND @toDate            AND OlderOrder.PlacementDate < @fromDate            AND OlderOrder.Id IS NULL      Finally, I ask myself which concrete data **fields** I want the query to return, thus completing the `SELECT` clause:                   SELECT NewCustomer.FirstName, NewCustomer.LastName           FROM Customers AS NewCustomer     INNER JOIN Orders AS RecentOrder             ON RecentOrder.CustomerId = NewCustomer.Id      LEFT JOIN Orders AS OlderOrder             ON OlderOrder.CustomerId = RecentOrder.CustomerId            AND OlderOrder.PlacementDate < RecentOrder.PlacementDate          WHERE RecentOrder.PlacementDate BETWEEN @fromDate AND @toDate            AND OlderOrder.PlacementDate < @fromDate            AND OlderOrder.Id IS NULL      Of course, this is a very simple query, without aggregates, nested queries and other advanced stuff. But this is my overall train of thought, whatever the query's complexity:   1. Entities   2. Relations   3. Restrictions   4. Fields My question is, is this a suitable schema to be taught explicitly to a beginner? How could it be improved, anyway, in order to smooth her learning curve?


How to approach client who started using my server to train staff?

I'm in the process of finishing and delivering a web development project. The contract specifically specified that client is responsible for adding all content and installing. The deliverables specified are the WordPress theme. I ended up using a lot of content from their existing site because I needed it to make sure everything worked as promised. I also included 30 minutes of training to show them how to use the custom dashboard I created. I did the training yesterday and gave the client an admin login so they could inspect my work. I offered to do a staff training session at an additional hourly rate ( original agreement was project priced) and also include the database to use as an example on how to add the content. The client declined and said they would handle the training. They mentioned they were going to do some training today and didn't even ask if they could use my server and installation. I just got 3 emails that new admin accounts were added and it looks like they started migrating some content. Should I tell them that it will be an extra charge for the database or bill them for using the server? This has been one of my largest projects and first time to encounter this situation. What's the professional thing to do without letting them take advantage of me and keep the relationship intact?


What are the most common options for data storage in desktop applications?

When I was working as a website designer/engineer I primarily used databases for storage of much of my dynamic data. It was very easy and convenient to use this method and seemed like a standard practice from my research on the matter. I'm now working on shifting away from websites and into desktop applications. **What are the best practices for data storage for desktop applications?** I ask because I have noticed that most programs I use on a personal level don't appear to use a database for data storage unless its embedded in the program. I'm not thinking of an application like a word processor where it makes sense to have data stored in individual files as defined by the user. Rather I'm thinking of something more along the lines of a calendar application which would need to store dates and event info and such where accessing that information would be much easier if stored in a database... at least as far as my experience would indicate.


Quitting a small start-up where you are a primary developer?

Just curious to hear from other people who may have been in similar situations. I work for a small startup (very small) where I am the main developer for a major part of the app they are building, the other dev they have does a different area of work than I do so couldn't take over my part. I've been with the company 5 months, or so, but I am looking at going to a more stable company soon because its just getting to be too much stress, overtime, pressure, etc for too little benefit and I miss working with other developers who can help out on a project. The guy is happy with my work and I think I've helped them get pretty far but I've realized I just don't like being this much "on the edge" as its hard to tell what the direction of the company is going to be since its so new. Also, even though I'm the main dev for the project, I would still only consider myself a mid-level dev and am selling myself as such for the new job search. Just to add more detail, I'm not a partner or anything in the company and this was never discussed, so I just work on a W2 (with no benefits of course). I work at home so that makes it easier to leave, I guess, but I don't want to just screw the guy over but also don't want to be tied in for too long. Obviously I would plan to give 2 weeks notice at least, but should I give more? How should I bring up the subject because I know its going to be a touchy thing to bring up. Any advice is appreciated UPDATE: Thanks everyone for posting on this, I have now just completed the process of accepting an offer with a larger company and quitting the startup. I have given 2 weeks notice and have offered to make myself available after that if needed, basically its a really small company at this point so it would only be 1 dev that I would have to deal with... anyways, it looks like it may work out well as far as me maintaining a good relationship with the founder for future work together, I made it out to be more of a personal / lifestyle issue than about their flaws / shortcomings which definitely seems to help in leaving on a good note


How do we pass data between two Amazon instances?

I'm trying to create a website where the user enters a few numbers, these numbers are fed into some equations, and the output of these equations is emailed to the user. I'm using Python 2.7 for everything. I'm using a cheap Amazon instance (m1.small, Ubuntu 12.04) to host the frontend, but I only want to launch a backend instance when needed (the computations are heavy and require a powerful - and expensive - instance). I can use boto to programmatically launch a backend instance, but after that how do I feed the user input into the backend? Everything is simple enough when I'm doing things manually, with SFTP and SSH, but what's the programmatic way to do it? Should I simply execute SFTP and SSH from my Python script (using, say, 'os.system')? Somehow that feels wrong; how do people actually do it? In case it matters, this is not for a commercial website. I'm in grad school and I want my committee members to be able to replicate and tweak my research, which is stats-heavy. Also, I have no security concerns - it's just academic research, I'm not storing any kind of personal info or anything.


Am I right to be skeptical of ASP.NET MVC "Html Helpers"?

ASP.NET WebForms seemed really great until that moment of realization the abstraction you'd welcomed was producing HTML that was worlds away from what you needed. Wrestling with that framework to generate HTML that matched a designers or used external libraries became a big nightmare for me and one I'd rather not have again. When approaching a simple Bootstrap form in ASP.NET MVC I copied over the basic HTML and then started the process of adding @Html.BeginForm(), @Html.EditorFor() until it hit me that I was going down the same path. Sure, you add an attribute here, define an alternate helper there, but how long until you are fighting the framework to get back to what you could have just pasted in from any Bootstrap example on the web? Is anyone else feeling that, or is it possible that the Helpers introduce enough "sugar" to make using them worth the effort?


Steve Yegge post about platform vs product

I am reading this and I came across: > The Golden Rule of Platforms, "Eat Your Own Dogfood", can be rephrased as > "Start with a Platform, and Then Use it for Everything." You can't just bolt > it on later. Certainly not easily at any rate -- ask anyone who worked on > platformizing MS Office. Or anyone who worked on platformizing Amazon. If > you delay it, it'll be ten times as much work as just doing it correctly up > front. You can't cheat. You can't have secret back doors for internal apps > to get special priority access, not for ANY reason. You need to solve the > hard problems up front. What does that exactly mean? Can someone please explain?


DOMDocument programming: a lot of little dilemmas, how to solve them?

I need elegance and performance: how to decide by the "best implementation" for each DOM algorithm that I face. This simple "DOMNodeList grouper" illustrate many little dilemmas:   * use `iterator_to_array` or "populate an array", when not all items need to be copied.    * use _clone_ operator, _cloneNode_ method or _import_ method?   * use `parentNode::method()` or `documentElement::method`? (see here)   * first `removeChild` or first `replaceChild`, no avoids "side effects"?    * ... My position, today, is only "do an arbitrary choice and follow it in all implementations" (like a "Convention over configuration" principle)... But, **there are another considerations? About performance, there are some article showing benchmarks?** * * * PS: this is a generic DOM question, any language (PHP, Javascript, Python, etc.) have the problem.


does one method overload an other, or are both methods "overloaded"

If i create this method               public void foo()      And then i create an overloaded version like this               public void foo( string bar )      Do we say that the second functions overloads the first, or are both methods equally "overloaded". This would imply ( i think ) , that there is a base type function, that is being overloaded, by another function. ( somewhat like inheritance, but not really ) Assuming that one method can "overload an other", would also imply terms like "overloader" and "overloadie", if that is a word at all. But that doesn't feel right at all, especially since you can have several overloads. I got to this question when i wanted to write down the process of creating an overloaded method and i wanted the most correct way of writing it down. Examples:   * I am overloading `foo`   * I am overloading `foo` with `foo( string bar )`   * I am creating an overloaded method    * I am making foo overloaded So yeah, this kind of got my thinking, i am not sure what to make of it. There are hundreds, if not thousand, descriptions of function overloading online, but at a first glance i couldn't find any addressing this.


Will perfecting my assignments help get me a job?

I am currently a student with the intention of pursuing a career as a programmer. All of my assignments are functional and complete to the letter but I feel as though there is plenty more work that could be done on these applications beyond the scope of the assessment. Will putting in the extra hours into these assignments help me land a job? Also, I was thinking of showcasing my programming skills with a video demonstration of my work. Do you think potential employers would respond well to this kind of visual resume?


XP, TDD or DDD - Which one should I learn first?

I want to learn XP, TDD and DDD to improve myself. My problem is I have general ideas of what they are but I don't know which one should I learn first, do I need to learn something before other? Please suggest me which topic should I learn first, second and third.


How to implement instant communication between iPad and iPhone through the net?

What is the best way to implement this: 1.iphone/webBrowser user selects some products (a,b,c) to buy 2.the chosen products most appear on the iPad located in the Store. using a UITableView perhaps. 3.The store staff then decide if the products are available in 10, 20 or 30 minutes for pick up. 4.When the store staff chose the time(10,20,30 minutes) it must appear/communicate back to the users web browser or iPhone. 5.buyer comes to the store to pick up the products he buyed! Im not really good in this kind of communication stuff! I need help! what is the best way to implement this? are there external api/plugin I could use? I already have an ftp server. I can do all the graphics and User interactions. the only problem for is the communication between the devices? Thanks for help.


What is Developer Anarchy?

I've been reading about Developer (or Programmer) Anarchy, which seems to be billed as a post-Agile development methodology. I found a few resources on it (1, 2) but it doesn't seem to be a lot out there. I was wondering if anyone had any good resources where I could find out more about it _ how to implement it, pros and cons, comparison with other methodologies etc.


In transitioning to C# from Java, how can I ensure that I am not only proficient, but competent?

My biggest fear with getting back into C# (I have rudimentary .NET skills) is that although I may find the solution to a problem, it will not be the optimal solution. What is the best way to ensure that I am not just getting the job done, but that I become a competent C# programmer?


How do you manage project estimation and managing your teams time

I'm thinking of things like:   * designating a developer having say 6 hours out of their normal 7.5 hour day dedicated to the project, the rest for other work/company related activity (meetings, emails, calls etc), maybe a senior dev is less.   * building in 20% contingency time to estimates. What are the best ways to produce tight estimates and at the same time shield developers from management. Addendum: I've been asked to help my current client with these types of issues. They are a really poor dev team with the business calling all the shots, scope creep, overlapping environments, priority changing at a whim etc. I want to help them get better.


Materialized View vs POJO View based on Objects representing Oracle tables

I have about 12 Oracle tables that represent data that's being integrated from an external system into my web application. This data is going to be used in an informational and comparative manner for the clients using my web application. On one particular page of my web application, I need to combine data from 3 - 5 Oracle tables for display as an HTML table on the page. We are NOT currently using a framework (Apache Struts for instance) and we're not in a position to move this Java web application into one at this moment (I'm trying to get us there...). I am certainly not an architect, but I see one of two ways that I can effectively build this page (I know there are other ways, but these seem like they would be good ones...): 1\. Create an Oracle Materialized View that represents what the HTML table should look like and then create a POJO based on the View that I can then integrate into my JSP. 2\. Create POJOs that represent the Oracle tables themselves and then create another POJO that is the View used for the HTML table and then integrate that POJO into my JSP. To me, it seems the Materialized View would possibly offer quicker results which is always what we strive for in web applications. But, if I just create 12 POJOs that represent the Oracle tables and then build POJO Views off of those, I have the advantage of keeping all the code in one place for this and possibility for creating any number of different views and reusable components in my web application. Any thoughts on which one might be the better route? Or, maybe you know of an even better one?


For what common problems is functional programming not a good fit?

Functional programming is a declarative paradigm. One of the strenghts with FP is that side-effects are avoided. It's said that for some problems FP isn't a good fit. For what common problems isn't functional programming a good fit?


what is a good stack for software as a service (SAAS) application?

We will be engaging large corporations to help them run various types of analysis, mostly code analysis of their applications. The storage requirements will likely be modest, hundreds of MB per client. My question is mostly aimed at finding the stack with existing frameworks, best practices and a community which will allow a rapid development process. I am comfortable with the .Net environment and am leaning towards Azure. Any thoughts?


What is the "architecture" that provides functionality to application-level URI interfaces, like chrome:// and Firefox's about:config, etc?

According to Wikipedia, > `about` is an internal URI scheme (also known as a "URL scheme" or, > erroneously, "protocol") in various web browsers to display certain built-in > functions. It is not an officially registered scheme, and has no standard > syntax. my question is... what "powers" these "interfaces"? there doesn't seem to be any kind of "application server" running - that would conventionally support such a front-end - were it to be running remotely.. i'm sure the reason for the dearth of information out there - is that these all break the _psuedo- promise_ that anything "you do" in the browser - won't "effect" your system. these interfaces _clearly_ have access to system level resources and permissions, etc.. are they all simply custom, c-coded hooks to the internal code of the parent applications - or are they a more abstract, _ui--layer_? i admit to little knowledge of plug-in authoring, but can this type of functionality be achieved via the typical plug-in API's, or are they too limited? i have spent some time in the webkit source code poking around - but it is so massive and convoluted that its hard to deduct much... it would seem that however these vendors are implementing these features might be an appealing alternative to say, the various language-specific bridges that webkit implements on various platforms. i personally find the bridges frustrating, which is probably what led me down this train of thought... any insights appreciated.


Unforeseen Spike in a Sprint... what to do?

I did a look around and couldn't find a question that addresses my case, so I figured I would post. I have a situation where as a new team, we ran into 2 unforseen spikes (is there a better term?) during a sprint. We 'thought' we knew, but then we had to research mid way, so this introduced a spike. My questions are:   * If we have an outage/process issue (Jenkins craps out, requires 8 hours of debugging / setup by a dev or more), is this a spike or somethine else? Do I create a spike, throw it into Sprint (mid sprint), do I then subtract hours from overall sprint (8hr spike = minus 8hrs of planned tasks?) or just end up with undelivered items for next sprint?   * If I had an estimate of 8 hours for something, then the devs find, in fact they need to research more, do I have a spike there too? remove task times? etc; I want to make sure I have a better hand at planning out these 'unforeseen' events, and have a good idea of deliverables for the sprint. I'm looking at this from a purely Project Management perspective where I need to report up the chain on progress / burndown of tasks / deliverables.


What kind of object relational mapping is appropriate here?

In my database I have a table that looks like this Master(ID, Name, Attr1...). Every ID will have at least 1 entry in additional tables that have additional attributes. Those tables specialize the master table. Spec1(MasterID, Attr2,...) Spec2(MasterID, Attr3,...) ... So, not sure how to map this to object oriented design. If every ID could have just one specialization then it would be easy, master would be abstract class and specializations would be concrete inherited classes but in this scenario, single ID can have all specializations and they could be added or removed during his lifetime in the database. Each specialization has unique business rules ofc.


How should non-functional changes be committed?

I'm working a small-to-medium legacy codebase and when working on a ticket I will come across code that should be cleaned-up or that I _need_ to clean-up just to be able to understand the follow of the application. A real example is:               if( !a && b ){          doSomething1();          doSomething2();          doSomething3();          doSomething4();          doSomething5();     }else if( a ){          doSomething1();          doSomething2();          doSomething3();          doSomething4();          doSomething5();     }else if( !b && ( a || c )  ){          doSomething1();          doSomething2();          doSomething3();          doSomething4();          doSomething5();     }      Another is fixing typos and Engrish in comments and documentation across a dozen source files. However, often this clean-up ends up not related to the main issue and I wonder how is it best to commit the clean-up. The way I see it, there are three options:   1. Before the fix: this works chronologically since this is the order in which they occur but if they break something they complicate the fix and it makes it harder to diff the fix with what was in production. It also introduces an additional commit which is noise.   2. With the fix: but that obscures the actual replacement of defective code with files where `findGeoragphy` was correct to `findGeography`.   3. After the fix: this requires removing and clean-up you made that helped you understand the code and then retesting the fix, committing the fix, and then going back and redoing the clean-up. This allows the cleanest diff to the defective code, but duplicates effort and can lead to spurious commits as well. **tl;dr:** So, what is the best method of committing clean-up code? **Context:** We have no unit-tests and development proceeds by running changes and eye-balling them and throwing them over the wall to QA to validate through manual regression fixes. Also, if we don't do some form clean-ups the code becomes unintelligible. I know this is far from ideal, but this is real enterprise dev that puts food on my table and not my choice.


Should I fork a fork (on Github)?

On Github, I've run across a pull request which it implements a feature I like but feel isn't quite intuitive and could be better. The maintainers of the original repo have so far declined to accept it (or explain why). It was requested 3 months ago so I suspect they won't take it without changes. I'd like to improve upon this contributor's code but don't know the etiquette: should I fork this fork? Or do I fork the main repo and add the other fork as another upstream source? If the latter, how do ensure credit is given where due? What implications does either option have for pull requests? EDIT: While I appreciate hearing opinions and did ask about etiquette, I'm more interested in knowing about whether there is any technical or pragmatic reason to fork off the main project and add the creator of the 'cool feature' PR as an upstream versus just forking the branch of the 'cool feature' PR. Based on jan-hudec's answer I'm inclined to fork main + add new upstream. I suspect it'd be easier to keep my fork up-to-date and not reliant on this other contributor to incorporate upstream changes.


Initializing char array with string

I don't remember how I got to the thread, but I was reading its replies and one of them states that you should never initialize a `char[]` with a string literal. My question: Is initializing a character array with a string literal a bad practice or is that just the author's opinion? * * * Here is the original question: > **strlen vs sizeof** > > Code:               #include <stdio.h>     #include<string.h>     main()     {         char string[] = "october";         strcpy(string, "september");              printf("the size of %s is %d and the length is %d\n\n", string, sizeof(string), strlen(string));         return 0;     }      > right. the size should be the length plus 1 yes? > > this is the output > > `the size of september is 8 and the length is 9` > > size should be 10 surely. its like its calculating the sizeof string before > it is changed by strcpy but the length after. > > Is there something wrong with my syntax or what?