How could I avoid a distributed deadlock during a mutual connection between two nodes?

Suppose we have two peer nodes: the first node can send a connection request to the second one, but also the second one can send a connection request to the first one. How to avoid a double connection between the two nodes? To resolve this issue, it would be sufficient to make sequential the operations performed for creating inbound or outbound TCP connections. This means that each node should process sequentially each new connection creation operation, both for incoming connections and for outgoing connections. In this way, maintaining a list of connected nodes, before accepting a new incoming connection from a node or before sending a connection request to a node, it will be sufficient to check if this node is already present in the list. In order to make sequential the operations of creating connections, it is sufficient to perform a _lock_ on the list of connected nodes: in fact, for each new connection, the identifier of the new connected node is added to this list. However, I wonder if this approach can cause _distributed deadlock_ :   * the first node could send a connection request to the second one;   * the second node could send a connection request to the first one;   * assuming that the two connection requests are not asynchronous, both nodes lock any incoming connection requests. How could I solve this problem? **UPDATE:** However, I still have to lock on the list every time a new (incoming or outgoing) connection is created, since other threads may access this list, then the problem of deadlock would still remain. **UPDATE 2:** Based on your advice I wrote an algorithm to prevent mutual acceptance of a login request. Since each node is a peer, it could have a _client routine_ to send new connection requests and a _server routine_ to accept incoming connections.               ClientSideLoginRoutine() {         for each (address in cache) {             lock (neighbors_table) {                 if (neighbors_table.contains(address)) {                     // there is already a neighbor with the same address                     continue;                 }                 neighbors_table.add(address, status: CONNECTING);                  } // end lock                  // ...             // The node tries to establish a TCP connection with the remote address             // and perform the login procedure by sending its listening address (IP and port).             boolean login_result = // ...             // ...                  if (login_result)                 lock (neighbors_table)                     neighbors_table.add(address, status: CONNECTED);              } // end for     }          ServerSideLoginRoutine(remoteListeningAddress) {         // ...         // initialization of data structures needed for communication (queues, etc)         // ...              lock(neighbors_table) {             if(neighbors_table.contains(remoteAddress) && its status is CONNECTING) {                 // In this case, the client-side on the same node has already                 // initiated the procedure of logging in to the remote node.                      if (myListeningAddress < remoteListeningAddress) {                     refusesLogin();                     return;                 }             }             neighbors_table.add(remoteListeningAddress, status: CONNECTED);              } // end lock     }      **Example:** The IP:port of node A is A:7001 - The IP:port of node B is B:8001. Suppose that the node A has sent a login request to the node B:8001. In this case, the node A calls the login routine by sending by sending its own listening address (A:7001). As a consequence, the neighbors_table of node A contains the address of the remote node (B:8001): this address is associated with the CONNECTING state. Node A is waiting for node B accept or deny the login request. Meanwhile, the node B also may have sent a connection request to the address of node A (A:7001), then node A may be processing the request of the node B. So, the neighbors_table of node B contains the address of the remote node (A:7001): this address is associated with the CONNECTING state. Node B is waiting for node A accept or deny the login request. If the server side of node A rejects the request from B:8001, then I must be sure that server side of node B will accept the request from A:7001. Similarly, if the server side of node B rejects the request from A:7001, then I must be sure that server side of node A will accept the request from B:8001. According to the "small address" rule, in this case the node A will reject the login request by the node B, while node B will accept the request from node A. What do you think about that?


Scrum on very short projects?

I'm using Scrum and really liking it. However, my shop finds itself in projects where the duration of the development effort is two or four weeks. We've already modified the sprint length to two weeks, and everyone here says "it'll be Scrum, just with one and a half sprints." I don't think we can get a lot of value from one and a half sprints. How can we get the benefits of an iterative development process with only one, two, or one-and-a-half iterations?


What is the effect of creating unit tests during development on time to develop as well as time spent in maintenance activities?

I'm a consultant and I am going to introduce unit tests to all developers at my client site. My goal is to ensure that all new applications should have unit tests for all classes created. The client has a problem with high maintenance costs from fixing bugs in their existing applications. Their applications have a life span from between 5-15 years in which they continuously add new features. I'm quite confident that they will benefit greatly from starting with unit tests. I'm interested in the effect of unit tests on the time and cost of development:   * How much time will writing unit tests as part of the development process add?   * How much time will be saved in maintenance activities (testing and debugging) by having good unit tests?


How important do you think IE-friendliness is?

I think most web developers will agree that it is often easier getting something to work well in most browsers, but not as much in IE. I was wondering: When designing/developing a website, how important do you think IE-friendliness is? I mean, how worth it is it to bust yourself trying to make a website that works perfectly in major browsers work the same in IE?


iPhone, iPad & XCode 4 - Noob question

I'm new just about everything 'Apple' with the exception of owning an iPhone and iPad for over a year. I have 15+ years on Wintel platforms w/ C/C++/C# experience, so Obj-C doesn't scare me. I recently purchased a Mac Book Pro and have XCode 4, but I've noticed most online tutorials (at least that I can find) are still geared for XCode 3.x. My question, does anyone know of any online tutorials (text or video) geared around XCode 4? The only ones I'm aware of are on developer.apple.com. While good, those seem to assume you're transitioning from XCode 3.x. Thanks [Edit] - Adding a link, and will try to keep this current for other readers.   * Standford's


Data/Object Design Problem

**Goal:** I'm trying to figure out the best way to model/design and then implement a "user" feature in a system. **Background:** I am designing an on-line access request system, so our company can use a web- based method for users to request access to various software systems. Since the system is all about the "user", the user is the focal point of the system. So, a User can request access to a system. Then, the User's Manager will approve/reject the request. After that, the System Owner will approve/reject the request. Then it's the System Admin who approves/rejects, and finally the Security Administrator approves/rejects and adds them to the appropriate Active Directory group so they have access to the target Active Directory- driven application (not this application). **Problem:** I see all entities that represent a User as a core (set of) class(es) in the system. The User object is straight-forward - just pass their Windows login to Active Directory (AD) via an LDAP query and get their info and load it into an object. In an LDAP query, if there are other Users that report to them (a user's manager is stored in our AD), then this "user" is not only a User in this system but also a Manager. If this User is also in the database as a System Owner, they are also a System Owner. **So Far:** (Assume a Manager is someone with at least one direct report assigned to them in AD.) I've considered a single User object, with properties such as IsManager or IsSystemOwner. However, should I construct an object hierarchy where (for example) a Manager class inherits from User? There are quirks with this, because a System Owner could inherit from User or Manager. Not all system owners are managers. However, Managers, System Owners, System Admins, and Security Admins are all Users, because they can be requesting access to some software system where there role in this system is only as a User. Here is an overview of "is a" for all of the user entities:   * A User can request access to some other software system in this system.   * A Manager is a User.   * A System Owner is a User.   * A System Admin is a User.   * A Security Admin is a User (but unlikely to be, due to our organization).   * A Manager may be a System Owner, but not always.   * A System Owner may be a Manager, but not always.   * A System Admin may be a Manager, but not always.   * A System Admin may be a System Owner, but not likely.   * A Security Admin may be a Manager, but not always.   * A Security Admin may be a System Owner, but not likely. Some additional info:   * I don't anticipate Security Admins to be using the system as a User to request access, but it's always a possibility.   * A Manager may create an access request on behalf of one of their employees (to revoke access to a fired employee, for example)   * All employees in the Windows domain will have access to this site. I assume that I will have some Active Directory groups created for System Admins and Security Admins, as the users in these groups will not be dynamic, rather, users in one team are Sys Admins and users in another team are Security Admins.   * The System Owner is subject to changed and will be stored in the database, along with the option to designate an alternate approver when on vacation, etc.   * I may need a Manager to have an alternate approver, but I didn't plan on storing all users on the domain in the database! This seems like it's so easy to model on paper, but getting it into good, flexible code is stumping me. All suggestions are welcome. EDIT: Based on Karl's feedback, I have this prototype model. Does it look solid from an OOP perspective, based on my intended use?               Public Class MyCustomUserObject              Public Property LoginID As String         Public Property FirstName As String         Public Property LastName As String         Public Property EmailAddress As String              Public Property Roles As List(Of Role)              Public Function IsManager() As Boolean             ' If List(Of Role) contains an object of type ManagerRole, then True, else False.         End Function              Public Function IsSystemOwner(systemName As String) As Boolean             ' If List(Of Role) contains an object of type SystemOwnerRole with matching name             ' in SystemOwnerRole.SoftwareSystems, then True, else False.         End Function              Public Function IsSystemAdministrator(systemName As String) As Boolean             ' If List(Of Role) contains an object of type SystemAdministratorRole with matching name             ' in SystemAdministratorRole.SoftwareSystems, then True, else False.         End Function              Public Function IsSecurityAdministrator() As Boolean             Return My.User.IsInRole("My Active Directory group name for Security Admins")         End Function          End Class          Public Class SoftwareSystem              Public Property ID As String         Public Property Name As String          End Class          Public MustInherit Class Role              Public Property DesignatedApproverLoginID As String          End Class          Public Class ManagerRole         Inherits Role              Public Property Subordinates As List(Of AafUser)         ' Or this, with a List of login IDs?         ' Public Property Subordinates As List(Of String)          End Class          Public Class SystemOwnerRole         Inherits Role              Public Property SoftwareSystems As List(Of SoftwareSystem)          End Class          Public Class SystemAdministratorRole         Inherits Role              Public Property SoftwareSystems As List(Of SoftwareSystem)          End Class          Public Class SecurityAdministratorRole         Inherits Role              ' Explictly a Security Admin for all Software Systems.          End Class


What tools do you use to stay focused?

This is related, but I'm thinking about something more like a chastity belt for keeping me from checking programmers.SE or my email every time I compile. Rather advice like "go take a walk and you'll feel more like coding", I just need something to augment my weak constitution - a net nanny for my geek fetish I guess. I'll take my answer off the air and I promise not to check programmers.SE for at least a day.


Do you start migrating your Swing project to JavaFX

I have a 4 years old project which is written in Swing + SwingX. Currently, it is still alive and still kicking. However, as more GUI related feature requests coming in (For instance, a sortable tree table), I start to feel the difficulty in fulling the requests. This is true especially since there isn't any active development going around SwingX project. Also, I can hardly find any good, yet actively maintained/ developed/ evolving GUI Java framework. I was wondering, do any of the Swing developers feel the same thing? Have you start to migrate your Swing project to a much more active developed GUI framework, like JavaFX?


Should your client be able to view your project management board?

We're making a bespoke software for our client and use Codebase for our project management. Is it a good idea to let our client view our project management board? The advantages that we thought of are that this would enhance the cooperation between the client and the dev team, following agile practices. He would essentially become part of our team. It would also reduce communication overhead and make sure we're on the same page. The client could track the progression of the system and make suggestions along the way on the user stories. In addition, he could submit bugs or feature requests. The disadvantages that we though of are that some aspects of the board might be too technical to the client. He would suggest changes to the user stories too often and he might view some content that we normally wouldn't want our client to see. For example, when we compromise on technology or functionality, the client might question that and insist on doing things one way or the other.


Understanding and developing web services

This question is in conjuction with **How would you approach developing a Hotel Reservation System?** The solution to a system with different interfaces (or clients I should say) is to go with developing a Web service and have other systems interact with it. I never had the requirement for developing a Web service so I am bit short on it. All I understand is that **A web service is a system or application that performs some operations which may include modifying, sending or receiving data over a network using HTTP protocol**. (Let me know if the understanding is wrong) Now, from the other question it's clearly understood that I need to develop a web service but I have no idea as to how should I go about it. My language of choice is C# and .NET Framework. **Question** : How do we develop a webservice and which tools, technology and framework should I use for the same using C# language? **Question** : How can I interact with this from a desktop WPF application, website and mobile app.


Is it acceptable that after reading a certain technology in a book, you put it in your resume as a skill?

I am a junior IT person and I am a bit short on experience and I am diploma graduate so which makes me lack knowledge in the eyes of the human resource department. so what I do is I read technical books like AJAX, SOA, RUBY and stuff like that. Now is it alright if I put that on my resume as a skill of mine without the expensive, somewhat unnecessary, almost boring formal education with them certificates to prove your knowledge?


Moving from mock to real objects?

I'm like doing TDD so I started everything mocking objects, creating interface, stubbing, great. The design seems to work, now I'll implement the stuff, a lot of the code used in the stubs are going to be reused in my real implementation yay! Now should I duplicate the tests to use the real object implementation (but keeping the mocks object of the sensitive stuff like Database and "services" that are out of my context (http calls, etc...)) Or just change the mocks and stubs of the actual tests to use the real objects....... So the question is that, keep two tests or replace the stubs, mocks? And after that, I should keep designing with the mocks, stubs or just go with real objects? _(Just making myself clear I'll keep the mock object of the sensitive stuff like database and services that are out of my context, in both situations.)_ EDIT               [Fact]     public void Change_status()     {         var dbContext = MockRepository.GenerateStub<IDbContext>();         var repository = MockRepository.GenerateMock<IRepository<Foo>>();              var predicate = MockRepository.GenerateStub<Func<Foo, bool>>();         repository.Expect(x => x.Get(predicate)).Return(_foo).Repeat.Once();         dbContext.Expect(x => x.Commit());              var ctl = MockRepository.GenerateStub<IFooCtl>();         ctl.Stub(x => x.RejectRequest(_fooView)).WhenCalled(delegate         {             var foo = repository.Get(predicate);             foo.Status = Status.Rejected;             _fooView.Status = Status.Rejected.ToString();              }).Return(true);              ctl.RejectRequest(_fooView);              repository.VerifyAllExpectations();         dbContext.VerifyAllExpectations();         Assert.True(_fooView.Status == "Rejected");         Assert.True(result.Count() == 1);     }      This is a test, where I mock the repository, context and stub the facade. So what I'm trying to say is if I should change the stub of the facade to use the "real" code so this should be tested as               [Fact]     public void Change_status()     {         var dbContext = MockRepository.GenerateStub<IDbContext>();         var repository = MockRepository.GenerateMock<IRepository<Foo>>();              var predicate = MockRepository.GenerateStub<Func<Foo, bool>>();         repository.Expect(x => x.Get(predicate)).Return(_foo).Repeat.Once();         dbContext.Expect(x => x.Commit());              var ctl = new FooCtl(loanRepository, happyLoanDbContext);         var result = ctl.RejectRequest(_loanView);              repository.VerifyAllExpectations();         dbContext.VerifyAllExpectations();         Assert.True(_result);     }      Or if I should leave everything mocking and stubbing that tests the designs and create new ones that tests the implementation. EDIT Thanks for all your answer, I think I understand it better, I must know which is my SUT and test that, no mock or stub the SUT just the components that will help the SUT to pass the test


Is running "milli"-benchmarks a good idea?

I just came across the Caliper project and it looks very nice. Reading the introduction to microbenchmarks, one gets the feeling that the developers would not suggest to use the framework if the benchmark takes longer than a second or so. I looked at the code and it looks like a RuntimeOutOfRangeException is actually thrown if a scenario takes longer than 10s to execute. Could you explain to me what the problems are with running larger benchmarks? My motivation for using Caliper was to compare two join-algorithm implementations. Those will definitely run for quite some time and will do some disk IO, yet running the entire database would make it hard to do the comparison, because the configuration of the algorithms and the visualization of the results would be a pain.


What am I missing from my CI stack?

Right now, the current deploy process at my work is based around tagging from the trunk and switching various PHP web sites for clients on our QA and Production servers. While this is simple from the technical level, it becomes really tedious when you have over a dozen updates to a dozen different sites that need to go out in one day. Towards this end, I'm implementing the following stack:   * SVN   * Hudson   * Capistrano And it will work like this:   1. Code goes into `svn`   2. `svn` post-commit hook triggers `hudson`   3. `hudson` runs a `capistrano` script to deploy to the dev server   4. project managers check out the dev server, and if the bug is fixed, they go into `hudson` and promote the build   5. `hudson` runs a post-promotion script which tags and deploys the code to whatever server is specified by the promotion Capistrano (along with the symfony framework) will be used to migrate the databases. Am I missing anything here? I've never done anything more complicated than subversion before, so that's why I'm asking.


Pros and Cons of Joint Application Design

I was asked to lead "JAD sessions", which I've heard of before, but never facilated before; at least in name, they appear just to be a fancy name for stakeholder workshops. My experience has been that "group think" and "follow the leader" are common issues with this approach, but trying to stay open to the concept. Based on what I'm able to tell the phrase has been around since the 1980s, so clearly it's no "silver bullet". What are the key pros and cons of this approach?


programmer meta skills

I used to think that my ability to create clever algorithms or my comfort with the languages I work in would determine my success as a programmer, but after a dose of real world development, I realized that these skills aren't nearly as valuable as the ability to choose the right tools for the job, to communicate with a team effectively, to decide when to use something out of a box vs. write your own version, and to have patience when trying alternatives until your high level of excellence is met or exceeded. I was wondering what other 'meta' skills people think are useful for a programmer/software engineer to have and how important they are _relative_ to the technical skills. This is NOT the same as simply asking what soft skills will help make a good programmer. More importantly, when looking to hire someone, how can you test for these better indicators of success (most interview questions I see are still just testing technical ability). Also, does anyone know of any books or blogs which focus on these meta skills? Thanks.


How to properly license open source software

I have a project I've been working on which I would like to push into a new, public Github repository as open source. After searching on StackExchange for the right license to use I've settled on the BSD license. My question is: now what? Do I just need to copy the BSD license text into a file called LICENSE in the root of my repository and call it good? Is that the general rule for how all open source licenses work? Or do I need to notify some other organization that I'm using this license so I can 'enforce' it if necessary?


Where can I learn the most up-to-date standard for HTML and CSS?

I'm looking to learn updated HTML/CSS in preparation for HTML5. Since I am new to this it's hard for me to know which websites are teaching old HTML coding styles and which are teaching the good one. Does anyone know of some websites that fit my criteria?


Are there standard practices when writing a spec for a software development project? Is there a specific format to follow? Also, does the developer or the client write this up? If the dev, is this billable?


Where do you draw the line between quantity and quality?

My manager has talked with me and says that the quality of my work is excellent, but I need to step up the quantity of how much I crank out. I've only been working for a couple of years, so I still feel like I have a lot to learn. Which route do I take (or is there another?): Quantity: If they want crap, I can give them lots of it. Quality: Ignore the request, and hope that my productivity will increase with experience.


3D Secure MPI providers - suitable for multiple third party payment systems?

Long time user of SO, and figured this is the best place to ask this question. I am currently consolidating our eCommerce payment clearing systems into one Asp.Net MVC website that will work like PayPal but for our own websites. The businesses within the group have different rules as to the payment provider that is to be used throughout the world and, at present, we currently integrate with Servebase, Moneris and PayPal. Thus, I have an architecture that allows new providers to be written and plugged in through a single extensibility point. In the future I am likely to have to support 3D Secure, which complicates matters significantly; not only because of the additional web workflow but because each provider appears to recommend it's own MPI provider/solution for the 3D Secure process. Assuming that all three of these payment providers appear to offer the same kind of 3D Secure hooks (I'm seeing similar parameters in all of their APIs), do you think I'm going to be able to use a single MPI to manage the 3D Secure process for all or do you think I'm going to have to have a different 3D Secure implementation for each of my providers? For example, PayPal recommend using Cardinal Centinel for 3D Secure - so let's say I get a single account for them, what are the chances I'll be able to reuse it for Moneris or Servebase, say. Is the 3D Secure system a 'standard' (using the term loosely there!) that is simply being echoed by these other payment providers? It doesn't matter if you know nothing of the other APIs I mention here - i.e. Moneris, Servebase - if you've had any experience similar to mine I would appreciate any thoughts.


How to apply design patterns in this scenario

I want to use design patterns for the following scenario. How to? I have classes named Person, Employee and Customer and all of them have their own save, update, get and delete methods. Employee and Customer classes are derived from person. What may be the best way to code?


How to organize cross platform js/web application?

My friend and I are working on an application that already works for Windows 8 and is written in Javascript, HTML, and CSS. Our desire is to make it cross platform for areas like windows mobile, chrome, firefox, and android. So, our directory structure looks like this:               .     ├SomeApp.sln         // Visual Studio solution file     ├SomeApp.suo         // other Visual Studio related file     ├SomeApp.v11.suo     // other Visual Studio related file     ├deploy.py           // Deployment script for apache     ├Makefile            // For things like building the desktop version     │                    // and for testing/linting/deploying     conf     ├── apache.conf     SomeApp     ├── AppPackages     ├── bin     │   ├── Debug     │   └── Release     ├── bld     │   ├── Debug     │   └── Release     ├── css     ├── images     ├── js     │   └── lib     ├── pages     ├── promo images     └── strings         // i18n language files         ├── ar         ├── bg         ├── cs         ├── da         ├── de         ├── el         ├── en-US         ├── es         ├── fr         ├── he         ├── hr         ├── hu         ├── it         ├── ja         ├── ko         ├── nb         ├── nl         ├── pl         ├── pt         ├── ro         ├── ru         ├── sv         ├── tr         ├── uk      I added things like the deploy script and the make file... but I'm really at a loss on how to organize a project like this. Would I create directories like this?               .     ├──browserExtension/        │  ├── build/           // put makefile here?                │  ├── conf/            // put apache conf here?                │  ├── chrome/           │  ├── firefox/     ├──web/                  // normal web page      ├──windows/                     │  ├── WindowsMobile8/           │  └── Windows8/        // put existing solution files here?     ├──mobile/            │  ├── android/     └──common/        ├── css/        ├── js/        │   └── test/        └── html/      Is there a good example of a project that's already been successful doing this that I can follow?


Should my source code be in UTF-8?

I feel that often you don't really choose what format your code is in. I mean most of my tools in the past have decided for me. Or I haven't really even thought about it. I was using TextPad on windows the other day and as I was saving a file, it prompted me about ASCII, UTF-8/16, Unicode etc etc... I am assuming that almost all code written is ASCII, but why should it be ASCII? Should we actually be using UTF-8 files now for source code, and why? I'd imagine this might be useful on multi-lingual teams. Are there standards associated with how multilingual teams name variables/functions/etc?


OOP - Modeling a Chat

When modeling a chat, should a chat object receive messages or a message be sent to a chat object? I'm not sure whether there is a definitive answer but maybe someone can point out benefits of one over the other. ` message.send(chat); ` VS. ` chat.sendMessage(message); `


Any tips how to successfully job hunt?

I have been looking for a job for more than 3 weeks and have applied for about 30 vacancies. From all of these I only received few calls from recruitment agencies which didn't propose anything special. One of them just forwarded my CV to the employee and another suggested me to fix my current CV. I made some changes to CV which they didn't like and resent it back. No reply since. I feel frustrated and worried. First of all I don't like that everything vacancy should go through recruitment agency. Even if I want to apply directly I cannot find any name or any lead which company is recruiting. Secondly I don't see any reason why nobody replies back. My cover letter is in plain text and CV is made in Latex. Everything is crafted by all suggestion I have read over the internet and one very interesting book "The Google Resume". What I am doing wrong? Is there any tips how to search direct jobs? Particularly I am interested in UK job market. P.S. I am using http://www.simplyhired.co.uk/ which I believe is the best site because it accumulates from all it job boards.


How to simulate inner join on very large files in java (without running out of memory)

I am trying to simulate SQL joins using java and very large text files (INNER, RIGHT OUTER and LEFT OUTER). The files have already been sorted using an external sort routine. The issue I have is I am trying to find the most efficient way to deal with the INNER join part of the algorithm. Right now I am using two Lists to store the lines that have the same key and iterate through the set of lines in the right file once for every line in the left file (provided the keys still match). In other words, the join key is not unique in each file so would need to account for the Cartesian product situations ...               left_01, 1     left_02, 1     right_01, 1     right_02, 1     right_03, 1          left_01 joins to right_01 using key 1     left_01 joins to right_02 using key 1     left_01 joins to right_03 using key 1     left_02 joins to right_01 using key 1     left_02 joins to right_02 using key 1     left_02 joins to right_03 using key 1      My concern is one of memory. I will run out of memory if i use the approach below but still want the inner join part to work fairly quickly. What is the best approach to deal with the INNER join part keeping in mind that these files may potentially be huge               public class Joiner {            private void join(BufferedReader left, BufferedReader right, BufferedWriter output) throws Throwable {              BufferedReader _left = left;         BufferedReader _right = right;         BufferedWriter _output = output;         Record _leftRecord;         Record _rightRecord;              _leftRecord = read(_left);         _rightRecord = read(_right);              while( _leftRecord != null && _rightRecord != null ) {                if( _leftRecord.getKey() < _rightRecord.getKey() ) {             write(_output, _leftRecord, null);             _leftRecord = read(_left);           }           else if( _leftRecord.getKey() > _rightRecord.getKey() ) {             write(_output, null, _rightRecord);             _rightRecord = read(_right);           }           else {             List<Record> leftList = new ArrayList<Record>();             List<Record> rightList = new ArrayList<Record>();                  _leftRecord = readRecords(leftList, _leftRecord, _left);             _rightRecord = readRecords(rightList, _rightRecord, _right);                  for( Record equalKeyLeftRecord : leftList ){               for( Record equalKeyRightRecord : rightList ){                 write(_output, equalKeyLeftRecord, equalKeyRightRecord);               }             }           }         }              if( _leftRecord != null ) {           write(_output, _leftRecord, null);           _leftRecord = read(_left);           while(_leftRecord != null) {             write(_output, _leftRecord, null);             _leftRecord = read(_left);                   }         }         else {             if( _rightRecord != null ) {             write(_output, null, _rightRecord);             _rightRecord = read(_right);             while(_rightRecord != null) {               write(_output, null, _rightRecord);               _rightRecord = read(_right);             }           }              }         _left.close();         _right.close();         _output.flush();         _output.close();       }            private Record read(BufferedReader reader) throws Throwable {         Record record = null;              String data = reader.readLine();         if( data != null ) {           record = new Record(data.split("\t"));         }         return record;       }            private Record readRecords(List<Record> list, Record record, BufferedReader reader) throws Throwable {         int key = record.getKey();         list.add(record);         record = read(reader);         while( record != null && record.getKey() == key) {           list.add(record);           record = read(reader);         }         return record;           }            private void write(BufferedWriter writer, Record left, Record right) throws Throwable {            String leftKey = (left == null ? "null" : Integer.toString(left.getKey()));         String leftData = (left == null ? "null" : left.getData());         String rightKey = (right == null ? "null" : Integer.toString(right.getKey()));         String rightData = (right == null ? "null" : right.getData());              writer.write("[" + leftKey + "][" + leftData + "][" + rightKey + "][" + rightData + "]\n");       }            public static void main(String[] args) {             try {                    BufferedReader leftReader = new BufferedReader(new FileReader("LEFT.DAT"));               BufferedReader rightReader = new BufferedReader(new FileReader("RIGHT.DAT"));               BufferedWriter output = new BufferedWriter(new FileWriter("OUTPUT.DAT"));                Joiner joiner = new Joiner();           joiner.join(leftReader, rightReader, output);         }              catch (Throwable e) {           e.printStackTrace();         }       }     }      After applying the ideas from the proposed answer, I changed the loop to this               private void join(RandomAccessFile left, RandomAccessFile right, BufferedWriter output) throws Throwable {              long _pointer = 0;              RandomAccessFile _left = left;         RandomAccessFile _right = right;              BufferedWriter _output = output;              Record _leftRecord;         Record _rightRecord;              _leftRecord = read(_left);         _rightRecord = read(_right);              while( _leftRecord != null && _rightRecord != null ) {                  if( _leftRecord.getKey() < _rightRecord.getKey() ) {                 write(_output, _leftRecord, null);                 _leftRecord = read(_left);             }             else if( _leftRecord.getKey() > _rightRecord.getKey() ) {                 write(_output, null, _rightRecord);                              _pointer = _right.getFilePointer();                 _rightRecord = read(_right);             }             else {                           long _tempPointer = 0;                 int key = _leftRecord.getKey();                                                                          while( _leftRecord != null && _leftRecord.getKey() == key ) {                     _right.seek(_pointer);                     _rightRecord = read(_right);                     while( _rightRecord != null && _rightRecord.getKey() == key ) {                         write(_output, _leftRecord, _rightRecord );                         _tempPointer = _right.getFilePointer();                         _rightRecord = read(_right);                      }                     _leftRecord = read(_left);                 }                 _pointer = _tempPointer;             }         }              if( _leftRecord != null ) {             write(_output, _leftRecord, null);             _leftRecord = read(_left);             while(_leftRecord != null) {                 write(_output, _leftRecord, null);                 _leftRecord = read(_left);                           }         }         else {               if( _rightRecord != null ) {                 write(_output, null, _rightRecord);                 _rightRecord = read(_right);                 while(_rightRecord != null) {                     write(_output, null, _rightRecord);                     _rightRecord = read(_right);                 }             }                    }         _left.close();         _right.close();         _output.flush();         _output.close();     }      _UPDATE_ While this approach worked, it was terribly slow and so I have modified this to create files as buffers and this works very well. Here is the update ...               private long getMaxBufferedLines(File file) throws Throwable {         long freeBytes = Runtime.getRuntime().freeMemory() / 2;              return (freeBytes / (file.length() / getLineCount(file)));     }          private void join(File left, File right, File output, JoinType joinType) throws Throwable {              BufferedReader leftFile = new BufferedReader(new FileReader(left));         BufferedReader rightFile = new BufferedReader(new FileReader(right));         BufferedWriter outputFile = new BufferedWriter(new FileWriter(output));         long maxBufferedLines = getMaxBufferedLines(right);              Record leftRecord;         Record rightRecord;              leftRecord = read(leftFile);         rightRecord = read(rightFile);              while( leftRecord != null && rightRecord != null ) {                  if( leftRecord.getKey().compareTo(rightRecord.getKey()) < 0) {                 if( joinType == JoinType.LeftOuterJoin                          || joinType == JoinType.LeftExclusiveJoin                         || joinType == JoinType.FullExclusiveJoin                         || joinType == JoinType.FullOuterJoin ) {                      write(outputFile, leftRecord, null);                 }                 leftRecord = read(leftFile);             }             else if( leftRecord.getKey().compareTo(rightRecord.getKey()) > 0 ) {                 if( joinType == JoinType.RightOuterJoin                          || joinType == JoinType.RightExclusiveJoin                         || joinType == JoinType.FullExclusiveJoin                         || joinType == JoinType.FullOuterJoin ) {                     write(outputFile, null, rightRecord);                 }                 rightRecord = read(rightFile);             }             else if( leftRecord.getKey().compareTo(rightRecord.getKey()) == 0 ) {                 String key = leftRecord.getKey();                  List<File> rightRecordFileList = new ArrayList<File>();                 List<Record> rightRecordList = new ArrayList<Record>();                 rightRecordList.add(rightRecord);                 rightRecord = consume(key, rightFile, rightRecordList, rightRecordFileList, maxBufferedLines);                      while( leftRecord != null && leftRecord.getKey().compareTo(key) == 0 ) {                     processRightRecords(outputFile, leftRecord, rightRecordFileList, rightRecordList, joinType);                     leftRecord = read(leftFile);                 }                      // need a dispose for deleting files in list             }             else {                 throw new Exception("DATA IS NOT SORTED");             }         }              if( leftRecord != null ) {             if( joinType == JoinType.LeftOuterJoin                      || joinType == JoinType.LeftExclusiveJoin                     || joinType == JoinType.FullExclusiveJoin                     || joinType == JoinType.FullOuterJoin ) {                 write(outputFile, leftRecord, null);             }             leftRecord = read(leftFile);             while(leftRecord != null) {                 if( joinType == JoinType.LeftOuterJoin                          || joinType == JoinType.LeftExclusiveJoin                         || joinType == JoinType.FullExclusiveJoin                         || joinType == JoinType.FullOuterJoin ) {                     write(outputFile, leftRecord, null);                 }                 leftRecord = read(leftFile);                           }         }         else {               if( rightRecord != null ) {                 if( joinType == JoinType.RightOuterJoin                          || joinType == JoinType.RightExclusiveJoin                         || joinType == JoinType.FullExclusiveJoin                         || joinType == JoinType.FullOuterJoin ) {                     write(outputFile, null, rightRecord);                 }                 rightRecord = read(rightFile);                 while(rightRecord != null) {                     if( joinType == JoinType.RightOuterJoin                              || joinType == JoinType.RightExclusiveJoin                             || joinType == JoinType.FullExclusiveJoin                             || joinType == JoinType.FullOuterJoin ) {                         write(outputFile, null, rightRecord);                     }                     rightRecord = read(rightFile);                 }             }                    }         leftFile.close();         rightFile.close();         outputFile.flush();         outputFile.close();     }          public void processRightRecords(BufferedWriter outputFile, Record leftRecord, List<File> rightFiles, List<Record> rightRecords, JoinType joinType) throws Throwable {              for(File rightFile : rightFiles) {             BufferedReader rightReader = new BufferedReader(new FileReader(rightFile));             Record rightRecord = read(rightReader);             while(rightRecord != null){                      if( joinType == JoinType.LeftOuterJoin                          || joinType == JoinType.RightOuterJoin                         || joinType == JoinType.FullOuterJoin                         || joinType == JoinType.InnerJoin ) {                                         write(outputFile, leftRecord, rightRecord);                 }                 rightRecord = read(rightReader);             }             rightReader.close();         }              for(Record rightRecord : rightRecords) {             if( joinType == JoinType.LeftOuterJoin                      || joinType == JoinType.RightOuterJoin                     || joinType == JoinType.FullOuterJoin                     || joinType == JoinType.InnerJoin ) {                                     write(outputFile, leftRecord, rightRecord);             }         }     }          /**      * consume all records having key (either to a single list or multiple files) each file will       * store a buffer full of data. The right record returned represents the outside flow (key is       * already positioned to next one or null) so we can't use this record in below while loop or       * within this block in general when comparing current key. The trick is to keep consuming       * from a List. When it becomes empty, re-fill it from the next file until all files have       * been consumed (and the last node in the list is read). The next outside iteration will be       * ready to be processed (either it will be null or it points to the next biggest key      * @throws Throwable       *       */     private Record consume(String key, BufferedReader reader, List<Record> records, List<File> files, long bufferMaxRecordLines ) throws Throwable {         boolean processComplete = false;         Record record = records.get(records.size() - 1);              while(!processComplete){             long recordCount = records.size();             if( record.getKey().compareTo(key) == 0 ){                 record = read(reader);                                 while( record != null && record.getKey().compareTo(key) == 0 && recordCount < bufferMaxRecordLines ) {                     records.add(record);                     recordCount++;                     record = read(reader);                 }             }             processComplete = true;             // if record is null, we are done             if( record != null ) {                      // if the key has changed, we are done                 if( record.getKey().compareTo(key) == 0 ) {                          // Same key means we have exhausted the buffer.                     // Dump entire buffer into a file. The list of file                      // pointers will keep track of the files ...                                         processComplete = false;                     dumpBufferToFile(records, files);                     records.clear();                     records.add(record);                 }             }         }         return record;     }          /**      * Dump all records in List of Record objects to a file. Then, add that       * file to List of File objects      *       * NEED TO PLACE A LIMIT ON NUMBER OF FILE POINTERS (check size of file list)      *       * @param records      * @param files      * @throws Throwable       */     private void dumpBufferToFile(List<Record> records, List<File> files) throws Throwable {         String prefix = "joiner_" + files.size() + 1;         String suffix = ".dat";         File file = File.createTempFile(prefix, suffix, new File("cache"));         BufferedWriter writer = new BufferedWriter(new FileWriter(file));                     for( Record record : records ) {             writer.write( record.dump() );         }              files.add(file);         writer.flush();         writer.close();     }


What is the best use case for selenium?

I've been trying to develop web applications while at the same time creating the testing. I understand unit testing, I can declare a test method and test specific methods in my application. But I don't see what is the best way to use selenium web driver for testing. I tried to test the a specific site for broken links or broken images and I had to use an external http connection library since selenium doesn't provide header results etc. It is very slow to traverse a whole site. While you can just pass the URL to W3C link checker and you're done. Are most developers creating a class for each page and testing individual ui elements since traversing the whole site is a lot more complicated. What are the benefits selenium brings or ui testing that can't be tested for with unit testing?


How do you wrestle the DRY principle with configs?

For instance, lets say we have an nginx config pointing at foo1, foo2, and foo3, as well as a haproxy config pointing at foo1, foo2, and foo3, and finally, a deployment tool pointing at the same respective servers. How does one reconcile this? Build some sort of configuration generator for nginx and haproxy based on the hosts? It seems as though this would make grepping difficult and potentially hinder readability of the configuration files in general.


Handling contacts imported from users email account

In my web application, I give the user the option to import all of his/her contacts from their email account, and then send out invites to all of these accounts or map the user to the existing accounts based on emails. Now the question, is once all of these contacts are imported, would it be right to save these contacts back for repeated reminders, etc.? I am quite confused here because that is the way all of the sites operate, but would that not be violation of data privacy? Is there an algorithm for this?


How to make .exe file from html5 css application?

I would like to make windows desktop application using HTML5, JavaScript and CSS. I am trying   * tidesdk   * XULRunner   * appjs I read the documentations of these technologies. But I didn't see how to export the application as a .exe package. I want to write an application in HTML and JavaScript and export to an exe file. How can I do that?


What tricks/tips do you use for innovation?

I am looking for a few ideas on how to change a highly conventional work culture to be more innovated in their approached to problem solving. I've come across this article and am looking for more specific and practical ways that we as developers can help each other think outside of the box. I've constructed a simple formula of how to energize innovation in my everyday development. (Please critique this for improvement) Input External Data/Info -> Creates New Ideas/Concepts -> Communicates/Shares Ideas -> Trusts Others -> Risks Trials -> Innovation Happens What are some of your attitudes, thought processes, and behaviors towards approaching a challenging problem in way that would be considered innovative?


"My stuff" vs. "Your stuff" in UI texts

When refering to a users stuff should you use _My_ or _Your_ , for example: > My Cart | My Account | My Wishlist Or > Your Cart | Your Account | Your Wishlist I found this article that argues for the use of _your_. It says flikr does this. It also says MySpace and MyYahoo are wrong. I also noticed today that Amazon uses the term _Your_. However, I have heard they are the masters at testing variations and finding the best one, so what you see on their site might be the best variation, or simply something they are currently testing. I personally like the way _my_ looks better, but thats just my opinion. What do you think? What will hever the better impact on customers? Does it really even matter?


Should I store log files in version control

The log files in question are metrics log files. One of them is a project file produced by SourceMonitor, to which I regularly add checkpoints to chart the progress of projects.


How should you deal with a popular project that you no longer want to maintain?

I am the maintainer of a project which has a large non-technical userbase. I've been maintaining it for about 4 years now and adding new features as they've been requested. I'd like to move on to other projects now and stop developing for this application. Because of the non-technical nature of the users, there have been very few code contributions in the past. I don't believe I will be able to find anyone else to take over the project in my stead. Bugs, issues, feature requests - these are still coming in. I am still responding to emails for help, as I am not sure if I should ignore them, tell them that I'm not working on the application, or if I should respond to emails in only certain cases. What is the best way to 'abandon' this project, but still let users use the application?


Manage feature set of one app on multiple platforms/codebases

So I develop an app that is for both Android and iOS. From time to time changes occur when working on one version that need to implemented on the other. I find it tedious to keep track of these changes so I don't forget them later. I'm just curious as to what other workflows you guys use when managing a single feature set to be implemented in various projects. Thanks


How to explain to your colleages to stop creating packages and classes named "Utils"?

In most of the projects at work it will eventually show up a package, a class (or multiple packages and classes) named "Utils", where every kind of function is dumped into. It becomes excruciating harder and harder to navigate the project without a properly named structure. I have tried to ask to stop using "Utils". When I find it if and the change to the codebase is small I normally refractor it and remove them, but they always end on showing up cluttering the code. So do you know any strategy to make them stop doing this? Or am I just being a nagger?


When should code favour optimization over readability and ease-of-use?

I am in the process of designing a small library, where one of my design goals is that _the API should be as close to the domain language as possible_. While working on the design, I've noticed that there are some cases in the code where a more intuitive, readable attribute/method call requires some functionally unnecessary encapsulation. Since the final product will not necessarily require high performance, I am unconcerned about making the decision to favour ease-of-use in my current project over the most efficient implementation of the code in question. I know not to assume readability and ease-of-use are paramount in all expected use-cases, such as when performance is required. I would like to know if there are more general reasons that argue for a design preferring more efficient implementations—even if only marginally so?


Languages with similar features to JavaFX Script

I just completed a small project in JavaFX, only finding that it has been declared dead by Oracle. JavaFX Script actually seemed to be a pretty interesting language with some neat features for its domain, particularly with bind for data binding and on replace for triggered events. These features actually make the language very useful for small, quick, RIA type apps, which leads to my question: **Are there any _mainstream_ languages with features similar to bind and on replace?** After working with JavaFX, I got some ideas for some small personal (academic) projects that could take advantage of these features, but I would prefer to not start anything new in a language considered extinct by its owners.


Software design methods for Java or any other programming language

I'm junior programmer and I would like to know how professionals write their code or which steps they follow when they are creating new software. I mean, which steps they follow, which programming methodology, software architecture design application software, etc. I would like to find a tutorial where they explain from the beginning which steps I have to follow from The Idea I have in my mind to the final version of the application in any language. Or perhaps how is your programming steps or rules that you used to follow. Because everytime I want to create the an application I spend few time on the design and a lot of time coding (I know, that's not good).


What features are helpful when performing remote debugging / diagnostics?

Obviously, the easiest way to solve a bug is to be able to reproduce it in- house. However, sometimes that is not practical. For starters, users are often not very good at providing you with useful information. > Customer Service: "what seems to be the issue?"   >  User: "It crashed!" To further compound that, sometimes the bug only occurs under certain environmentally conditions that can not be adequately replicated in-house. With that in mind, it is important to build some sort of diagnostic framework into your product. **What types of built-in diagnostic tools have you used or seen used?** Logging seems to be the predominate method, which makes sense. We have a fairly sophisticated logging frame work in place with different levels of verbosity and the ability to filter on specific modules (actually we can filter down to the granularity of a single file). Error logs are placed strategically to manufacture a pretty good representation of a stack trace when an error occurs. We don't have the luxury of 10 million terabytes of disk space since I work on embedded platforms, so we have two ways of getting them off the system: a serial port and a syslog server. However, an issue we run into sometimes is actually getting the user to turn the logs on. Our current framework often requires some user interaction.


Data structure supporting the following operations

I'm looking for a data structure for working with a set of data which is most efficient to do the following :   1. Check whether an item has been categorized or not. (The categorized and uncategorized set are disjoint sets).   2. Get the category of an item.   3. Get all the items in a particular category.   4. Get all the uncategorized items.   5. Remove a particular item from the data set. I was thinking of having a `Dictionary<String, Set<String>>` to hold all the items in a given category, but that doesn't solve 2.


Is wrapping a third party code the only solution to unit test its consumers?

I'm doing unit testing and in one of my classes I need to send a mail from one of the methods, so using constructor injection I inject an instance of `Zend_Mail` class which is in Zend framework. Now some people argue that if a library is stable enough and won't change often then there is no need to wrap it. So assuming that `Zend_Mail` is stable and won't change and it fits my needs entirely, then I won't need a wrapper for it. Now take a look at my class `Logger` that depends on `Zend_Mail`:               class Logger{         private $mailer;             function __construct(Zend_Mail $mail){             $this->mail=$mail;         }            function toBeTestedFunction(){           //Some code           $this->mail->setTo('some value');           $this->mail->setSubject('some value');           $this->mail->setBody('some value');           $this->mail->send();          //Some        }             }      However, Unit testing demands that I test one component at a time, so I need to mock the `Zend_Mail` class. In addition I'm violating the **Dependency Inversion** principle as my `Logger` class now depends on concretion not abstraction. Now how can I test `Logger` in isolation without wrapping `Zend_Mail`?! The code is in PHP, but answers doesn't have to be. This is more of a design issue than a language specific feature


Server OS/Software Requirements For asp.NET Framework 4.0

**The Background:**   Me and my colleague are opening a new website design & development company. We have designed and implemented a website on Microsoft Visual Studio 2010 using Web forms in .NET Framework 4. Because I was new to asp.NET at the time, I wasn't sure what Database to use. Therefore I created a new "Microsoft SQL Server Database File" and added all the tables etc. I then worked with this configuration until the website was complete. The website works like a dream in Visual Studio. **The Problem:**   We were supposed to be buying a server from a local source that cannot be named, and this server was supposed to have Microsoft SQL server 2005 for the database, and I'm assuming IIS to configure the server and handle requests etc (please keep in mind that my knowledge of servers is limited) And this company were going to configure everything blah blah blah, get everything set up so all we have to do is put our website on it, and life is sweet. The problem is, this company have messed us about, told us this and that and it turns out they're very unreliable and untrustworthy. We've already spent a large sum of money with them and they are dragging their feet giving us the money back, saying what we asked is impossible, that we cant have SQL running on an old server yada yada yada. **The Question:**   I have an asp.NET website with a SQL server database ( .mdf file, if that helps anything ) and we need to know what do we need to get it on the internet. we've considered buying our own computer, putting MS server software on it, installing SQL server 2005, installing IIS and running it off that. But we don't know what to do or how to do it. Before all this server hastle kicked off, i tried installing a copy of IIS on my computer, and hosting it from there as a test to get me used to the software, however I tried multiple tutorials, and all sorts and could not get our website to host! There may be examples of this all over the internet but i cannot find an answer. I dont understand most of the things people are talking about on these articals. I know I've rambled, But basically. I just need to know HOW to put an asp.NET application on the internet, and what minimum requirements I need. Do i even need SQL server software on my server? or is that purely for interacting with the sql database?


An intern interview with Microsoft

I'm currently in my second year(Computer Science and Mathematics). In two days I have an interview on campus with Microsoft. I'm a bit nervous, because this will be my first in person interview. I have done reviewed basic things like linked list and binary trees. I am not really sure what kinds of questions I'll be asked. Has anyone been to such interview? If so what's it like? What kinds of questions will I be asked? Any help/suggestions will be much appreciated! Also can someone provide me with a list of things I ought to know for the interview?


Open source engagement as a professional reference

if one commits his or her time to an open source project, he or she may be invest a substantial amount of time without getting paid. As much as altruism is appreciable, I wonder whether it "counts" as an activity which can be shown and is valued in job applications. If the company is worth your time and working power, which it should be in my honest opinion. So I wonder whether there is something like a common practice in open source projects for this matters. Say, something like > Mr. Martin has been working on our project for five years and has > contributed this and that,[...] I we wish him very best for his future. > > Mr. ChiefofProject I think this is a just concern. Do have experiences you can share?


12 year old son interested in Android programming

So, my 12 year old son is interested in programming for Android. He's never done a real program before, but he did play briefly with Alice. I'm trying to figure out what the best way to introduce him to programming would be, and more specifically, if it would be better for him to just jump into Android programming, or if I should have him do Java first. Any suggestions?


Does 'consider returning Null Object' apply to a DAO read method?

I was looking for an answer to the question of what a DAO should return when a search ends up to be for an entity that does not exist. There are some generic previous questions related to returning null, but I am looking for an answer specifically in the context of the DAO retrieve scenario.       To be clear, when I say _Null Object_ I am referring to the Null Object pattern. In the Java space, Josh Bloch recommends an empty collection solution in the book _Effective Java_ (See Item 43) which provides an very good introduction to the problem/solution.    Despite being aware of Bloch's advice when I first wrote this question I considered returning null appropriate in a read/retrieval scenario. I'm in good company making a mistake with nulls.


How mature is PyPy?

I am trying to determine the maturity of PyPy by other means than reading the opinion of the developers. Therefore, I am interested in hearing about any high-profile mission-critical projects using PyPy. All other indicators of maturity seem fine. I am just missing this one before I decide on utilizing it for my main project.


Rules of thumb regarding breaking into sub-projects

We are building a Game Client and Server, our system is broken into four major projects: (Client and Server, Shared Interfaces, Source Art). In addition, both client and server have a set of libraries where we put shared code for client and server respectively. As you can imagine this leads to a lot of projects, I count 12 projects in the entire source. My questions are; What are the good rules of thumb regarding when to keep code in one project versus breaking it into sub projects. No one likes a large monolithic project but lots of small projects also add a lot of overhead. Should all projects be branched and released in lock-step to keep things simple (one current version number for all) or should library projects be branched and released separately only when they change. This will lead to complex map of compatible versions. I know there is no absolute answer for these questions but what are the known best practices when deciding and/or good reference material to read up on this subject?


How to design extension mechanism for java app

I have an application where I have a set of core features.   1. The application itself HAS to work in core only mode.   2. I would also want to make the application extensible such that, when certain jar/plugin files exist in the classpath/installation location, additional features would be available, things would just be there. This is OPTIONAL. The way I would do it is using the factory pattern with a modification. In the core package, I have an extension point (implemented by either a public static variable or a singleton, or other extension point model from my framework - Eclipse RCP). The extension jars/plugins get this extension point and registers its factory object to this extension point. (This is best done with RCP plugin/feature activation mechanism, or it can just be anything that causes a load of the extension jar/plugin factory class) When the application runs, the core factory would produce objects from the extension factory if one has been registered or use its core factory otherwise. This is how the application goes from core mode to extension mode if an extension jar exists. I wonder if this is a decent way to do what I wanted to do or this is just a hack, anti-pattern, etc... Please propose a better solution if you can. Thanks.


Methodologies of a high class development team

I've recently been tasked with increasing standards and efficiency within a development team. I've read similar posts about the makings of a good development team but these often discuss the human elements such as "passion for learning", "being a team player" etc. These are all of course important but I'm particularly interested in ideas surrounding practical methodologies. Some are just plain obvious, for example, my first implementations are:   * Implementation of Source Control - well, do I have to even explain why?   * A structured method of deploying builds that everybody adheres to - makes deployment easier for all involved   * Coding standards - ensures everybody is working in the same way and (hopefully) reduces technical debt   * Encouragement to make use of the developer community e.g. StackOverFlow and the like - keeps us in the loop with the big bad world and brings in ideas from outside our office walls What practical methodology does your team employ that you feel makes a tremendous difference to the productivity and overall "goodness" of a development team?


object model and data model

I have heard/read mixed things on whether to start with an object model or a data model. And more people say to starting with an object model as it will ease your data modelling. My question is, Shouldn't an object model always drive the design of data model? Why and When would a data model design be different than an object model? If we have a good object model, shouldn't the classes we come up with translate into tables? And class associations as table relationships?


For instance methods, would always returning self or this, instead of using a void return type, be a clean coding style?

I just came across this article, and in particular, this answer. Essentially they're talking about returning `self` from instance methods to allow for method chaining. That being said, one of the first thoughts that came to mind was, _Why not always take instance methods with`void` return types and make them return `this` or `self` instead?_ The next thought, which came to mind immediately, was, _There's probably a reason this isn't more common._ So what could be the harm in it? It seems like there honestly wouldn't be any. The reason is that nothing about the mere existence of a return value implies or even seems to imply the need to use that return value. If the method is a specialized getter or file reader or something, that's one thing, but if people aren't looking to use the return value, they naturally won't pay one any attention. Furthermore it shouldn't be too confusing, because `return this;` is pretty trivial; at most, somebody would probably think it's irrelevant. It certainly seems like it wouldn't hurt anything, and it's generally better to have too much than too little.


How to evaluate the quality of Rails code?

**In a code review, what do you look for to assess a developer's expertise?** Given an opportunity to look at a developer's work on a real-world project, what tell-tale signs are a tip-off to carelessness or lack of experience? Conversely, where do you look in the code to find evidence of a developer's skill or knowledge of best practices? For example, if I'm looking at a typical Rails app, I would be happy to see the developer is using RSpec (showing a commitment to using test-driven development and knowledge that RSpec is currently more popular than the default TestUnit). But in examining the specs for a Rails model, I see that the developer is testing associations, which might indicate a lack of real understanding of Rails testing requirements (since such tests are redundant given that they only test what's already implemented and tested in ActiveRecord). More generally, I might look to see if developers are writing their own implementations versus using widely available gems or if they are cleaning up code versus leaving lots of commented-out "leftovers." What helps you determine the skill of a Rails developer? What's your code quality checklist?


Top down or bottom up approach?

I'm an interface designer and now I'm working with a team of programmers to develop a new CMS for a heavy media site. As I've started developing a specification list for a prototype it turned out a very big one. I do realize now that the client-side will be JS heavy, with lots of DnD and other "cool designer stuff". The CMS will even include a small project management system for its users, nothing big like Basecamp, but with a live feed of comments etc. The problem is the the team has now separated. Someone is proposing the existing backend solution used in other CMS, someone is proposing to rewrite everything from scratch. The point to keep the code is that it is faster, the point to rewrite is to make it better for the proposed design (include Node.js and other stuff I don't actually get). The question is — can the UI specs influence back-end? The guys that propose to use the existing solution did everything with the Yii framework (as far as I know), and they say that everything on server is not affected by this "interface coolness". Others say that it does, that even autosave can't work without server load.


Writing a bootloader with no bootloader

I have a question that I really can't find a straight answer to. Let me start by saying I'm not asking for a step by step tutorial, or even plan on doing anything. I'm just curious. I've been reading up all day on the development of operating systems, and how they're built from scratch. I have a pretty firm grip on the theory of it. However, there is one step I can't seem to find an answer for. Before the existence of a full on, tool filled operating system, how would one even write a simple boot loader for a computer that doesn't any have a boot loader, or anything for that matter, in its boot sector? What would the very first step be after acquiring a computer with the bare minimal? (I.e., screen, keyboard, processor, ram, hdd, floppy)


I have to use Visual Studio 2005. What are good alternatives to using LINQ?

I have recently started a new job and am being forced to use VS 2005 and .NET 2. This has been quite painful for a number of reasons, but the one big change from VS 2005 to its successors was the introduction of LINQ and extension methods. A common pattern that I used to follow when using enumerations was the following:               foreach(var myObject in myObjects.Where(x => x.Property == someValue)     {         //Do some stuff     }      What I am having difficulty with is coming up with a succinct way of expressing the same statement in C# 2. The best I have come up with is the following:               foreach(MyObject myObject in myObjects)     {         if(myObject.Property == someValue)         {             //Do some stuff         }     }      Is there a more effective or efficient way of writing this code? How would you write C# 2 code so that it can most easily be transformed into C# 5 code (we will be upgrading to VS2012/.NET 4.5 after the next release)?


Interrupting Work Productivity: The Name?

Certainly it is a productivity killer when a developer is constantly interrupted by other workers, bosses, etc - but it is even worse when the developer is constantly interrupted by his or her own tools and equipment. For example, if a developer must wait 10 minutes for each build he makes - so that he can iteratively test code he is working on, the effect on productivity is devastating. Or perhaps the build is fast, but copying the bits to a test VM takes 3 minutes. Once again, the developer is being vexed by a lack of "responsiveness" in the tools and procedures being followed. I believe there is a name for an environmnent that is free of these problems, or perhaps a name that is plagued with these process and tool interruptions. I can't recall the name or industry "label" for this. Anyone recall?


Can you program Android Apps in a functional language? I meant is it possible to program for Android in a language that was designed from the ground up to be functional? I'm aware that you can use the functional components of an OO or a procedural language to program in a functional style, I was asking whether it would be applicable to use one of the "functional languages" on Android.


Object oriented design importance

I started studying Object Oriented Design and Modelling using the this book by James Rumbaugh. It uses a tool called Object Modeling Technique (OMT). I have certain newbie questions. I searched the net, but couldn't get answers   1. The book is pretty old. Don't know why the school told me to learn this. I know OMT is a predecessor of the Unified Modeling Language (UML). So its a waste?   2. Whether the concepts change very much when we move from OMT to UML? I know OMT has Object, Dynamic and Functional Model. Wikipedia says UML is compatible with OMT and UML is a model too.   3. As per wikipedia the UML models are Static and Dynamic and they are represented by different diagrams like class, object, activity, sequence..... I couldn't find the equivalence of this in OMT.   4. I read that there are many object oriented development methods like OMT, Booch,.... Which one is used by Industry ?   5. Where could I get a comparison of different Object oriented development methods?


Database development/admin - What exactly should I be trying to learn?

I've been a bit weary about approaching learning databases. I've dabbled into them before, and "DATA" in itself appeals to me a lot. Maintaining/searching/moving, everything about it in the abstract sense I love. (This isn't a career question, this is a learning question.) But as RDBMS's begin to be easier to maintain, and with tools that "anyone" can use to manage data I feared for the database admin jobs. (Yet I see jobs for SQL everywhere!). I know "No-SQL" was a big deal but it kinda has its niche. But that leaves me here... unsure of really "what" to study. What tools should I have in my tool belt? I'm sure RDBMS's will be around in both use and maintaining legacy code. But what else? Obviously data will always be around, but is this a secure field or a dying one? And what should I be concentrating on?


Can I legally use the icon of a different software?

Suppose I am including a feature in my image-viewing software, which opens an image in Photoshop ('Send to Photoshop'), using Photoshop's OLE automation framework. Am I allowed to use the icon of Photoshop.exe as the image of this 'Send to' button?


Am I experienced enough to learn and develop immediately using Ruby on Rails?

### General Question I understand that discussions revolving around questions of this form run the risk of becoming too specific to help others. So, perhaps a better, general question would be: > What kind of experience, if any, translates easily to Ruby on Rails; and if > none, then what's the learning curve like, in comparison to other popular > languages? ### Background I have the opportunity to build a website using whatever technologies I wish to use. It's a fairly simple website, for   * listing products,   * taking payments,   * managing customer data,   * providing a back-end portal for employees to manage data,   * possibly hooking in flight information (the products are travel related),   * possibly integrating a blog and all the social-networking goodies. ### Specific Problem I have to let the client know by tonight whether I'm interested in taking up this project, before he talks to other potential developers, but I'm on the fence.   1. I already work a full-time C++ development job, so the money doesn't do it for me. It's the opportunity to (be paid to) learn some new technologies and to have a real, running product in the end.   2. I've heard and read great things about Ruby, and am really intrigued.   3. I zipped through some introductory Ruby tutorials, no sweat.   4. However I found the Rails tutorials a little overwhelming, especially not being able to try it out anywhere.   5. And researching Rails hosts like Heroku and EngineYard makes me think that maybe I don't know what I'm getting myself into. The ship's leaving port! I wish I had more time to learn, better yet _play_ with the language, but I have to decide soon! Should I venture or pass? ### Additional Details My experiences are in C/C++/Tcl/Perl/PHP/jQuery, and basic knowledge of Java/C#. I didn't study C.S. formally so I wasn't exposed to design principles, programming paradigms, etc., which is my greatest concern. Will my lack of understanding in this realm make RoR frustrating to learn? Will it be so incompatible with a C++ "way" of thinking that I'll wish I never started? Am I putting my client at risk by attempting this? If it helps, I'm quick to learn new things (self-taught so far) and care a great deal about correctness, using things for their intended purposes, and so on. I've read numerous recommendations of **Agile Development with Rails** and would love to read it (though perhaps, while developing in parallel, for shortness of time). Worse comes to worst, I'd give up and do the standard LAMP gig, of course, not charging the client for wasted time. But I'm hoping to avoid the project altogether if it's gonna come down to that! Thanks in advance for any tips, insights, votes of confidence, votes of discouragement (for the better), and such.


Does anyone use Ceiling and *not* immediately cast it to an integer?

I think every single time I've used `Math.Ceiling` or its language variant, I've _always_ had to cast it to an integer. I mean... that's the whole point, isn't it? To get a whole number. So why doesn't it just return an `int`?


What is the right level of site blocking for you as a developer?

Almost all developers who work for a large corporation find themselves on the wrong side of site blocking software. It can be both frustrating ( _"Just let me read that damn blog!"_ ) and helpful ( _"Woah! Dodged a bullet with that site"_ ). In your opinion, what is the right level of blocking to apply to developers and why?


Cookie Settings Storage Method

I've got an web app that needs to store some non-sensitive preferences for the user. Right now I'm storing their language preference and what mode they want a window opened in by default in two cookies:   * "lang" can be "en" or "de"   * "mode" can be "design" or "view" I might add a few more in the future. I'm not sure how many, but probably never more than a dozen. Language is parsed on every request, whereas the mode cookie is only used occasionally. I saw a recommendation that made sense I shouldn't try to do what I was originally planning to do and strongly type a user settings class deserialized on each request because of the overhead involved. I see three options here and I'm not sure which is the best overall.   * Keep things as they are, add a new cookie for each new setting   * Combine the cookies into a single settings cookie and add future values to it   * Change the mode cookie to settings (leaving language alone), add new user settings values to the settings cookie All would work obviously. I'm leaning toward option three, but I'm not sure if there's a best practice for this?


Can I link to a gpl library from a closed source application?

Ok, before everyone goes shouting about duplicate questions, yes, I've already seen several questions like this here. But none answer the question. If I link against a gpl'd library without modifying that library, do I need to release my source code? According to this question Can I use GPL software in a commercial application the answer is yes! But this answer is not satisfactory to me. The answer basically says that I cannot use gpl code in any way without making my code open source. But, here is the question I'm really interested in, if the previous is true then that would indicate that no person or organization could ever release any proprietary software on Linux ever. Which must be wrong. Simply because in order for any application to do anything useful, open files, write to the console, create tcp connections, the application must be linked to `libc` which is GPL'd. So my question is this, if the GPL states, as all the previous answers on the site say it does, that a program which links to another gpl program must be gpl itself, how is it possible to create/release/sell any proprietary application at all which runs on Linux? Since as I described above that application must be liked to gpl code just to run on Linux. A more practical example say I link to a shared library which is gpl'd in a non-gpl'd application, would that force the non-gpl'd application to become gpl'd? More specifically if I use a gpl library without modifying it, and then distribute that library as an `.so`so or `.dll` would that require my application be open source?


Why hasn't a faster, "better" language than C come out?

With all the new "modern" languages out today, how is it that C is still heralded as the fastest and "closest to the machine"? I don't really believe in there ever being only one correct way to do things, and C has been around for a really long time (since the 60's!). Have we really not come up with anything better than something written nearly 50 years ago? I am aware that modern languages are higher-level and take care of certain tasks like garbage collection and memory allocation and utilize libraries and such. I'm just asking why there has never been a true second option to C. Can it be that C is so perfect that no other way of operating a computer could be possible (developer-adoption aside)? **EDIT** Look, I'm not trying to knock C or whatever your favorite language is. I'm wondering why C has become the standard and why other alternatives never emerged and C was just "accepted".


How many developers on the same virtualized Windows Microsoft machine?

How many c# developers on the **same** virtualized Microsoft Windows edition is it sensible to have? If everyone uses their own documents and settings folder, should I expect it should be fine? Only Windows Server allows concurrent users if this option is enabled; How many concurrent users do you get out of the box?


Why isn't there a python compiler to native machine code?

As I understand, the cause of the speed difference between compiled languages and python is, that the first compiles code all way to the native machine's code, whereas python compiles to python bytecode, to be interpreted by the PVM. I see that this way python codes can be used on multiple operation system (at least in most cases), however I do not understand, why is not there an additional (and optional) compiler for python, which compiles the same way as traditional compilers. This would leave to the programmer to chose, which is more important to them; multiplatform executability or performance on native machine. In general; why are not there any languages which could be behave both as compiled and interpreted?


What is the correct pattern to use in this case?

I'm sure this scenario has arisen before, and I want to know what experience has taught to be the best solution. I have a number of classes that are all of a kind. Say all the objects are "Content". They may be "Article", or "Book" for example. The reason I want the "Content" abstraction is because I want to define a number of behaviours for all "Content" objects and not have to build a new DB Table and 10 classes of essentially the same code for each type of "Content". For example, to attach a "Tag" or a "Premise" to a content object would be much nicer if, say, I just had two columns one for ContentID and one for TagID. A solution I've played around with is to have a Content table with a unique ID, and then to have foreign key references on all the other tables (Book, Article, etc). This has actually proven quite solid, but I'm just not sure about it. Do you know how to call this described pattern?


Is this usage of extend relationship in a use case diagram correct?

On this picture: ![http://i.stack.imgur.com/hUoau.jpg](http://i.stack.imgur.com/DST87.jpg) Does updating grades extend a feature that shows grades? I am not sure if the notation is correct, so I am hoping you guys will know it.


Daily standups- yea or nay?

How valuable (or not) do you think daily stand-up meetings are? If you're not familiar with it, this refers to a daily meeting that is part of Scrum adherents (and some other agile methodologies). The idea is that you hold a daily meeting, timeboxed to 15 minutes, and in which everyone must stand (to encourage people to be to-the-point). In the meeting, you go around the room and each say: \- What you did yesterday \- What you plan to do today \- Any blockers or impediments to your progress. Do you think this practice has value? Has anyone worked at a place that's done it, and what did you think?


Frameworks for targetting multiple environments

What should drive the decision behind doing development upon one or more than one framework? For instance, an ERP is (mostly) run on a Windows station. It leverages full access to device's resources, like printers, barcode readers, fingerprint readers and the like. It's usually more responsive and easier do develop with. That being said, some parts of it must be accessed exclusively in self-service mode, by enterprise's customers, suppliers and partners. This could be accomplished with smartphones, tablets, or even desktops running a web browser. What are the economics behind that? Should two team be kept, each one doing work upon its own framework? Or the most permissive framework should be chosen? Should I care something other than HTML technologies? Should I consider native technology for each device?


CCtalk is it still a modern protocol or is it outdated?

I need to write some code to integrate a machine with a coin acceptor. This coin acceptor (euro's dollars etc), has several connection methods. The manufacturer wrote a C++ dll and a C# invoke example to use it with an usb connection. Its the only provided coding sample i could get my hands on so far. However also two other connectors are available One is yet to me unknown, seams some hardware io port. The other is a CC-talk connector. From what i've read about it, that's some kind of slow RS323 serial connection protocol that works in 2 ways and is commonly used in billing systems. I never heard about it before until now. SO I wonder if I should use it too. What I think of it is that it might be a pretty old protocol, but i am not sure. There is not much "CC-talk" on forums and only a few questions on stackoverflow. That might be a hint that it is old, or that it is something high secure and secret?. I'm looking for a bit guidance here, to decide where i put my energy. Might there be some programmers here perhaps who are familiar with CC-talk What is your opinion about it, is it an outdated protocol for old hardware these days mostly replaced by usb or tcp/ip networks. Or is there something very specific about it, and good about like well perhaps be able to create secure transactions and stuff like that. Just for the record my device and the coin machine are on a 1 meter distance, so i will not have problems with signal lose. (if that was good about cc-talk)


Are Java's public fields just a tragic historical design flaw at this point?

It seems to be Java orthodoxy at this point that one should basically never use public fields for object state. (I don't necessarily agree, but that's not relevant to my question.) Given that, would it be right to say that from where we are today, it's clear that Java's public fields were a mistake/flaw of the language design? Or is there a rational argument that they're a useful and important part of the language, even today? Thanks! **Update:** I know about the more elegant approaches, such as in C#, Python, Groovy, etc. I'm not directly looking for those examples. I'm really just wondering if there's still someone deep in a bunker, muttering about how wonderful public fields really are, and how the masses are all just sheep, etc. **Update 2:** Clearly static final public fields are the standard way to create public constants. I was referring more to using public fields for object state (even immutable state). I'm thinking that it does seem like a design flaw that one should use public fields for constants, but not for state… a language's rules should be enforced naturally, by syntax, not by guidelines.


Where should salt hash values come from?

When adding salt values to a hash value for something like a password that cannot be stored in plain text, what is the best place to get the salt values come from? For context, let us suppose this is for passwords on a webpage login.


How to extract the active code path from a complex algorithm

I have been puzzled lately by an intruiging idea. I wonder if there is a (known) method to extract the executed source code from a large complex algorithm. I will try to elaborate this question: Scenario: There is this complex algorithm where a large amount of people have worked on for many years. The algorithm creates measurement descriptions for a complex measurement device. The input for the algorithm is a large set of input parameters, lets call this the recipe. Based on this recipe, the algorithm is executed, and the recipe determines which functions, loops and if-then-else constructions are followed within the algorithm. When the algorithm is finished, a set of calculated measurement parameters will form the output. And with these output measurement parameters the device can perform it's measurement. Now, there is a problem. Since the algorithm has become so complex and large over time, it is very very difficult to find your way in the algorithm when you want to add new functionality for the recipes. Basically a person wants to modify only the functions and code blocks that are affected by its recipe, but he/she has to dig in the whole algorithm and analyze the code to see which code is relevant for his or her recipe, and only after that process new functionality can be added in the right place. Even for simple additions, people tend to get lost in the huge amount of complex code. Solution: Extract the active code path? I have been brainstorming on this problem, and I think it would be great if there was a way to process the algorithm with the input parameters (the recipe), and to only extract the active functions and codeblocks into a new set of source files or code structure. I'm actually talking about extracting real source code here. When the active code is extracted and isolated, this will result in a subset of source code that is only a fraction of the original source code structure, and it will be much easier for the person to analyze the code, understand the code, and make his or her modifications. Eventually the changes could be merged back to the original source code of the algorithm, or maybe the modified extracted source code can also be executed on it's own, as if it is a 'lite' version of the original algorithm. Extra information: We are talking about an algorithm with C and C++ code, about 200 files, and maybe 100K lines of code. The code is compiled and build with a custom Visual Studio based build environment. So...: I really don't know if this idea is just naive and stupid, or if it is feasible with the right amount of software engineering. I can imagine that there have been more similar situations in the world of software engineering, but I just don't know. I have quite some experience with software engineering, but definitely not on the level of designing large and complex systems. I would appreciate any kind of answer, suggestion or comment. Thanks in advance!


User stories as a contract definition?

I am often asked to write a requirements document for a new piece of work. I write requirements using user stories. The list of requirements is then used as a contract with the client denoting the functionality that will be delivered. The temptation them becomes to add more and more detail and more and more stories in an attempt to define a water-tight specification that rules out any expensive mistakes. The problem is user stories just don't seem well suited to this task. Can anyone offer any clarification on the role of user stories? For example, is the same user story appropriate for client, programmer and the author of a functional spec? Regressing a little, perhaps I'm also asking what is the best way to define a contract of what will and will not be delivered in a software project?


How do I decide whether to take a job I can't add to my portfolio?

I am a programmer, but since I've barely been in the professional market my portfolio is rather bare right now. Still, I started to try and get my website up and running to help a little bit, but what I really need right now is to be able to expand my portfolio. I have a guy who wants me to do a lot of work for him, and I'm willing to do it for a while at least until I can get better jobs. The real problem, though, is that he does not want me to tell anyone that I have been doing work for him. Naturally, since I'm both trying to earn money and expand my portfolio, this poses a problem. Part of the reason for doing an app was to prove I can develop one, but if I can't tell anyone I wrote it, then developing the app seems pointless; I may be better off creating my own app and eating the loss in profit because I can get more work out of it, but of course, at the same time, I'm in desperate need of cash. I do have jobs lined up elsewhere, but I'll likely get paid faster through doing this specific job. What factors should I be looking at when making a decision on whether or not I should take a job for money that I can't talk about?


Why do people rewrite some libraries to many programming languages?

There are some libraries, which are available in their versions written in many different programming languages, like for example Lucene, which is written in Java (as they say, 100% pure Java), but has also its versions in C++, C, Perl, Ruby, Lisp and some other languages. And I'm talking about _implementations_ in these languages, not just FFI interfaces. Why do people do that? I can see one obvious reason: deployment and distribution (and probably development as well) easier when a project has fewer dependencies. But is there anything else? In what situations is it worth it?


How to manage a developer with good knowledge of programming language but very poor analytical skills

I work as a team lead in a fast-growing services company. There is one developer in my team who's not performing well, and unable to solve even the simplest of the problems without being spoon-fed. I have held multiple meetings with him and even sat next to him while coding to understand the root cause of the problem. He has very good grip on Java, however he lacks the analytical skills and IQ to understand the problem at hand and arriving at a solution. When I sat with him while coding, I noticed that he has good domain knowledge, awarness about the code base, but he cannot think and get solution to the problems and was unable to fix the bugs. He's also a comp sci., graduate. He knows that he is not performing well and I have tried motivating him, punishing him etc. He does spend a lot of effort and he is also focused. But there is no improvement in his performance. Now, he's asking me for suggestions about what kind of job should he go for. He's very hard working and focused, it's just his inability to solve problems that is preventing him from performing. Should he be sent into software testing projects? Should we suggest him to go into technical support? What suits him the best based on the problem he is facing? Perhaps a technical writer job or something like that. Please let me know your opinions on this, so I can advise him appropriately.