What non-programming tools do programmers use?

I'm reading _Code Complete_ with the intention of learning how to better structure my code, but I'm also learning a lot about how many aspects of programming something there are that aren't just writing the code. The book talks a lot about problem definition, determining the requirements, defining the structure, designing the code, etc. What tools are used for these non-writing steps of programming? Is there software that will help me design and plan out what I'm going to write before I do?


Can I use a part of another program without having to give away my rights on my own code?

I'm currently making a game and want to use some textfiles (lists of names) that are covered under the GNU General Public License (or the Attribution- ShareAlike 3.0 Unported License). Do I have to release my whole game under one of these licenses if I only used these (relatively small) files in my game or is it just these files I have to keep licensed like that? If this is not permitted am I allowed to do this anyway if I choose not to actually release my code and only "hosted" this game, since it's a web game.


Partitioning set into subsets with respect to equality of sum among subsets

Let's say I have `{3, 1, 1, 2, 2, 1, 5, 2, 7}` set of numbers, I need to split the numbers such that sum of subset1 should be equal to sum of subset2 `{3,2,7} {1,1,2,1,5,2}`. First we should identify whether we can split number(one way might be dividable by 2 without any remainder) and if we can, we should write our algorithm two create s1 and s2 out of s. How to proceed with this approach? I read partition problem in wiki and even in some articles but I am not able to get anything. Can someone help me to find the right algorithm and its explanation in simple English?


Future scope for a mobile Developer

I’ve started my career as a Software Tester but after 3 years I realized, it didn’t give me the so called job satisfaction and I made a brave decision to jump into software development arena. Finally I have become an Android Mobile developer and completed 1 year of experience. I love my job and I love every bit of it, but going forward I’m wondering what the scope for mobile developers is?? Developers who work with C# or Java have their larger scope and they can become architect etc in future. But as a mobile developer what can I achieve.. Mobile development architect is not something practical because mobile projects are small and it does not require much technical ability like j2ee project needs. Should I change my career track to Java or j2ee or something from mobile?? Any advice is appreciated.


How should templates be named?

In D I can create templates like this:               template Foo(A) {         A add(A a, A b) { ... }         A multiply(A a, A b) { ... }         A concatenate(A a, A b) { ... }     }      What should a template be named ideally? What conventions exist out there? I'm looking to something similar like 'function names must always start with a verb'.


Which is best for learning how to do a certain thing: writing your own or looking at someone else's?

Often when I'm writing code to do a certain thing, I'm faced with either writing my own or using someone else's code. Assume here that this "thing" is something that I've never done before and am interested in learning how it's done. **Which would you say is better from a learning perspective: try writing your own solution; or looking at code by someone else?** I've always written my own code if I have an idea on how to do it, but resorted to looking at someone else's when I don't have a clue. I believe that the best is probably a combination of both: make your own attempt and then look at how someone else did.


Examples of Java APIs that demand an action sequence

As part of a research I'm working on, I'm looking for public APIs that only work correctly when you apply a certain sequence of actions on them. For example, the `java.nio.channels.SocketChannel` class, from the Java standard library, only works correctly with sequences such as `open() -> connect() -> read() -> read() -> close()`. A more complete demonstration if how it may be used may be represented in the following graph: ![valid usage of SocketChannel](http://i.stack.imgur.com/zVOq9.png) Additional examples of Java standard library APIs that require certain sequences are `java.io.PrintStream` (very similar to the one above) and `java.util.Iterator` (which requires a `next()` call between every two `remove()` calls, thus enforcing a certain sequence). So, does you favorite API for doing X also behave that way? **I would very much like to know about additional APIs that require a certain method sequence for correct usage** ; especially classes that are not part of the Java standard library. The more complex the sequence(s) required, the better. * * * Some APIs require a sequence that spans across multiple classes, for example:               X x = new X();     x.setup();     Y y = x.createNewY();     Z z = new Z(y);     z.doSomething();      These examples are also interesting, but I'm mostly looking for sequences that all appear in the same class. * * * **EDIT** added bounty for greater visibility. I'm sure many of you have encountered many APIs that will match this description - I would really appreciate some good examples.


Types of quotes for an HTML templating language

I'm developing a templating language, and now I'm trying to decide on what I should do with quotes. I'm thinking about having 3 different types of quotes which are all handled differently:                                    backtick `     double quote "     single quote '     expand variables         ?              yes                 no     escape sequences        no              yes                  ?     escape html             no              yes                 yes      ## Backticks Backticks are meant to be used for outputting JavaScript or unescaped HTML. It's often handy to be able to pass variables into JS, but it could also cause issues with things being treated as variables that shouldn't. My variables are PHP-style (`$var`) so I'm thinking that might mess with jQuery pretty bad... but if I disable variable expansion w/ backticks then, I'm not sure how would insert a variable into a JS code block? # Single Quotes Not sure if escape sequences like `\n` should be treated as literals or converted. I find it pretty rare that I want to disable escape sequences, but if you do, you could use backticks. So I'm leaning towards "yes" for this one, but that would be contrary to how PHP does it. # Double Quotes Pretty certain I want everything enabled for this one. ## Modifiers I'm also thinking about adding modifiers like `@` or `r` in front of the string that would change some of these options to enable a few more combinations. I would need 9 different quotes or 3 quotes and 2 modifiers to get every combination wouldn't I? My language also supports "filters" which can be applied against any "term" (number, variable, string) so you could always write something like               "blah blah $var blah"|expandvars      Or               "my string"|escapehtml      Thoughts? What would you prefer? What would be least confusing/most intuitive?


Why use getters only as opposed to marking things final?

I'm working in a java role after working a couple years in functional programming. Our company was bought by google and I took a java role after the acquisition. Coming back to java as a polyglot developer, I'm generating getters for immutable objects and I'm seeing it's a total hogwash. Are there any reasons why the 'getField' convention should be used so prolifically? To me it seems almost horrifying at this point that so many libraries expect public getter methods to work with their functionality when simply making a field public and final would have the same effect as making only a getter on a public mutable field. Why isn't it more of a common practice to ditch the setters and just expose a final field? EDIT: I don't think this is actually the right forum as I think this is a discussion point rather than an answer after evaluating the perspectives.


Having an inherited function return the derived type instead of the base type

I am writing two classes in C#:   * A `Matrix` class that represents a general Matrix with n-by-m dimensions    * A `SquareMatrix` class that inherits from `Matrix` and has the constraint of being n-by-n The reason I designed it this way is because square matrices support additional specific operations like calculating the determinant or the inverse, so being able to guarantee that those functions are avaliable with the specific type you're using are nice things to have. Additionally it would support all the regular Matrix operations and can be used as a Matrix I have a function in `Matrix` called `getTranspose()`. It calculates the transpose of the Matrix and returns it as a new `Matrix` I inherited it in `SquareMatrix`, but because the transpose of a square matrix is guaranteed to be square matrix, I also want it to return a `SquareMatrix` I am unsure about the best way to do this.   * I can re-implement the function in `SquareMatrix`, but that would be code duplication because it's essentially the same calculation   * I can use implicit typecast operators, but if I understand correctly that would cause unnecessary allocations (upcast `SquareMatrix` to `Matrix`, create a new `Matrix` as the transpose, create a new `SquareMatrix` during typecasting and throw away the tranposed `Matrix`)   * I can use explicit typecast operators, but it would be stupid to have to typecast the transpose of a `SquareMatrix` explicitly, and it also has the same problem of the implicit operator with unnecessary allocations Is there another option? Should I change the design of having `SquareMatrix` inherit from `Matrix`? This problem also applies to operators. It seems that I have to either implement typecasting operators which might cost in performance, or have to re-implement the same code.


Should I take a job working with an esoteric language?

How worthwhile is it to take a job that will mainly involve working with an esoteric or niche language? Will this limit my prospect of moving back into languages that I prefer working with later in my career, or will the general experience of working in a software engineering job be enough? I suppose this question could be rephrased as: how much do employers care about specific language experience, as opposed to general programming experience and aptitude?


Design Patterns (java) -- Strategy with fields. Ever acceptable?

Both here on stack overflow and on Java Effective it is suggested that strategy design patterns should be stateless. In fact in the book it is also suggested to make each strategy object a singleton. The problem I have is that some strategies I envision for my program need states/fields. Either because they are path-dependent in their behavior or because I want them heterogeneous (a statistical distribution of similar strategies, if you prefer).   This forces me to break both Java Effective suggestions: I instantiate a new strategy for each user class AND each of these strategies contain its own fields.   Is that very bad? Should it be done differently? It was suggested to me to keep the fields that make the strategy heterogeneous in the class that uses it and then pass it as an argument. I find that very anti-oo. Those fields don't belong to the user class. In fact, if that class uses another strategy it might not need those fields at all. That seems to run against the reason I am using the strategy pattern in the first place.   Mostly I am just very confused * * * I make a simple example here. Imagine you have a class Gambler, which represents somebody making bets on horses. Now this class will require a strategy predictStrategy that will work something like this:               interface predictStrategy{         public Horse predictWinningHorse(HorseRace r);     }      Now, I can have many implementations where the strategy is to choose at random, or pick the white horse or whatever. That's easy.   Imagine though that I implement a strategy that looks at past predictions and somewhat "learns" from its past mistakes. Clearly each strategy will have to have its own memory on which to learn. I might have to add one more method to the interface (or make an extension)               interface predictStrategy{         public Horse predictWinningHorse(HorseRace r);              public void addObservation(HorseRace r, Horse oldPrediction, Horse actualWinner);     }      So that the Gambler class calls "strategy.addObservation(...)" at the end of each race to improve its predictive power.   Can this be **really** be done with a _stateless_ strategy object? It seems impossible to me.


Handling recurring cURL POST request

I've basically came here for some advise based on my criteria, The application I'm trying to build is built completely from an API. It's like a "marketplace bidding" application, what I'm trying to accomplish is an "Auto bidding" function, but for this to happen it will have to send a cURL POST request every 3 seconds based on criteria given, then return the JSON result for me to handle server side, I'd basically like a direction on what would be the best way to handle this kind of idea, I got told something called "polling" would work but I've never heard of it. Initially the idea is as provided below   1. Load set page "bid.php"   2. Enter certain criteria   3. Click submit as to which an "Ajax" request of some sort would start   4. The recurring cURL request would be activated through the Ajax.   5. Display the data back from the cURL request every 3 seconds via Javascript. I'm not initially asking for the work to be given to me, I'm just asking the professionals as to which they recon would be the best way I can do this task.


What should we tell our unsupported IE6 users?

In the upcoming version of our web app, we've broken IE6, and we don't intend to fix it. We've had a clear warning posted for IE6 users for some months; we've decided it's time not to support it. My question is: how should we communicate this to our users? Some people here feel that we should block IE6 users who would try to access the web app, because it's not going to work for them. Others feel that we should just leave up a warning, saying "This doesn't work in IE6," but not block them; instead, if they click to dismiss the warning, just let them in to the broken site to see for themselves that it doesn't work. Who is right? Is there a better way?


Simplest possible Paxos algorithm (distributed consensus) explanation

I am looking for a simple explanation of the **Paxos algorithm** that can be used for reaching consensus in a distributed environment (possibly peer to peer network). Every explanation I have encountered so far was a tough reading of multiple pages. I am looking for a simplified explanation that still preserves the core principles.


How do I prove or disprove "god" objects are wrong?

**Problem Summary:** Long story short, I inherited a code base and a development team I am not allowed to replace and the use of God Objects is a big issue. Going forward, I want to have us re-factor things but I am getting push-back from the teams who want to do everything with God Objects "because its easier" and this means I would not be allowed to re-factor. I pushed back citing my years of dev experience, that I'm the new boss who was hired to know these things, etc, and so did the third party offshore companies account sales rep, and this is now at the executive level and my meeting is tomorrow and I want to go in with a lot of technical ammo to advocate best practices because I feel it will be cheaper in the long run (And I personally feel that is what the third party is worried about) for the company. My issue is from a technical level, I know its good long term but I'm having trouble with the ultra short term and 6 months term, and while its something I "know" I cant prove it with references and cited resources outside of one person (Robert C. Martin, aka Uncle Bob), as that is what I am being asked to do as I have been told having data from one person and only one person (Robert C Martin) is not good enough of an argument. **Question:** What are some resources I can cite directly (Title, year published, page number, quote) by well known experts in the field that explicitly say this use of "God" Objects/Classes/Systems is bad (or good, since we are looking for the most technically valid solution)? **Research I have already done:**   1. I have a number of books here and I have searched their indexes for the use of the words "god object" and "god class". I found that oddly its almost never used and the copy of the GoF book I have for example, never uses it (At least according to the index in front of me) but I have found it in 2 books per the below, but I want more I can use.   2. I checked the Wikipedia page for "God Object" and its currently a stub with little reference links so although I personally agree with that it says, it doesn't have much I can use in an environment where personal experience is not considered valid. The book cited is also considered too old to be valid by the people I am debating these technical points with as the argument they are making is that "it was once thought to be bad but nobody could prove it, and now modern software says "god" objects are good to use". I personally believe that this statement is incorrect, but I want to prove the truth, whatever it is.   3. In Robert C Martin's "Agile Principles, Patterns, and Practices in C#" (ISBN: 0-13-185725-8, hardcover) where on page 266 it states "Everybody knows that god classes are a bad idea. We don't want to concentrate all the intelligence of a system into a single object or a single function. One of the goals of OOD is the partitioning and distribution of behavior into many classes and many function." -- And then goes on to say sometimes its better to use God Classes anyway sometimes (Citing micro-controllers as an example).   4. In Robert C Martin's "Clean Code: A Handbook of Agile Software Craftsmanship" page 136 (And only this page) talks about the "God class" and calls it out as a prime example of a violation of the "classes should be small" rule he uses to promote the Single Responsibility Principle" starting on on page 138. The problem I have is all my references and citations come from the same person (Robert C. Martin), and am from the same single person/source. I am being told that because he is just one guy, my desire to not use "God Classes" is invalid and not accepted as a standard best practice in the software industry. Is this true? Am I doing things wrong from a technical perspective by trying to keep to the teaching of Uncle Bob? **God Objects and Object Oriented Programming and Design:** The more I think of this the more I think this is more something you learn when you study OOP and it's never explicitly called out; Its implicit to good design is my thinking (Feel free to correct me, please, as I want to learn), the problem is I "know" this, but but not everybody does, so in this case its not considered a valid argument because I am effectively calling it out as universal truth when in fact most people are statistically ignorant of it since statistically most people are not programmers. **Conclusion:** I am at a loss on what to search for to get the best additional results to cite, since they are making a technical claim and I want to know the truth and be able to prove it with citations like a real engineer/scientist, even if I am biased against god objects due to my personal experience with code that used them. Any assistance or citations would be deeply appreciated.


Would it be bad design to abstract a graphics library and wrap it in a single class?

I'm starting a game project in C++ using the SFML. It provides various classes for handling graphics, input, etc, but I would like to wrap it all up in a single `Media` class. I believe that by doing so, I could simplify my effort and have the class take care of the details, limiting the amount of code I have to write and therefor limiting chances for a bug to sneak past my eyes. However, I have read several times that monolithic, do-it-all classes such as this might not be a good idea. Why is that?


Can I release a script that depends on both proprietary and GPL'd libraries to be run?

I'm writing my thesis project in GNU Octave. My project basically consists of a bunch of ".m" files that are written in Octave. I'm also using a proprietary (and unreleased) shared library developed by my supervisor. To be able to access the library, I've written an OCT-file wrapper (dynamic extension for Octave). My question is: am I allowed to distribute my ".m" files that depend on both Octave internals and the proprietary library? I'm not going to distribute any dependencies nor the wrapper files, just the ".m" files. Is it illegal to distribute these (I don't mind being forced to release them under a specific license) if they depend on a proprietary piece of software to be fully functional? Even if it's just to document my experiments? I've already asked at the Octave forums, but they were too passionate and aggressive and didn't give any useful arguments. I would like to hear facts, not ideology. PS: I know I could use MEX, which is the only explicitly allowed means of communication with proprietary libraries in Octave. However, it's not possible for technical reasons to use MEX in my case.


What's best practice for a SELECT * FROM SQL in PHP?

I need to make a "SELECT * FROM" Sql from PHP, that now returns about 10.000 records, that I insert in an Array and re-utilize in a page to show results in a table. I need to have all that elements also in a hidden input fields, to connect via API to a SMS service to send SMS               <input type="hidden" id="destinatariSMS" name="destinatariSMS" value="<?php echo htmlentities(serialize($destinatariSMS)); ?>" />      Obviously, with 10k elements loading of page is about 10-15 seconds (in a VPS with 2GB ram). I'm worrying because in about two months element will be 12-13k, about 1k elements at the month. I cannot paginate elements because I need all together in that input... In your opinion, what's best practice to no "destroy" VPS or browser? Thank you very much


Is it ever a good idea to use the design pattern name in the implementing classes?

Recently I came across a moderately large python codebase with lots of `MyClassAbstractFactory`, `MyClassManager`, `MyClassProxy`, `MyClassAdapter` etc. classes. While on the one hand those names pointed me to research and learn the corresponding patterns, they were not very descriptive of what the class **does**. Also, they seem to fall within the forbidden list of words in programming: `variable`, `process_available_information`, `data`, `amount`, `compute`: overly broad names, that don't tell us anything about the function **when used by themselves**. _So should there be`CommunicationManager` or rather `PortListener`? Or maybe I do not understand the problem at all...?_


Should I migrate to MVC3?

I have a MVC2 project, my question is: should I migrate to MVC3? Why? I'd like the opinion of some who already migrated, or at least used MVC3 and MVC2. Already read http://weblogs.asp.net/scottgu/archive/2011/01/13/announcing- release-of-asp-net-mvc-3-iis-express-sql-ce-4-web-farm-framework-orchard- webmatrix.aspx and I already know about the described tool for migrating: http://blogs.msdn.com/b/marcinon/archive/2011/01/13/mvc-3-project-upgrade- tool.aspx What I'd really appreciate is your valuable insight. Best regards.


Start a new project. Where is the inspiration?

_The question may seem strange at first glance_ ... And **I may be alone** in this situation. But currently I want to improve my skill through learning new framework. however, do a simple "`HelloWorld`" application does not satisfy me. I think a **practical project** is required to apprehend the basics of a framework. I know there is many scholar-like project like design a library manager or CMS. But I have recently planned to learn ~3 differents frameworks and I can't find any motivations through " _unexciting_ " project. In the end I have not started any framework ... I'm aware of _I do not develop the project of the year_ ... I'm just looking for something **a bit exciting**. **I do not expect any project subject** , anyway stimulation provided by a project is something subjective. But I want to know your inspiration ! (or method to learn framework ^^) I'm talking about web-dev framework but I'm open to any kind information !


Is a senior programmers advice about always using books a good idea?

I am a junior developer and have only been in the industry for 5 years. At my current company there is a senior let's call him Infestus. Occasionally I am being given opportunity to shine and do something completely brand new from scratch. One of the most recent examples was that I had to make a singleton in the multithreaded application. I have decided to use this method. As soon as Infestus saw it, he quickly proceeded to call me stupid and told me to use this approach. Upon asking him why he just brushed it off as this is better and that's how this and this book about java says it is better. And it is a common pattern, whenever I get a chance to do something new, I quickly get shot down by Infestus and the only reasoning why his method is books written by famous programmers. He is always trying to give me books to read so that I may "learn" which ways to program. I have only been programming for money for 5 years, but is it always a good idea to just blindly follow the book on best ways for solving a problem, or should I try experimenting every now and then? The constant barrage of complaints from the Infestus is starting to cause me to never try anything new and follow examples in books. EDIT: I am utterly lost. Yes I know that following anything blindly is a bad idea. But this godlike programmer Infestus who seems to know a lot, tells me that the only way to program properly is by reading books and following everything down to a T. All the rules he imposes are the ones written in books, so I am just wondering if books are the only correct way. EDIT2: Infestus is not my boss. He is just one of senior developers in charge of reviewing the code. And most of his comments after reviews consist of book names where such and such method is wrong.


Unit Test - an Enigma?

I am an objective-c/iOS apps developer and I was wondering if I perform Unit Tests on my code, how should I go about it? What is unit test anyway? Ain't I testing a specific part of code while running the whole app itself? What is its use? I have read few articles, wikipedia etc. but I am not sure whether unit testing is a time consuming or a time saving process. I know the definition but I am in the dilemma about its purpose. Plz guide a new bee here. :) Have already gone through the following: Unit testing best practices for a unit testing newbie


How would I go about changing encryption methods on existing passwords?

If I have an application that is using a less secure method for storing passwords, such as SHA-1, how would I go about converting to SHA-256 or SHA-512?


How can I move from Java and ColdFusion to Ruby on Rails?

Currently I work with ColdFusion 9+ and some Java in a Windows environment. Prior to ColdFusion, my background was in Java and JSP. I'm considering a move towards Ruby on Rails, as I think it would be a real challenge, keep things fresh, and provide more job opportunities. In order to get into it, I started to build my personal website in Rails 3.0. But what else can I do to make this transition from what I know now to Ruby and Rails? Are there specific or idiomatic aspects of Ruby or Rails I should keep in mind when switching over from a ColdFusion and Java mindset?


Alternatives to the repository pattern for encapsulating ORM logic?

I've just had to switch out an ORM and it was a relatively daunting task, because the query logic was leaking everywhere. If i'd ever had to develop a new application, my personal preference would be to encapsulate all query logic (using an ORM) to futureproof it for change. Repository pattern is quite troublesome to code and maintain so i was wondering if there are any other patterns to solve the problem ? I can foresee posts about not adding extra complexity before it's actually needed, being agile etc. but i'm only interested about the existing patterns solving a similar problem in a simpler way. My first thought was to have a generic type repository, to which i add methods as needed to specific type repository classes via extension methods, but unit testing static methods is awfully painful. IE:               public static class PersonExtensions     {         public static IEnumerable<Person> GetRetiredPeople(this IRepository<Person> personRep)         {             // logic         }     }


What is the justification for Python's power operator associating to the right?

I am writing code to parse mathematical expression strings, and noticed that the order in which chained power operators are evaluated in Python differs from the order in Excel. From http://docs.python.org/reference/expressions.html: _"Thus, in an unparenthesized sequence of power and unary operators, the operators are evaluated from right to left (this does not constrain the evaluation order for the operands): -1_ *2 results in -1."* This means that, in Python: `2**2**3` is evaluated as `2**(2**3) = 2**8 = 256` In Excel, it works the other way around: `2^2^3` is evaluated as `(2^2)^3 = 4^3 = 64` I now have to choose an implementation for my own parser. The Excel order is easier to implement, as it mirrors the evaluation order of multiplication. I asked some people around the office what their gut feel was for the evaluation of `2^2^3` and got mixed responses. Does anybody know of any good reasons or conciderations in favour of the Python implementation? And if you don't have an answer, please comment with the result _you_ get from gut feel - `64` or `256`?


Understanding the levels of computing

Sorry, for my confused question. I'm looking for some pointers. Up to now I have been working mostly with Java and Python on the application layer and I have only a vague understanding of operating systems and hardware. I want to understand much more about the lower levels of computing, but it gets really overwhelming somehow. At university I took a class about microprogramming, i.e. how processors get hard-wired to implement the ASM codes. Up to now I always thought I wouldn't get more done if learned more about the "low level". One question I have is: how is it even possible that hardware gets hidden almost completely from the developer? Is it accurate to say that the operating system is a software layer for the hardware? One small example: in programming I have never come across the need to understand what L2 or L3 Cache is. For the typical business application environment one almost never needs to understand assembler and the lower levels of computing, because nowadays there is a technology stack for almost anything. I guess the whole point of these lower levels is to provide an interface to higher levels. On the other hand I wonder how much influence the lower levels can have, for example this whole graphics computing thing. So, on the other hand, there is this theoretical computer science branch, which works on abstract computing models. However, I also rarely encountered situations, where I found it helpful thinking in the categories of complexity models, proof verification, etc. I sort of know, that there is a complexity class called NP, and that they are kind of impossible to solve for a big number of N. What I'm missing is a reference for a framework to think about these things. It seems to me, that there all kinds of different camps, who rarely interact. The last few weeks I have been reading about security issues. Here somehow, much of the different layers come together. Attacks and exploits almost always occur on the lower level, so in this case it is necessary to learn about the details of the OSI layers, the inner workings of an OS, etc.


Suggestions needed on an architecture for a multiple clients and customisable web application

Our product is a web based course managemant system. We have 10+ clients and in future we may get more clients. (Asp.net,SQL Server) Currently if one of our customers need extra functionality or customised business logic, we will change the db schema and code to meet the needs. (we only have one branch code base and one database schema) To make the change wont affect each others route, we use a client flag, which defined in a web config file, thus those extra fields and biz logic only applied to a particular customer's system.               if(ClientId = 'ABC')     {        //DO ABC Stuff     }     else     {        //Normal Route     }      One of our senior colleagues said, in this way, small company like us can save resources on supporting multiple resources. But what I feel is, this strategy makes our code and database even harder to maintain. Anyone there crossed similar situation? How do you handle that?


Should a programmer "think" for the client?

I have gotten to the point where I hate requirements gathering. Customer's are too vague for their own good. In an agile environment, where we can show the client a piece of work to completion it's not too bad as we can make small regular corrections/updates to functionality. In a "waterfall" type in environment (requirements first, nearly complete product next) things can get ugly. This kind of environment has led me to constantly question requirements. E.G. Customer wants "automatically convert input to the number 1" (referring to a Qty in an order). But what they don't think about is that "input" could be a simple type-o. An "x" in a textbox could be a "woops" not I want 1 of those "toothpaste" products. But, there's so much in the air with requirements that I could stand and correct for hours on end smashing out what they want. This just isn't healthy. Working for a corporation, I could try to adjust the culture to fit the agile model that would help us (no small job, above my pay grade). Or, sweep ugly details under the rug and hope for the best. Maybe my customer is trying to get too close to the code? How does one handle the problem of "thinking for the client" without pissing them off with too many questions?


Separating java projects

I have a large java project, and we use maven for our build cycle. This one project is used extensively - in other projects, in various applications, some of which are contained in it and some which are elsewhere... To be honest, it's a bit of a mess (various bits added on at different times for specific purposes), and I'd like to clean it up a bit. Also, it's not fully tested (lots of bits have been added on without proper unit and integration testing), and there are some tests that take a long time to run or don't actually pass... (uh-oh) - so tests are switched off in the maven build cycle (again, uh-oh). I am thinking about separating this large project into smaller specific projects, such that the 'final' sub-project (or several sub-projects) would pick up the various sub-projects that it would need. My thinking is as follows:   * if I separate the big project into various sub-projects, this makes it clear what each project's responsibility is.    * by separating into sub-projects, I can then clean up the testing of each sub-project individually, and turn on the testing for that sub-project in the maven build cycle. I am slightly concerned about what impact this might have on the build time.   * Would imposing a structure on the large project (i.e. into smaller sub-projects) slow the compiler down? Also, I have a slight concern on what impact this might have editing time in IDEs (we principally use Intellij). Intellij seems to build each project in turn through the dependency tree - i.e. if C depends on B depends on A, and I change A, it won't try to build B unless A compiles, and so on. Arguably that's advantageous, but I have found that if - for example, I change an interface in A that is widely used in B and C, it takes some time to fix all the errors from that change... Another question is how to use factory classes. Some aspects of the project depend on external jars. Occasionally (thankfully not often) these are updated, and we have to migrate. We tend to handle this by using a Factory class which points to the correct versions of the external code (so we don't have to change all the implementations throughout the code base). At the moment this is all in the large project, but I am thinking that by switching to sub- projects, I could develop a new project for the implementation of new external code, make sure that sub-project is fully functional and tested, and then switch the dependencies / factory class in the user project. However, this is made more complicated by the extensive use of interfaces throughout the large project. For example   * sub-project A - contains interfaces   * sub-project B - depends on A for interfaces and old external jar   * sub-project C - depends on B (and thus A and old external jar), and contains a Factory class that uses B's implementations of interfaces If I need to change the external jar of B, I can:   * create sub-project B_ii - again depends on A, and now the new external jar   * once fully functional, I can add C's dependency to B_ii, and change the Factory class to use the new implementations of interfaces.   * when that's all working, I can then remove C's dependency to original B, and if desired, remove sub-project B.   * Is that a sensible way of going about this?  So, in general, my questions are:   * Does anyone have any experience of breaking up large projects? Are there any tips/tricks that you would be willing to share?   * What impact did this have on your development and build times?   * What advice could you offer on structuring such a break-up of such a project?


Most recent vs Most used

We are building a business application (a laboratory management system to be more precise) mostly for internal company use only. To make it easier for users to find items which they work on we are implementing a list of most used items. We had a little debate on which method would be better to implement: display the most recent vs display the most used. **My arguments on most-recent**   * A little bit easier to implement. I think this is worth to mention because we are dealing with business application which will be sold as a single copy, so this may directly effect application price. Also simpler implementation means less code and may effect maintenance code.      * Counterargument: difference in implementation difficulty in this case is too small   * It is easier for users to guess what will they find in this list so they know if it is worth to look at the list at all.   * Items which were relative yesterday and used a lot might not be relevant today and in recent item list they quickly disappear. **My arguments on most-used**   * Actually it is quite easy to display a mixed version of recently-used and most-used by combining last access date and a number of access something like this `(today - lastaccess) * number_of_access`     * Counterargument: this requires fine-tuning What arguments would you give for one or another?


Why do exclusively outsourcing projects as a company?

A prospective employer told me they took a company level decision to do only outsourcing projects. I do not understand why they took such a decision and the guy I talked to did not elaborate. He further said only that "their intention is to build software components". Since they are growing quite fast and reached around 300 employees, shouldn't they be at least open to the possibility of having a project of their own, maybe? All other companies I've had contact with were at least open to have one in the future. I talked to a few of their employees and some are working in parallel on more than 2 outsourced projects (dividing time something like 4 + 4 hours / day). It seemed like a lot of projects with a period of a few months, maybe half a year come and go. Why would a company choose to provide only outsourcing services like that? How does it work to keep hundreds of people on outsourced projects with a seemingly high project turnover rate?


Why was the Java App store discontinued?

A Java App Store sounds like a cool idea right? Well, I turned to Google and found some remnants of an app store that Oracle had been developing. It looks like it has since been discontinued, but I haven't been able to find much commentary on why it was abandoned. So why was it discontinued? Links to other references, for instance blog posts discussing the difficulties of Oracle's app store, would be much appreciated.


Entity Framework book 1st Edition

I recently purchased the O'Reilly book: Programming Entity Framework by Julia Lerman. Unfortunately it is the 1st edition. I didn't realize that there was a newer edition. Which in hind sight explains the lessor price for the book. So my question... Should I return it and get the 2nd edition or read the 1st edition? The 1st edition spends a lot of time in the version 1 of the EF and the 2nd edition spends a lot of time in version 2 (which is where I want to be). I think I want to return it, but I thought I would ask the question first... Thoughts?


How much documentation should a client expect from a one-man team?

I work for a small electronics and support software company that just recently got a contract with a large company that's very strict on documentation (I do the support software, essentially Windows or browser applications). Upon reviewing the required documentation from the large company, I realize that I wear more hats than I realized. Namely, we have to produce documentation describing:   * Requirement analysis (me)   * Architectural design (me)   * Detailed design (me)   * (Actual) Software development (me)   * Database design development (me)   * Testing plan, preparation, and results (me)   * Proof of compliance with requirements (me)   * User manual (me) I'll also be doing most (if not all) of the testing myself. And the deployment, training, and customer support. If there's any application technician needs for sales support, that's me too. Is that common? Do small software companies that get big contracts ask that commonly from single programmers?


By what features and qualities are "free" and "premium"  themes differentiated

I have a lot of time invested in creating Wordpress templates. I want to release combinations of these templates along with different styles and Fancy Front pages as "Premium Wordpress Themes". What I need to know is what does "Premium" mean? What do people expect of a GPL theme vs. a Premium theme? Are there features that are considered required to be premium? Are there features that are in demand but considered "exceptional" i.e. not part of every premium theme? How can I tell the difference? I have heard tounge-in-cheek answers that say that any theme that makes money is premium, but I mean to ask about what gives an outstanding theme it's quality. Why is it worth more? I am technically able to do many things, but as a lone developer with a family to feed, I can't afford to spend time on features that no one cares about. I have to try to isolate the things that people want. This is serious food and rent to me. How can I get this kind of info so I can make my project successful?


What is jQuery and JavaScript's role in MVC?

I'm not sure I understand the role of jQuery/JavaScript in MVC. I've found an article about it on _A List Apart_ , but it doesn't clear anything up for me. Does it bridge the communication between the View and the Controller, or does it do something else?


ASP.Net MVC or Web Forms?

> **Possible Duplicate:**   >  Why would you use MVC over Web Forms? What is the difference between ASP.Net MVC and Web Forms? Is either preferable? I want to use ASP.Net development as a springboard to teach myself C#. What is the best way to go about this?


Salesforce trigger Prevent duplication

I have written a trigger which prevent duplicate name. please refer following condition. " **Test** " and " **Te st** " are same name (which mean don't need to consider any in between spaces.) " **TEST** " and " **test** " are same name (which mean ignore uppercases and lower cases.) My Question : If I have already one record inserted in system with name " **Te st** ". and Now I am trying to insert a new record with name " **test** "(which is obvious not correct as per duplication). How can i handle this exception? Thank you in advance.


Is renaming a program considered modifying a program legally?

If a software license prevents you from modifying a program (i.e "You may not modify…") is renaming the program (e.g. changing it from a.exe to b.exe) considered modification legally of the software if the software remains binary identical since all that has really changed is the path to the program? Edit. I am not asking for legal assistance here I am asking what is the case law in this area. What modification is must have been dealt with at some point.


Git collaboration with pull request in a company

I am thinking of a way to do collaboration between coders in a company, suppose we have 2 type of servers: Production and Staging. Now we want to review all changes going to Production via pull-request, at the same time, we want coders to be able to push experimental changes whenever they want to Staging. The objective here is make sure our guys can do experimental stuff and can't (accidentally) mess up with Production. My idea is to just create 2 separate repository for Production (read-only) and Staging (read-write). Will this be the ideal setup? Any other types of setup I should be aware of? ![enter image description here](http://i.stack.imgur.com/KhtPf.png)


In Java, what are some good ways to separate APIs from implementation of *entire projects*?

Imagine you have a software module, which is a plugin to some program (similar to Eclipse) and you want it to have an API which other plugins can call. Your plugin is not freely available, so you want to have a separate API module, which _is_ freely available and is the only thing other plugins need to directly link to - API clients can compile with only the API module, and not the implementation module, on the build path. If the API is constrained to evolve in compatible ways, then client plugins could even include the API module in their own jars (to prevent any possibility of `Error`s resulting from nonexistent classes being accessed). Licensing is not the only reason to put API and implementation in separate modules. It could be that the implementation module is complex, with myriad dependencies of its own. Eclipse plugins usually have internal and non- internal packages, where the non-internal packages are similar to an API module (both are included in the same module, but they could be separated). I've seen a few different alternatives for this:   1. The API is in a separate package (or group of packages) from the implementation. The API classes call directly into implementation classes. The API _cannot_ be compiled from source (which is desirable in some uncommon cases) without the implementation. It is not easy to predict the exact effects of calling API methods when the implementation is not installed - so clients will usually avoid doing this.              package com.pluginx.api;     import com.pluginx.internal.FooFactory;     public class PluginXAPI {         public static Foo getFoo() {             return FooFactory.getFoo();         }     }        2. The API is in a separate package, and uses reflection to access the implementation classes. The API can be compiled without the implementation. The use of reflection might cause a performance hit (but reflection objects can be cached if it's a problem. It is easy to control what happens if the implementation is not available.              package com.pluginx.api;     public class PluginXAPI {         public static Foo getFoo() {             try {                 return (Foo)Class.forName("com.pluginx.internal.FooFactory").getMethod("getFoo").invoke(null);             } catch(ReflectiveOperationException e) {                 return null;                 // or throw a RuntimeException, or add logging, or raise a fatal error in some global error handling system, etc             }         }     }        3. The API consists only of interfaces and abstract classes, plus a way to get an instance of a class.              package com.pluginx.api;     public abstract class PluginXAPI {         public abstract Foo getFoo();              private static PluginXAPI instance;         public static PluginXAPI getInstance() {return instance;}         public static void setInstance(PluginXAPI newInstance) {             if(instance != null)                 throw new IllegalStateException("instance already set");             else                 instance = newInstance;         }     }        4. The same as above, but the client code needs to get the initial reference from somewhere else:              // API     package com.pluginx.api;     public interface PluginXAPI {         Foo getFoo();     }          // Implementation     package com.pluginx.internal;     public class PluginX extends Plugin implements PluginXAPI {         @Override         public Foo getFoo() { ... }     }          // Client code uses it like this     PluginXAPI xapi = (PluginXAPI)PluginManager.getPlugin("com.pluginx");     Foo foo = xapi.getFoo();        5. Don't. Make clients link directly to the plugin (but still prevent them from calling non-API methods). This would make it difficult for many other plugins (and most open source plugins) to use this plugin's API without writing their own wrapper.


File reading in front end

Is there any way to ready a file @ the front end itself, which should be supported for IE 8 and IE 9 also. Please provide any suggestions available for this. Looking for code to read an excel file on the front end/javascript code.


Rename PDF extracted Pages File from a Single Booklet PDF in correct sequence

I have huge PDF files which are in booklet format. example, Assume a booklet pdf file has 24 pages which each page contains 2 pages which is in two sides - left side and right side. The first page has 48th page number on the left side and 1st page number on the right side The second page has 2nd page number on the left side and 47th page number on the right side The third page has 46th page number on the left side and 3rd page number on the right side I have vertically cut the Booket PDF files in to separate individual PDF files using bulk operation in separate folder. for example, the cutted PDF file will be as follows in the above case 1st pdf file - 48th page 2nd pdf file - 1st page 3rd pdf file - 2nd page 4th pdf file - 47th page 5th pdf file - 46th page 6th pdf file - 3rd page.. Similarly for other PDF files too....if a PDF file has 95 pages.... the first page has 95th page number on the left side and 1st page number on the right side Now the issue is how to rename and arrange the files correctly in the sequence for EACH PDF file so that we can merge the PDF file as one at last for each PDF file... After renaming correctly in the proper sequence for the above file 1st pdf file should point to 1st page 2nd pdf file should point to 2nd page 3rd pdf file should point to 3rd page... The problem is all the PDF files which we are planning to split will have different set of pages..example PDF1 file - has 48 pages as above -> files should be renamed and arranged as 1, 2, 3, 4...48 correctly PDF2 file - has 96 pages -> files should be renamed and arranged as 1, 2, 3, 4.....96 correctly PDF3 file - has 56 pages -> files should be renamed and arranged as 1, 2, 3, 4.....56 correctly After renaming, the final file will be as follows 1st pdf file - should be pointed to 1st page..i.e 2nd pdf file name should be renamed as 1st pdf file 2nd pdf file - should be pointed to 2nd page i.e 3rd pdf file name should be renamed to 2nd pdf file 3rd pdf file - should be pointed to 3rd page i.e 6th pdf file name should be renamed to 3rd pdf file Could someone help me with a program which will rename the vertically cutted files in a proper sequence?? Thanks in advance.


Why is the use of conjunctions in method names a bad naming convention?

In my team, we work closely with a few software architects. They approve all design decisions of our projects, do some code reviews etc. Our projects consist mainly of backend functionality implemented in PHP using the Symfony 2 framework. So syntactically, the code, naming conventions and project structure look almost identical to what Java would look like (Symfony 2 encourages such structure). I'm mentioning this because Java-specific conventions also apply in our case (if possible). Recently, they suggested something that I find very strange: all methods should have conjunctions in their name e.g. `getEntityOrNull`, `setValueOrException` etc. Such a naming convention feels very wrong to me, but I can't come up with any concrete arguments or online articles/pages that specifically challenge this. The only things I came up with is:   * such information should be present in the method's annotations, like `@return` or `@throws`   * the use of conjunctions ("and", "or" etc.) in method names usually suggest that the Single Responsibility Principle is not properly respected What are some other concrete arguments against this naming convention?


This program in Java doesn't stop executing!

I have written this program but it doesn't stop executing. Can you help me with it?               /*      * To change this license header, choose License Headers in Project Properties.      * To change this template file, choose Tools | Templates      * and open the template in the editor.      */          package inplacesort;          import java.util.*;     /**      *      * @author ASUS      */     public class InplaceSort      {         static Scanner console = new Scanner(System.in);              /**          * @param args the command line arguments          */         public static void main(String[] args)         {             Vector <Integer> intList = new Vector <Integer> ();                  //getting the numbers from the user             char ans = 'y';                  while (ans == 'Y' || ans == 'y')             {                 System.out.print("Enter a Number: ");                 intList.addElement(console.nextInt());                      System.out.print("Do You Want to Continue?(Y/N)");                 ans = console.next().charAt(0);             }             System.out.println(intList);             for (int i = 1; i < intList.size(); i++)             {                 //if (intList.elementAt(i) < intList.elementAt(i-1))                 //{                 int j = i - 1;                 while (j > 0 && intList.elementAt(i) < intList.elementAt(j))                 {                     j--;                 }                      for (int k = intList.size() - 1; k >= j; k--)                 {                     intList.insertElementAt(intList.elementAt(k),k + 1);                 }                      intList.insertElementAt(intList.elementAt(i+1),j);                 intList.removeElementAt(i+1);                 //}             }             System.out.print(intList);         }     }


Is it possible to port a python desktop app(command line) into cloud

I am new to python and cloud computing . As part of my new project i am planing to port a python desktop application(command line) to cloud. is it possible


The Next Step, from Senior Developer to Architect

**A little background:** Bachelor In Engineering, Master Degree in Comp Sci. Landed junior dev straight out of Uni. 2 years later, left for Senior Dev. Now planning next step... Platform: _.NET, VB,C# (upto 4.0, LINQ, PLINQ) ,F#,Winform,ASP.NET+(usual web tech,js,xslt, dxhtml,etc),WPF, db ->MS T-SQL_ **Question:** What are the next steps I should be thinking about if my goal is to become a .NET Architect? What things do I need to gain experience in, both soft skills + technical. What is the fastest route there? Are there any advice in general related to becoming a Architect? Thanks in advanced.


Managing code changes in this coding environment

I have the following coding environment:   * Three Developers   * Source code resides in Team Foundation Server (2010)   * Development Environment   * Stage Environment   * Production Environment As the Senior Developer, I need to review code before its pushed to the Staging Environment. Once I review the code, it is pushed to Stage where it gets tested by our (small) test team. Once changes are tested and accepted, I move to production. Suppose the following: `Developer A` submits a change, I review it and push to stage. `Developer B` submits a change, I review it and push to stage. During the testing, a user says the change `Developer A` made has bugs and needs to be fixed. But the changes `Developer B` made need to go to production. This happens more than not. Currently, I need to wait for `Developer A` to fix the bugs and test again or have `Developer A` disable their changes. How to solve this dilemma?


What are the disadvantages of naming things alphabetically?

Let me give you an example of how I name my classes alphabetically:   * Car   * CarHonda (subclass of Car)   * CarHondaAccord (subclass of CarHonda) There are two reasons why I put the type of the class earlier in its name:   1. When browsing your files alphabetically in a file explorer, related items appear grouped together and parent classes appear above child classes.   2. I can progressively refine auto-complete in my IDE. First I type the major type, then the secondary type, and so on without having to memorize what exactly I named the last part of the thing. My question is why do I hardly see any other programmers do this? They usually name things in reverse or some random order. Take the iOS SDK for example:   * UIViewController   * UITableViewController What are the disadvantages of my naming convention and the advantages of their convention?


Should I add old code into my repository?

I've got an SVN repository of a PHP site and the last programmer didn't use source control properly. As a result, only code since I started working here is in the Repo. I have a bunch of old copies of the full code base saved in _files_ as "backups" but they're not in source control. I don't know why most of the copies were saved nor do I have any reasonable way to tag them to a version number. I _do_ have the dates the backups were made, all backups have proper file system timestamps. Due to upgrades to the frameworks and database drivers involved, the old code is quite defunct; it no longer works on the current server configuration. However, the previous programmers had some _unique_ logic, so I hate to be completely without old copies to refer to what on earth they were doing. Should I keep this stuff in version control? How? Wall off the old code in separate Tags/branches?


Using BSD and GPL in one project

I am an author of project, that consists of two parts: daemon and library. I want to license library under BSD License (or MIT, will decide later), and daemon under GPLv3. I want to permit the library to be linked into closed-source products, but I want daemon to be GPL, as it uses GPL code heavily, and I do not want its commercial forks. The thing is: This library just provides client interface for the daemon, where daemon acts just like sort of server. Is it permitted to license my project using separate licenses for different parts of my project, linked with some sort of RPC protocol?


How to pass parameters to a function in C

Suppose I'm writing a program in C in which several parameters are asked at the beginning of the execution to the user and then remain costant until the end. Now, I need to pass these parameters to some function. Since they are unchanged through the program, my temptation would be to declare them as global variables, to have them visible to all functions. However, I see that this is not a good practice if the dimension of the program gets big (this has been asked and answered here). However, I neither see the point of creating functions with, say, 6 arguments, when the variable ones are only 2. Is there a more elegant way to do this without compromising too much the manipulability of the code?


Name of the Countdown Numbers round problem - and algorithmic solutions?

For the non-Brits in the audience, there's a segment of a daytime game-show where contestants have a set of 6 numbers and a randomly generated target number. They have to reach the target number using any (but not necessarily all) of the 6 numbers using only arithmetic operators. All calculations must result in positive integers. An example: Youtube: Countdown - The Most Extraordinary Numbers Game Ever? A detailed description is given on Wikipedia: Countdown (Game Show) For example:   * The contentant selects 6 numbers - two large (possibilities include 25, 50, 75, 100) and four small (numbers 1 .. 10, each included twice in the pool).   * The numbers picked are `75`, `50`, `2`, `3`, `8`, `7` are given with a target number of `812`.   * One attempt is (75 + 50 - 8) * 7 - (3 * 2) = 813 (This scores 7 points for a solution within 5 of the target)   * An exact answer would be (50 + 8) * 7 * 2 = 812 (This would have scored 10 points exactly matching the target). Obviously this problem has existed before the advent of TV, but the Wikipedia article doesn't give it a name. I've also saw this game at a primary school I attended where the game was called "Crypto" as an inter-class competition - but searching for it now reveals nothing. I took part in it a few times and my dad wrote an Excel spreadsheet that attempted to brute-force the problem, I don't remember how it worked (only that it _didn't_ work, what with Excel's 65535 row limit), but surely there must be an algorithmic solution for the problem. Maybe there's a solution that works the way human cognition does (e.g. in-parallel to find numbers 'close enough', then taking candidates and performing 'smaller' operations).


User session timeout handling in SaaS apps - discussing several approaches

I know this has a great chance of being marked as duplicate, but couldn't find exactly what I'm looking for This is a common problem and I'm sure it has some well defined best practice solution # Background   1. A single page SaaS app, has lot's of drag and drop, user can interact with it without much server communication for periods of time    2. Server session only holds user object, using a non persistent session cookie    3. Session expires on the server after X hours   4. Some things are loaded only during log-in # Problem   1. User works on the app, when done, user doesn't log out, just keeps the browser open   2. User comes back after more than X hours (session is invalidated on server)    3. User interacts with the app without needing a server connection (drags and drops things, text edits...)    4. Only on the next server interaction (let's assume there is no auto save) user is thrown to login page and loses some of their work ## Possible solutions Here are some solutions I have in mind, would like to hear if there are any others, and if there is anything fundamentally wrong with any of them. **1\. Never log the user out**   * **How?** either keep a long session, keep a persistent cookie, or javaScript "keep alive" ping   * **Pros** : user doesn't need to worry about anything, fixes the problem for them   * **Cons** : not PCI compliant, not secure, and needs development changes, e.g. things loaded to session only on user log in need to move to either a pub sub model (listening on event changes) or have cache timeout.  **2\. Local Storage**   * **How?** use new local storage to temporarily store state if logged out, redirect to login page, persist once logged in    * **Pros** : Also base for "work offline" support, not just handling session timeout    * **Cons** : harder to implement, need to do state merge of data tree, not all browsers support  **3\. Auto save** Every user action that changes the model, should persist immediately (or via some sort of a client side queue), e.g. if they check a checkbox, change a text field, or drag and drop something, once they are done, persist the changes.   * **How?** Use an MV** framework (Backbone.js / Knockout.js / Ember.js / Angular.js etc) to bind the model, and persist on changes.   * **Pros** : Seems like a clean solution, session is active as long as user is active, no client side work is done without persisting it.   * **Cons** : The last action user is doing after a session timeout is lost. **4\. Log the user out after session expires** this can have several approaches   1. Ask the server "has session expired" - this is a bit of a catch 22 / Schrodinger's cat, as the mere question to the server extends the session (restarts the timeout),      * **How?** Either have a server that supports such question (I don't know of any, but I come form Java land) or, one can just keep a table of session IDs, and last access time manually, and ask the server by passing the session ID as a parameter instead of the cookie, I'm not sure if this is even possible, but it sounds dangerous, insecure and bad design whatsoever.login page, persist once logged in      * **Pros** : If there was such native support in servers, sounds like a clean, legitimate question (asking if user X still has a session or not without renewing it if they do)     * **Cons** : If the server doesn't support it (and again, I don't know if any server or framework has this functionality) then the workaround has huge security risks potentially.   2. One workaround I've heard is have a short session on the server side, and a keep alive client side ping, that has a maximum number of pings     * **How?** Short session on server, client pings every sessionTimeOut/2, has max retries of Y.     * **Pros** : Kind of fixes the problem, quick and dirty      * **Cons** : Feels like a hack, handling the session renewal yourself instead of letting the server do it   3. Client side timer     * **How?** Have a timer on the client side and sync it with the server one by restarting it on every request to be equal to the max server session timeout minus some padding, after user is not sending any request to the server, UI shows a "sessions is about to time out, do you want to continue?" (like you have on online banking )     * **Pros** : Fixes the problem      * **Cons** : Can't think of any except the need to make sure the sync works  # The Question I'm probably missing something in the above analysis, might have some silly mistakes, and I would like your help to correct them. What other solutions I can have for this?


Source control: projects which share a 3rd library which is still under development in RTC

this is not a new question for source control, but IBM's Rational Team Concert is a slightly different animal than Git, SVN, etc. We have a number of .NET web sites under development with Visual Studio. Each web site is represented by a VS solution. They all share in common a .NET library, also under development. Is there a smart way to set up in RTC so that each web site's repository does not contain its own copy of the common library's source? My first thought was to just set the library up with its own repo in RTC, then have each "child" web site solution refer to the common library in sandbox. But I'm new to RTC and not so sure this is the most RTC-ish way, or what trouble I'll encounter later. Thoughts? Thanks for any light shed.


Is a Mission Oriented Architecture (MOA) a better way to describe things than SOA?

I might sound like a troll, but I would like to seriously understand this deeper. The place I work at has started to use the term MOA, versus SOA as we believe it drives more clarity and want to compare it to the true goals of SOA. A Mission Oriented Architecture is an approach whereby an application is broken down into various business mission elements, with the database, file assets, batch and real time functionality all tightly coupled in terms of delivering that piece of the functionality. The mission allows the developers to focus on a specific piece of functionality to get it right, and to build it with the ability for that piece to scale as an independent entity within the overall application. By tightly coupling the data, file assets and business logic you achieve the goals of working on a very large problem in bite size pieces. Some definitions of SOA mix it up with what is essentially a method call on a web service versus a true "service". As an architect, I have always found it fun getting everyone on the same page regarding SOA. Is it better to call it a "mission" versus a "service"?


Appropriate design / technologies to handle dynamic string formatting?

recently I was tasked with implementing a way of adding support for versioning of hardware packet specifications to one of our libraries. First a bit of information about the project. We have a hardware library which has classes for each of the various commands we support sending to our hardware. These hardware modules are essentially just lights with a few buttons, and a 2 or 4 digit display. The packets typically follow the format `{SOH}AADD{ETX}`, where AA is our sentinel action code, and DD is the device ID. These packet specs are different from one command to the next obviously, and the different firmware versions we have support different specifications. For example, on version 1 an action code of 14 may have a spec of `{SOH}AADDTEXT{ETX}` which would be AA = 14 literal, DD = device ID, TEXT = literal text to display on the device. Then we come out with a revision with adds an extended byte(s) onto the end of the packet like this `{SOH}AADDTEXTE{ETX}`. Assume the TEXT field is fixed width for this example. We have now added a new field onto the end which could be used to say specify the color or flash rate of the text/buttons. Currently this java library only supports one version of the commands, the latest. In our hardware library we would have a class for this command, say a DisplayTextArgs.java. That class would have fields for the device ID, the text, and the extended byte. The command class would expose a method which generates the string (`"{SOH}AADDTEXTE{ETX}"`) using the value from the class. In practice we would create the Args class as needed, populate the fields, call the method to get our packet string, then ship that down across the CAN. Some of our other commands specification can vary for the same command, on the same version, depending on some runtime state. For example, another command for version 1 may be `{SOH}AA{ETX}`, where this action code clears all of the modules behind a specific controller device of their text. We may overload this packet to have option fields with multiple meanings like `{SOH}AAOC{ETX}` where OC is literal text, which tells the controller to only clear text on a specific module type, and to leave the others alone, or the spec could also have an option format of `{SOH}AADD{ETX}` to clear the text off a a specific device. Currently, in the method which generates the packet string, we would evaluate fields on the args class to determine which spec we will be using when formatting the packet. For this example, it would be along the lines of:               if m_DeviceID != null then use {SOH}AADD{ETX}     else if m_ClearOCs == true then use {SOH}AAOC{EXT}     else  use {SOH}AA{ETX}      I had considered using XML, or a database to store String.format format strings, which were linked to firmware version numbers in some table. We would load them up at startup, and pass in the version number of the hardwares firmware we are currently using (I can query the devices for their firmware version, but the version is not included in all packets as part of the spec). This breaks down pretty quickly because of the dynamic nature of how we select which version of the command to use. I then considered using a rule engine to possibly build out expressions which could be interpreted at runtume, to evaluate the args class's state, and from that select the appropriate format string to use, but my brief look at rule engines for java scared me away with its complexity. While it seems like it might be a viable solution, it seems overly complex. So this is why I am here. I wouldn't say design is my strongest skill, and im having trouble figuring out the best way to approach this problem. I probably wont be able to radically change the args classes, but if the trade off was good enough, I may be able to convince my boss that the change is appropriate. What I would like from the community is some feedback on some best practices / design methodologies / API or other resources which I could use to accomplish: Logic to determine which set of commands to use for a given firmware version Of those command, which version of each command to use (based on the args classes state)   Keep the rules logic decoupled from the application so as to avoid needing releases for every firmware version   Be simple enough so I don't need weeks of study and trial and error to implement effectively.


Displaying device contacts with an indication that the contact is registered to the app

We are developing a mobile app that needs to pick up device contacts, display them and indicate if the contact has already registered with this app. We have our DB in the server and the app fetches data using web services. What will be the best approach to implement the above scenario taking performance into consideration. **Option 1:**   Every time user opens the app,fetch the contacts and send the list of email addresses to the server, check with the registered email ids and return the list of registered users in the contact list. In this approach whenever user opens the particular page, he needs to wait for few seconds to load data, but the contacts will be the latest from the device. **Option 2:**   First time when the user opens the app, fetch contacts ,send the entire list of contacts and save it in the DB, retrieve list of registered users in the contacts then save this to local DB.   From now on, data will be fetched from local DB and displayed.   When a new user registers in the app, again check with records in central DB and send list of new users who are in your contacts that have registered to your app.   This list will be added to local DB. and the process continues.   In this case the new contacts added by user will not be updated in the app but retrieval and display of records would be quick. What would be the correct approach? In case there is a better way of doing this, please let me know.


What algorithm should I use to create an automatic staff scheduling feature?

Imagine a small local business (in my case a dog daycare) with a few dozen part-time employees . The goal is to automatically create weekly staff schedules. My question is about what algorithmic approaches to explore for this problem. There are many constraints to keep in mind, chiefly (1) the availability of the staff and (2) the needs of each shift, not just how many staff for each shift but the skills needed for each shift (e.g. for a certain shift, you may need someone who knows how to drive to do pick-ups/drop-off of dogs, for another, someone who know how to give dogs baths, etc). Other constraints include things like avoiding or requiring certain staff combos -- perhaps due to personality conflicts on one hand, or need for training by osmosis from a senior to junior staff on the other. Also, there are preferences to take into account. Some staff prefer mornings, some two days in a row rather than say Monday and Thursday, etc. We know we can't always accommodate everyone's preferences. In fact we have a hierarchy of which employees get first dibs on their choices. I have a hunch that there is a way to reduce or express this problem into an existing, already solved algorithm. But I don't know which algorithms to explore. Which existing, specific algorithms would be most promising?


What are the licensing requirements for shipping Java along with application

We have an application in Java. Now we want to export this application to clients (free of charge). Can we ship JRE7 along the application (precaution as client might not have Java installed). Is it legal to do this?


Language parsing to find important words

I'm looking for some input and theory on how to approach a lexical topic. Let's say I have a collection of strings, which may just be one sentence or potentially multiple sentences. I'd like to parse these strings to and rip out the most important words, perhaps with a score that denotes how likely the word is to be important. Let's look at a few examples of what I mean. **Example #1:** > "I really want a Keurig, but I can't afford one!" This is a very basic example, just one sentence. As a human, I can easily see that "Keurig" is the most important word here. Also, "afford" is relatively important, though it's clearly not the primary point of the sentence. The word "I" appears twice, but it is not important at all since it doesn't really tell us any information. I might expect to see a hash of word/scores something like this:               "Keurig" => 0.9     "afford" => 0.4     "want"   => 0.2     "really" => 0.1     etc...      **Example #2:** > "Just had one of the best swimming practices of my life. Hopefully I can > maintain my times come the competition. If only I had remembered to take of > my non-waterproof watch." This example has multiple sentences, so there will be more important words throughout. Without repeating the point exercise from example #1, I would probably expect to see two or three really important words come out of this: "swimming" (or "swimming practice"), "competition", & "watch" (or "waterproof watch" or "non-waterproof watch" depending on how the hyphen is handled). Given a couple examples like this, how would you go about doing something similar? Are there any existing (open source) libraries or algorithms in programming that already do this?


How to improve programming skills as a Junior without Senior

At the moment I'm 23 and working as a junior programmer at a software service provider. While I'm really happy with my job and my colleagues, I sometimes would love to have someone who could tell me what is bad about my code (architecture and so on), why it is bad AND what could I do to make it better. As we have no senior java programmers anymore (I'm the last one who can program java), I would love to get your advice about becoming a better programmer. Disclaimer: Sometimes I ask my non java programmer colleagues if my code is "good" or "bad" but I have the feeling that they can't judge because they aren't java programmers. (They hardly program anything) Are there any communities which are happy to mentor junior developers? Would it help if I read tons of books? Any advice how I can improve my existing skills and learn if what I'm doing is bad or good? Epilog: I didn't even think about switching the employer back in May when I asked this question but what all of you said was stuck in my head and I decided to switch in April. I now found a new employer and I got a position as a junior Java developer at the new company. I hope my professional growth will get better in future with my new employer. I just wanted to say thank you for all of your advices.


How should I create a combined interface for two logically independent modules?

I'm having trouble coming up with a good way to structure the interfaces for two modules that are logically independent but whose implementations may be combined for the purposes of performance or efficiency. My specific situation is the replacement of the separate queuing and logging modules in a message routing application with a combined database-backed implementation (let's call it `DbQueueLog`). It's easy enough for `DbQueueLog` to implement both the `IQueue` and `ILogger` interfaces so clients of the old queuing and logging modules can use it seamlessly. The challenge is that the most efficient and performant implementation of `DbQueueLog` involves combining the `EnqueueMessage(Message m)` and `LogMessage(Message m, List<LogParams> p)` methods into an `EnqueueAndLogMessage(Message m, List<LogParams> p)` method that minimizes the number of cross-process database calls and the amount of data written to disk. I could create a new `IQueueLog` interface with these new methods, but I'm uncomfortable with what that would mean if a future iteration of the application moved back to separate queuing and logging modules. Are there any design approaches to this situation that would allow me to build the efficient, performant `DbQueueLog` implementation now without permanently coupling together the application's queuing and logging modules? Edit: The application is built on Windows using C# in case any there are any platform-specific techniques that might be available.


How to create a random generator

How could a random generator be implemented? I'm not speaking about the invocation of a language _mathRandom()_ method, but the implementation of the routines that lead to generate numbers totally random.


Does the use of debuggers have an effect on the efficiency of programmers?

> **Possible Duplicate:**   >  Are debugging skills important to become a good programmer? I'm a young Java developer and I make a systematic use of the Netbeans debugger. In fact, I often develop my applications when I debug step by step in order to see immediately if my code works. I feel spending a lot of time programming this way because the use of debugger increase execution time and I often wait for my app to jump from a breakpoint to an other (so much that I've the time to ask this question). I never learned to use a debugger at school, but at work I've been told immediately to use this functionality. I started teaching myself to use it two years ago, and I've never been told any key tips about it. I'd like to know if there are some rules to follow in order to use the debugger efficiently. I'm also wondering if using the debugger is eventually a good practice? Or is it a loss of time and I've to stop now this bad habit?


Is debugging a waste of time?

I work on a lot of projects for fun, so I have the freedom to choose when I want to finish the project and am not constrained by deadlines. Therefore, if I wanted to, I could follow this philosophy: > Whenever you hit a bug, don't debug. Instead, spend time learning about > topics related to the bug from textbooks and work on other projects until > one day you can come back to the bug and solve it instantly thanks to your > piled up knowledge. However, maybe the 'philosophy' is bad because   1. debugging is a skill that should be practiced so that when I need to finish projects by a deadline I will have acquired the skills necessary to debug quickly.   2. staring at lines of code and _struggling_ to understand them when debugging makes you a much better programmer than writing new lines of code does.   3. debugging isn't a waste of time for some reason which I hope you'll tell me.


Do your stories include tasks across disciplines? How do you do capacity planning?

My organization does web projects and employs a handful of disciplines like backend dev, frontend, BA, UX, graphic design, QA. We've been pushing to have tasks for every discipline in our sprints with explicit dependencies (Can't build a page without comps, can't do comps without wires, etc). I've heard some other organizations say that scrum is only for dev tasks. Are we barking up the wrong tree? And, if not, are there any good tools for doing capacity planning when only certain resources can do certain tasks?


How often do experienced programmers have trouble getting their code to perform its intended purpose?

I'm kind of inexperienced with programming (ie less than a year) and I have recently been getting discouraged, mostly from not being able to solve problems with my own code (Not forgetting parentheses or syntax issues but more logic based problems). I just wanted to know, is this something that will dissipate with practice and time or does it only get worse as my programs become more complex?


I want to build a Virtual Machine, are there any good references?

I'm looking to build a Virtual Machine as a platform independent way to run some game code (essentially scripting). The Virtual Machines that I'm aware of in games are rather old: Infocom's Z-Machine, LucasArts' SCUMM, id Software's Quake 3. As a .net Developer, I'm familiar with the CLR and looked into the CIL Instructions to get an overview of what you actually implement on a VM Level (vs. the language level). I've also dabbled a bit in 6502 Assembler during the last year. The thing is, now that I want¹ to implement one, I need to dig a bit deeper. I know that there are stack based and register based VMs, but I don't really know which one is better at what and if there are more or hybrid approaches. I need to deal with memory management, decide which low level types are part of the VM and need to understand _why_ stuff like ldstr works the way it does. My only reference book (apart from the Z-Machine stuff) is the CLI Annotated Standard, but I wonder if there is a better, more general/fundamental lecture for VMs? Basically something like the Dragon Book, but for VMs? I'm aware of Donald Knuth's Art of Computer Programming which uses a register-based VM, but I'm not sure how applicable that series still is, especially since it's still unfinished? Clarification: The goal is to build a specialized VM. For example, Infocom's Z-Machine contains OpCodes for setting the Background Color or playing a sound. So I need to figure out how much goes into the VM as OpCodes vs. the compiler that takes a script (language TBD) and generates the bytecode from it, but for that I need to understand what I'm really doing. * * * ¹ I know, modern technology would allow me to just interpret a high level scripting language on the fly. But where is the fun in that? :) It's also a bit hard to google because Virtual Machines is nowadays often associated with VMWare-type OS Virtualization...


Is using techniques from OpenSource code copyright infringement?

If I read through the source code of programs in the similar field of application like the one I am working on (e.g.: 3D car racing simulation), and find some techniques or patterns they use better than the ones I am using, and use those in my project - is it theft? (No source code would be directly copied in any way.)


Does implementing algorithms improve your programming skills?

I have been self studying algorithms and data structures for some time now and currently enjoying it. Whenever I understand an algorithm, I usually try to code them from scratch for fun and I always will discover some logic I've never thought of before. I'm not so sure, but I always think that when I code algorithms, I am maybe practicing my skills in programming. Is this true? I know they are important, but will my programming skills really improve by coding them?


How important is studying algorithms and theory is to becoming a great programmer?

> **Possible Duplicate:**   >  Should I keep investing into data structures and algorithms? I'm a CS student. I want to become a really great programmer, what do I need to do to be come a great programmer? Other then writing lots of code, I've heard that studying algorithms and theory (logic!) is help. What do you recommend to become the best? What do I need to read? What do I need to study?


> **Possible Duplicate:**   >  How important is studying algorithms and theory is to becoming a great > programmer? Today I learned the fast sort Algorithm. I doubt I will ever implement my own version though as C# has its own built in Sort method for lists and arrays. How important is learning Algorithms for high level language programmers? In my example I gained no benifit from knowing the Algorithm but perhaps my example was too trivial to be accurate?


Software License: Open Source, but no distribution (for free or for profit)

I wrote a program in PHP. I want people to be able to use the code to learn from and even include bits in their own apps but I also want to maintain the right to sell it and make it clear that others are not to distribute copies either for free or for profit. I haven't used anyone elses code so I don't have to worry about license compatibility. Which license out there is right for that? I know I can't stop people from ignoring the license but I just want them to at least know it's there and know they're doing something wrong if they try. I can't find anywhere that explains licenses in plain English and yes, I have tried to read the GNU and BSD licenses but I can't get it. Thanks. Ok so here are the clarifications other have asked for: I am going to sell this program for very cheap. People are free to use as much code as they want from it so long as they have first purchased the program and they do not profit from my code. I wouldn't mind if people just took the whole thing and added on and made it better but then people wouldn't be honest and they would just add something on and give it free and then no one would buy my product. I suppose I should just let people have it and ask for donations. So maybe I should GPL or BSD it. EDIT: I understand why everyone is getting confused. It is contradictory but the thing about legalese is that everything seems black or white. I'm trying to achieve a gray area. I want people to buy this thing from me, not copy it and give it away to people, and even use parts of it. By "use parts", what I'd say if someone asked me casually would be "just be reasonable". So basically don't use a majority of my code in your work and then totally outshine what I did because you'll have it easy as I did most of the dirty work already! I mean, sure, use my DB connect script in your project, I don't care. OR... use all the code and add to it! But only for personal use and don't you dare start giving it out because I'm going to be making money off this thing and that totally undermines my work. And it'd be nice to show me your additions and I'll give credit but the main thing is don't be redistributing my software that I have to earn a living with. Its hard to put that sentiment into legalese. And I just can't understand all these licenses.


Are web best practices so important if they are always violated by large companies?

Usually, there are a bunch of rules and best practices which help optimizing a website, bring new customers, and in general making user experience fast, smooth and pleasant while (sometimes) reducing the server load. Also, usually, the largest companies don't bother to use those best practices. Except for few companies (like Google), on the largest websites, we can see:   * table layouts, not minified JavaScript, no CSS sprites where they should be, several CSS files, intrusive JavaScript even in situations where it was simple to be unobtrusive, calls to JavaScript files in `<head/>`, etc.   * meaningless errors, annoying popups, register forms with huge amount of fields to fill, UX issues on register¹, stupid questions and situations which make it impossible to use the website², confusing situations on key parts of the website³, multiple redirects, slow pages, etc. On one hand, those companies are paying a huge amount of money to develop, optimize⁴ and host their websites since their success relies partially⁵ or completely⁶ on it; on the other hand, they are constantly violating the best practices while people advocating those best practices explain that following them helps to achieve better UX and faster websites with lesser footprint on environment (which can be non-negligible on websites hosted on thousands of servers). In such a case, it is logical to ask:   * If the large companies which are really successful, do have a lot of money for their websites and competent employees and which care about website optimization violate constantly those best practices, **are those best practices true?**   * Or, in another words, if those best practices are so important and helps so much to optimize websites, **why those companies don't care about them?** Let's take an example of Dell.com. I'm pretty sure they hire the best of the best to create their home page. Their home page use table layouts. Does it mean that people who tell that table layouts are evil are wrong? Does it mean that the best of the best hired by Dell are incompetent? * * * ¹ First example: eBay makes it impossible, when registering, to _paste_ your mail address in both fields, making it longer to use the registration form with no reason at all except to annoy users; best practice would be to forbid _copying_ , but allow pasting. Second example: Microsoft Live limits the length of a password to 16 characters, with no apparent reason at all.   ² For example, when you've not being to Amazon for a very long time, it says that the password is invalid, then, to recover it, asks you the information about your last transaction, which makes the account unusable if you've never done any transaction before with the account.   ³ Dell, for example, makes it impossible to order a rack server without any hard disk, while this can be perfectly valid if you already have the hard disks you want to reuse.   ⁴ Such optimization includes partial flush to send the most important content faster, studies on the relationship between time spent by people waiting for pages to load and the number of people using the website, etc.   ⁵ As for Dell, Microsoft and others.   ⁶ As for eBay or other web-based companies.


web development without the knowledge of client side scripting or programming?

> **Possible Duplicate:**   >  How much HTML and CSS should server side developer know? What will happen if someone wants to be a web developer but not interested to learn the client side scripting or programming. I am asking this question, because I think it is not possible, but a few days back, I had an argument with one of my rigid programmer friend. I could not make him understand. Do you guys agree with me? I believe that without the good client side knowledge, it is impossible to be a good web developer.


C# Dev - I've tried Lisps, but I don't get it

After a few months of learning about and playing with Lisp, both CL and a bit of Clojure, I'm still not seeing a compelling reason to write anything in it instead of C#. I would really like some compelling reasons, or for someone to point out that I'm **missing something _really big_**. The strengths of Lisp (per my research):   * Compact, expressive notation - More so than C#, yes... but I seem to be able to express those ideas in C# too.   * Implicit support for functional programming - C# with LINQ extension methods:      * mapcar = .Select( lambda )     * mapcan = .Select( lambda ).Aggregate( (a,b) => a.Union(b) )     * car/first = .First()     * cdr/rest = .Skip(1) .... etc.   * Lambda and higher-order function support - C# has this, and the syntax is arguably simpler:      * "(lambda (x) ( body ))" versus "x => ( body )"     * "#(" with "%", "%1", "%2" is nice in Clojure   * Method dispatch separated from the objects - C# has this through extension methods   * Multimethod dispatch - C# does not have this natively, but I could implement it as a function call in a few hours   * Code is Data (and Macros) - Maybe I haven't "gotten" macros, but I haven't seen a single example where the idea of a macro couldn't be implemented as a function; it doesn't change the "language", but I'm not sure that's a strength   * DSLs - Can only do it through function composition... but it works   * Untyped "exploratory" programming - for structs/classes, C#'s autoproperties and "object" work quite well, and you can easily escalate into stronger typing as you go along   * Runs on non-Windows hardware - Yeah, so? Outside of college, I've only known one person who doesn't run Windows at home, or at least a VM of Windows on *nix/Mac. (Then again, maybe this is more important than I thought and I've just been brainwashed...)   * The REPL for bottom-up design - Ok, I admit this is really really nice, and I miss it in C#. Things I'm missing in Lisp (due to a mix of C#, .NET, Visual Studio, Resharper):   * Namespaces. Even with static methods, I like to tie them to a "class" to categorize their context (Clojure seems to have this, CL doesn't seem to.)   * Great compile and design-time support      * the type system allows me to determine "correctness" of the datastructures I pass around     * anything misspelled is underlined realtime; I don't have to wait until runtime to know     * code improvements (such as using an FP approach instead of an imperative one) are autosuggested   * GUI development tools: WinForms and WPF (I know Clojure has access to the Java GUI libraries, but they're entirely foreign to me.)   * GUI Debugging tools: breakpoints, step-in, step-over, value inspectors (text, xml, custom), watches, debug-by-thread, conditional breakpoints, call-stack window with the ability to jump to the code at any level in the stack      * (To be fair, my stint with Emacs+Slime seemed to provide some of this, but I'm partial to the VS GUI-driven approach) I really like the hype surrounding Lisp and I gave it a chance. But is there anything I can do in Lisp that I can't do as well in C#? It might be a bit more verbose in C#, but I also have autocomplete. What am I missing? Why should I use Clojure/CL?


How to support design decisions?

There are bad design decisions.   On the same pitch, being a senior engineer can sometimes be hard. Youngsters have awesome and radical ideas, which a senior engineer wonders whether will work on the field, and if it is worth spending all that effort. Experience suggests that these are short-term solutions are very expensive in the long run. However, it might be hard to convince otherwise. How does one go about in this scenario? **Patterns** are a good start, however, it takes a little experience to figure out where to apply a pattern, as a newbie might restate the problem to fit the pattern. Also, patterns do not help at coarser/component levels. Another idea is to **refer to a good design** that _works in the field_ , and is outside the organization. The problem here is that sometimes drawing a parallel might be hard. Are there any other ideas?


Is BSD-License compatible with Apple AppStores?

I would like to know if it is possible to make an application to be sold on Apple AppStores that is linked (during compilation) to a BSD-licensed library.