Best practice for handling asynchronous inter communication?

Recently completed a project for handling credit card processing. One of the difficulties I faced was handling the delay / possible failure of notification messages. The most complex example was:   * an external system sending the request for payment   * my system turning that request into a request to the payment gateway   * sending the user to the gateway   * waiting for the user to perform payment   * the user returning back to my system but being held until the system receives notification of success/failure   * Sending the user back to the external system depending on failure Even more difficult was the fact that upon failure to send the notification the gateway attempts to send the notification every 15 minutes for a number of hours. I solved it using a database record of pending transactions and then detecting success and failure from the return plus a timed delay listener for the notification and transaction handling... Reasonably difficult! But this must have been solved a gazillion times before so what is the best practice? I can see my future is going to be writing the handling between all of these systems and managing the time delays and possible network failures so I want to be following the best practices. Book / article recommendations would be great. Thanks in advance!


How best to prevent having to revisit a change after check in

Normally what happens is that I work on something for a while and then when I am done I check it in(After the test/review process of course). Sometimes I have to go back and fix something that I got wrong the first time due to me not understanding the problem enough, lack of testing, etc.. What is an acceptable rate for this? Ideally you would hope that you never have to go back but sometimes you do. What rate does the average programmer have and what is the expert programmers rate? Do people track this? Lastly what kind of checks are best at preventing this? PS: I am not counting the cases where the requirements have changed and you have to go back in. I know that there is no real answer to this so let me change the actual question to: "What general checks could be implemented, before code is sent for review or checked in, that would help prevent the need to revisit the change later?"


Does being a general programmer naturally lead to failure?

In business they say that to succeed > "Pick one or two things and do them very well". This is the antithesis of the modern programmer. We are exposed to a constant stream of changes in business, technology, tools and everything else. There are a handful of guys lucky enough to concentrate on one core technology, say C#...then blog about it, be an expert at it. But all in all, knowing C# well (but no other technology) + 50 cents will buy you a Coke. So, are we all doomed to miserable customers and generally miserable careers? Or, is there some way to succeed despite the "law of business"?


Are Session implicit objects examples of Models in MVC?

I have read that the Model is responsible for maintaining state among HTTP requests, for example in this article: > The Model is responsible for maintaining state between HTTP requests. > > Basically any data whether on a database, in a file, stored in the Session, > or cached inside APC must be preserved between requests and thus forms part > of the state of the application at the time the last request was completed. > So always remember that the Model is not just the database. Even the data > you get from web services can be expressed as a Model! Yes, even Atom feeds! > Frameworks which rattle off introductions to the Model, almost never explain > this upfront which only exacerbates misunderstandings. When we use some implicit Session objects (say in PHP, JSP etc.,) does it mean that this Session is a Model object?


How do asserts and other error avoidance checks fit into TDD?

http://butunclebob.com/ArticleS.UncleBob.TheThreeRulesOfTdd > You are not allowed to write any production code unless it is to make a > failing unit test pass. So where do asserts fit into this? If you followed this rule you'd never write an assert without a unit test. But how would you test for the existence of an assert? The very nature of `assert` seems to make this idea impossible as the test would explode. And what about code meant to handle absurd conditions that are difficult or impossible to replicate? Some sort of FUBAR from a system call for example... You need to handle the error but the condition that causes the error is pretty rare and comes from the OS. How do you write a unit test to make that fail? Or say you're writing a template library and want to do some concept checks before going too deep into template vomit land? I don't know of any framework that supports compile time failure as a test PASS. I've tried to live by some of these TDD edicts, but at some point I've always run into walls I can't get around. These are some. I guess I should say that I'm talking about assert in the C/C++ sense in which a program, built without NDEBUG, will fault out if the assertion fails. Not some exception throwing mechanism that's _called_ assert. Didn't even realize someone would use that name for throwing exceptions.


Can neural network discover rng patterns

Can neural network find connections beetween numbers generated by random number generator without knowing about it's seed and predict this rng's next numbers with more sucess then randomly guessing? I really couldn't find any data about this. Thanks


Should there be a formal role (internal or external) assigned to dev environments to control wasteful complexity?

A few years ago, I worked for a small company that went so far into developing in-house frameworks that they dedicated their most senior developer, and their architect to developing a custom MVC framework and ORM from scratch. These two things were orthogonal to their core product. Unfortunately the support for this framework-driven approach came from the top, and it delayed delivery of revenue-generating software - and the frameworks produced were notably inferior to off-the-shelf alternatives, which compounded the delays. The company burned through cash quickly, and, eventually, everyone was laid off. A later employer made a similar mistake - they got a highly technically skilled developer - a perfectionist, with a strong grounding in enterprise design patterns to grossly over-engineer a consulting solution for one of their clients, knowingly taking a loss, in the hope that the solution could be adapted and extended for other customers. The project overran significantly. But no other potential customers bit. A gold-plated strategic blunder that cost a small fortune. In both cases there was a significant degree of overengineering. In both cases the company and project management were people with domain or analysis backgrounds, rather than a programming background. In both cases the software architects built overly-complex solutions to scratch their itches, and enhance their résumés, with some complicity from non-technical management. In both cases the architects had no stake in keeping costs down (apart from the risk of losing their jobs if the companies went bankrupt- which wasn't much of a risk, considering their high employability). My experience suggests that it isn't an uncommon trap for dev shops to fall into. Is there place in software projects for a formal internal or external technical adversarial role - a "Quantity Surveyor" - to use a building analogy- that can call out, or prevent wasteful over-engineering? Who is best suited to fill this role?


Is there a specific reason that dingbat fonts are supported or ever even created?

I have known about the weird dingbat fonts since the first time I tried to change the font on MS word and stumbled upon them. Since then I never questioned them, I just thought hey cool. Now I have some questions. What is the purpose behind creating dingbat fonts? Is there anyone/entity that actually uses/needs these types of fonts?


Static vs. non-static? (with non-OOP functions)

Although this question has come up before, mine _is_ different because it is not supposed to cover anything OOP but only **plain (ANSI) C**. Especially in open-source software, I usually encounter a plethora of functions (please don't call them methods since we're _not_ in OOP) with the `static` keyword preceding the data type. But what effect does this actually have with plain C? In my own projects, I've never had an occasion where the `static` keyword was actually needed. (Although a so-called expert programmer would probably have given me the advice, "This function should be declared static" and I would probably have replied in my own sarcastic way: "Uh-huh. Well, it works as-is, after all". :)). From reading the OSS code, I assumed it might just generate less overhead when compiling the project. However, CPU have advanced in performance so much that I've wondered many times why there is such an ongoing interest to declare functions static even though it might need some benchmark tool to measure the differences in execution speed.


Nested maps vs. combined keys

in the project I am currently working on we had three different types of prices depending on the age of the user (adult, child, etc...). So we had on the DB a table looking like this: > >     PRICES >     type     Amount >     A         20 >     B         15 >     C         .. >     D         .. >   At first we only had 4 different types of prices, so in the code, we had something like this:               Map<String, BigDecimal> prices = new HashMap<String, BigDecimal>();      Where the keys were the price type. Recently, they added a new business rule that adds 3 subtypes to every price type, so now we have something like this: > >     PRICES >     type   subtype  Amount >     A          1      20 >     A          2      15 >     A          3      .. >     B          1      .. >     B          2      .. >     ...        ..     .. >   **Which of the following two options do you think is better and why?** # Nested Maps               Map<String, Map<String, BigDecimal>> prices;      where the keys are the price type and subtype:               prices.get(type).get(subtype);      # Combined Keys The same map than originally:               Map<String, BigDecimal> prices;      And concatenate the keys to index the different prices:               prices.get(type+"_"+subtype);


Producer-consumer pattern with consumer restrictions

I have a processing problem that I am thinking is a classic producer-consumer problem with the two added wrinkles that there may be a variable number of producers and there is the restriction that no more than one item per producer may be consumed at any one time. I will generally have 50-100 producers and as many consumers as CPU cores on the server. I want to maximize the throughput of the consumers while ensuring that there are never more than one work item in process from any single producer. This is more complicated than the classic producer-consumer problem which I think assumes a single producer and no restriction on which work items may be in progress at any one time. I think the problem of multiple producers is relatively easily solved by enqueuing all work items on a single work queue protected by a critical section. I think the restriction on simultaneously processing work items from any single producer is harder because I cannot think of any solution that does not require each consumer to notify some kind of work dispatcher that a particular work item has been completed so as to lift the restriction on work items from that producer. In other words, if Consumer2 has just completed WorkItem42 from Producer53, there needs to be some kind of callback or notification from Consumer2 to a work dispatcher to allow the work dispatcher to release the next work item from Producer53 to the next available consumer (whether Consumer2 or otherwise). Am I overlooking something simple here? Is there a known pattern for this problem? I would appreciate any pointers.


Designing module interfaces

I'm studying software engineering and one thing I'm really trying to improve is my skill in software architecture. My question is quite broad, so I'll try to explain it with an example. Suppose you have a model layer and a service layer. The model manages various entities (such as users, products, orders, campains etc.). The services provide features, such as _evaluating the efficency of a campaign_ , and use several modules of the model layer to access the required data. _How_ and _when_ do you specify those dependencies? I see the following possibilities:   * Allow general access to all models. This is the approach taken in many MVC frameworks, where the controllers can access any model classes. **Pro:** You don't have to specify the dependencies, the developer writing the controller is very flexible.   **Contra:** If you want to test a service, you don't really know which model you have to mock because the service could use everything. These implicit dependencies can also make maintainance a pain.   * The services specify the required models explicitly. Dependency management systems like requirejs or CommonJS require work this way. **Pro:** No implicit dependencies simplifies maintanance   **Contra:** Mocking is impossible. When designing the module, you have to know exactly what the module will need. If you later notice that you need another interface, you have to change the architecture.   * Specify explicit interfaces that will be provided to the service. Anyone instancing the service will have to provide implementations of the interfaces. I think dependency injection works this way, although the injection is automated there. **Pro:** No implicit dependencies simplifies maintanance, Testing is simplified, because you know exactly what to mock.   **Contra:** When designing the module, you have to know exactly what the module will need. If you later notice that you need another interface, you have to change the architecture. In theory, dependency injection seems like the best way. But is it practical to specify each requirement? How fine-grained should it be? Per entity? Group them? Or one dependency per "thing you can do with an entity"? There are simply too many possibilities, and I'd like to get some real-world advice.


Reusing Mocks/Stubs as Test Specification

We use mock to ensure that a unit test only runs against the code that should be tested. This prevents that a bug in a module A causes tests of a dependent module B to fail. However, now we also have to test the interaction explicitly. It is not enough that A and B are green on their own, A has to work as B expects it, and B has to have the right expectations. Now, B's expectations are already formally defined: in the mocks and stubs. If I have a stub where A returns certain output for certain input, this means I expect it must be possible to have A in a state where it shows this behavior. So instead of writing long integration tests, I just have to set-up an A and test it against the stubs and mocks that are already there. Or, to turn it around, I can use an actual instance of A to test the correctness of my mocks. Does this work in practice? Are there best practices (e.g., where do these pseudo-integration tests belong to, should A's test suite already provide some likely-to-be-used mocks)? Is this even possible with the popular mocking frameworks?


When should you use a private/inner class?

To clarify, what I'm asking about is               public class A{         private/*or public*/ B b;     }      vs.               public class A{         private/*or public*/ class B{             ....         }     }      I can definitely think of some reasons to use one or the other, but what I would really like to see are convincing examples that show that the pros and cons are not just academic.


Why is Internet Explorer the only browser to be referred to by version when talking about compatibility?

Whenever I read something or hear someone talking about HTML5, CSS and JavaScript support, they always refer to Internet Explorer with the version number such as Internet Explorer 6, and Internet Explorer 9. But they only refer to Google Chrome, Firefox, Safari and others without version numbers. Shouldn't they also specify the version number in which certain web technologies are incompatible for other browsers instead of just Internet Explorer?


What makes the difference between "Hire" and an honest "almost" for final on-site interviews?

So, I have recently had on-site interviews with Google and Amazon and received polite rejection letters letting me know I was close, but not quite right for the skills they were looking for. I've made it to the final round for all the interviews I've done (except for some offers from small uninteresting positions that I interviewed with for practice), but so far having 5-8 interviews in a day gives me enough time to have my mistakes add up just enough to put me out of the running. I know I did well there at least on the coding questions and other general technical questions, apparently I'm bad at designing OOP things like card games or parking garages though (I dove too deep into one object and used up all my time, instead of being broader) and my coding answers although they work overall didn't quite had a few bugs/edge cases I missed (like a case where an input node could actually could be the answer rather than needing to be distinct). And I have no problem saying "I don't know", but maybe I'm rambling a bit and need to say it for questions I think I can answer, but can't give a crisp answer to... So, what are the things that push you over the top from being good, but not quite to "Hire"? Any advise on what you look for or something you know that gave you that little extra boost?


How to implement "email invitation" feature using Asp.Net Identity Framework 2.0 and OAuth?

My engineers are implementing authentication and authorization using Asp.Net Identity Framework 2.0. The requirements state that we need to support the following scenario:   1. Global admin user signs in.   2. Global admin user views an organization.   3. Global admin user invites organization user or admin to system.   4. Email is sent to invited user containing special link.   5. Invited user clicks on link, signs into their "Microsoft Account" (@hotmail.com) and is then signed into our website and associated to the organization and with the correct role assignment. In my opinion, we should be able to do all of this using out-of-the-box features of Asp.Net Identity Framework. For example: In step 3, we can call the CreateUser() method and it should provision a user account that has not yet been confirmed. We can use the ConfirmationToken it generates to email the user. Is this not the correct way to proceed? My engineers think that they need to implement custom user, role and organization tables and implement all custom authorization and roles for this because they believe that the user account within the identity framework can only be created when the user comes back from signing in (via OAuth) the first time.


Why does Java's String class not implement a more efficient indexOf()?

Following the below question on Stack Overflow http://stackoverflow.com/questions/5564610/fast-alernative-for- stringindexofstring-str I got to wondering why it is that java (6 at least) not use a more efficient implementation? Following is the code: java.lang.String#indexOf(String str)               1762    static int indexOf(char[] source, int sourceOffset, int sourceCount,     1763                       char[] target, int targetOffset, int targetCount,     1764                       int fromIndex) {     1765        if (fromIndex >= sourceCount) {     1766            return (targetCount == 0 ? sourceCount : -1);     1767        }     1768        if (fromIndex < 0) {     1769            fromIndex = 0;     1770        }     1771        if (targetCount == 0) {     1772            return fromIndex;     1773        }     1774     1775        char first  = target[targetOffset];     1776        int max = sourceOffset + (sourceCount - targetCount);     1777     1778        for (int i = sourceOffset + fromIndex; i <= max; i++) {     1779            /* Look for first character. */     1780            if (source[i] != first) {     1781                while (++i <= max && source[i] != first);     1782            }     1783     1784            /* Found first character, now look at the rest of v2 */     1785            if (i <= max) {     1786                int j = i + 1;     1787                int end = j + targetCount - 1;     1788                for (int k = targetOffset + 1; j < end && source[j] ==     1789                         target[k]; j++, k++);     1790     1791                if (j == end) {     1792                    /* Found whole string. */     1793                    return i - sourceOffset;     1794                }     1795            }     1796        }     1797        return -1;     1798    }


Some team members don't actively participate in Sprint planning

Some team members just wait until the stories they are most likely to work on will be discussed and only then they participate. Otherwise they just play with their phone and don't listen. In some way I understand this position. Why listen to a discussion about a feature you are unlikely to help develop in the Sprint or ever? What do you think we should do?


Asynchronous Designing and Programming

Me and a friend are looking to team up for some freelance web designing. We both are very strong PHP coders and website designers, but I am better at design and he is better at PHP. So, I'll be controlling the stuff the user sees, he'll be controlling the stuff the user does. In order to speed up development, I'm wondering if anyone has experience or recommendations for asynchronous web designing and coding. So far my best idea is to create a doctrine of which tags and classes every element should be wrapped in (if any), then have us developing via FTP. He would create the code that spits out snippets of HTML, and I would simply style those snippets and wrap it in the page. Does anyone know of a better way? So, any ideas?


svndumpfilter Multiple Versions

I have a few questions about the Subversion open source project. I know that there are multiple versions of svndumpfilter (2,3). What are the tradeoffs and benefits of each version? In other words, what problems does each version seek to address? There are known bugs in the original svndumpfilter that have not been resolved for years. Out of curiosity, why is this the case? Is it because svndumpfilter is of lower priority than the other working components of svn?


Is there something which can write the function for me given the pattern?

For example I have the following. The inputs are on the left. The outputs are on the right. The second term in the input which is the number 3 is the number of output numbers I want. It would be really useful if there was a program which given this pattern could just give me the code written to produce it. Is there such a thing?               0 3 -> 0 1 2     1 3 -> 3 1 2     2 3 -> 3 4 2     3 3 -> 3 4 5     4 3 -> 6 4 5     5 3 -> 6 7 5     ...


Third party libraries in an open-source C# project

I'm going to start an open source project from scratch, using git (via github) to manage the source. The project will be written in C# and will depend on at least two external libraries (more are likely to come). I wonder how I should reference the libraries, and the following ideas came to my mind:   * A folder within the project that contains all external libraries as dll   This would mean I have the dll files in my repo, which I think is bad, because it isn't source. Also, I don't know how Visual Studio (or other IDEs) store the path the libraries, if they use absolute paths, that would be impossible.   * Get the external libraries via nuget   This would be a clean and nice way to have the libraries organized, but what what if a library I need doesn't have a nuget-package? I can't just create one, can I?   * Storing the source of the external library as part of my repo   Sounds like a stupid idea, it would make updating the libraries a pain.   * Reference the repositories of the other projects via git somehow.   Sounds good, I could make my own fork of it to keep a state or just point to a commit. But is that even possible? Is that a good way? **tl;dr:** How should I handle external libraries in an open-source C# project?


Am I wrong in thinking that needing something like AutoMapper is an indication of poor design?

Automapper is an "object-object mapper" for .Net, which means copying objects from a class into another class that represents the same thing. Why is this ever useful? Is the duplication of classes ever useful/good design?


What is the/Is there a right way to tell management that our code sucks?

Our code is bad. It might not have always been considered bad, but it is bad and is only going downhill. I started fresh out of college less than a year ago, and many of the things in our code puzzle me beyond belief. At first I figured that as the new guy I should keep my mouth shut until I learned a little more about our code base, but I've seen plenty to know that it's bad. Some of the highlights:   * We still use frames (try getting something out of a querystring, almost impossible)   * VBScript   * Source Safe   * We 'use' .NET - by that I mean we have .net wrappers that call COM DLLs making it almost impossible to debug easily   * Everything is basically one giant function   * Code is not maintainable. Each page has multiple files that are created every time a new page is made. The main page basically does Response.Write() a bunch of times to render the HTML (runat="server"? no way). After that there can be a lot of logic on the client side (VBScript), and finally the page submits to itself (often time storing many things in hidden fields) where it then posts to a processing page which can do things such as save the data to the database.   * The specifications we get are laughable. Often times they call for things like "auto-populate field X with either field Y or field Z" with no indication of when to choose field Y or field Z. I'm sure some of this is a result of not being employed at a software company, but I feel as if people writing software should at least care about the quality of their code. I can't even imagine that if I were to bring something up that anything would be done soon, as there is a large deadline looming, but we are continuing to write bad code and use bad practices. What can I do? How do I even bring these issues up? 75% of my team agree with me and have brought up these issues in the past, yet nothing gets changed.


What are some useful resources for learning tuple calculus?

I've been trying to go over my tuple calculus over and over again. What's worse is that my professor and tutors are not much help during their hours. Does anyone know a good place to learn about tuple calculus? I'm having a hard time understanding how to "speak" the language in terms of what I want to get from a database.


Algorithm to use for shop floor layout?

I ran into a classroom problem yesterday (business oriented class, not computer science) and I found it interesting from an algorithmic perspective. The problem goes something like this:   _Assume there is a shop floor with N different rooms, and you have N different departments that need to go in those rooms. The departments and the rooms are all the same size, so any department could go in any room. There is a known travel distance from each room to each other room. There is also a known amount of trips necessary from one department to another (trips are counted the same regardless which room they originate from, so a trip from A to B is equivalent to a trip from B to A). Given those inputs, determine a layout of departments into rooms which minimizes travel time._ What is the best way to approach this problem algorithmically? Is there already a particular algorithm or class of algorithms designed to solve this type of problem? Does this type of problem have a name in computer science? I am not looking for you to _design_ an algorithm to solve this, although feel free to do so if you would like. I'm wondering if this is a problem space that has already been well defined and studied algorithmically and if so get some links to research further. I can see a lot of different data structures and algorithms that might apply to this and I'm curious which approach would be "best". And don't worry, you are not doing my homework for me. This is not a homework problem per se, as this is a business course and we were simply discussing the concepts and not trying to solve the problem algorithmically.


Fluent interface implementation and reflection. Case study

I hope I picked the right group for this question... I have this little framework I want to implement and I would like to have an opinion on it. In particular I am more concerned about the succinctness and style of the solution. My class sketch looks like this:               public interface Builder<T> {              T build();     }          public interface RootObject {                   public static abstract class MutableBuilder<T> implements Builder<T> {                  protected MutableBuilder() { }                  protected abstract void setA(A a);                  protected abstract void setB(B b);                  protected abstract void setC(C c);                  protected abstract void setD(D d);         }     }      The goal is to have a Builder which returns an instance of (hopefully) immutable objects. The whole implementation is left to the client code, but I still want to give the imprinting of the Effective Java's fluent interface. If it was just for this, I would not be that puzzled. The problem comes into lay when I add the requirements:   * the framework needs to reflectively search through a generic `RootObject` implementation in order to find if the `MutableBuilder` static inner class has been implemented.   * if found, the framework instantiates one or more `MutableBuilder` dynamically (that is the reason why I have an abstract class with a constructor and return it or them to the client code. The mere talking about reflection makes me wonder if I am doing the right thing. It looks a reasonable solution to me (of course).


Can I continue to sell a tool/library I wrote in the past now that I got a full-time job or company will not like it?

I was selling a library/framework/tool to companies. Licensing the binaries. Now I got a full-time-job. Haven't started yet, but will start soon. And I just got a request for quote from a company in the same industry as my new employer. Not direct competitors, but same industry. Is it ok for me to license my software to them? Or this will put me in trouble with my soon-to-be employer? I don't think asking the company is even appropriate at this time. They are giving me a job to work for them, not to ask if I can sell my software on the side. No idea what to do. Any recommendations?


DLL Hierarchy issues

I want to preface this by saying "I love my job and I want to stay here" But I've got a serious problem,   1. Circularly linked DLL's (DLL's linked back to the EXE)   2. Special builds with conditional defines to get rid of the links when the EXE doesn't exist for using the DLL's in special utilities.    3. Inability to reference our own DLL's as external functions because they throw errors when linked (have to use Windows LoadLibrary functions instead) So... My question is, referencing the executable seems like a bad idea, but a necessary evil to get session information (this is a client/server application with multiple users). Is the best way around referencing the executable in it's called DLL's is to initialize the DLL's called by the executable with all the information it could ever possibly need to do its job?


How do you find the first common element in two arrays

The way I did it was to loop through each at the same time and add the current value to a separate set for each of the lists. Also, check if the current element is already in the other list's set. I have no idea if this works though and if so, why? I know it finds a common element but does it find the first common element? I can't think of counter examples but I'm having trouble convincing myself it's definitely correct. Also, even if it is correct, is there a better way of finding the first common element?


Is Entity Framework only for Asp .NET / Asp. NET MVC?

I never coded on VS and I'm a junior programmer in C# and I would like to know if the entity framework is available only for ASP .NET applications ?


serving up future-proof kinfolk - extensible contract interfaces

Ok, **I have this human here, but what can it do** , how would you discover its special abilities? And when you find out what kind of expert you've got then how would you actually make use of its unique responsibilities? An example for this architectural pattern question: ### Base Interface with Characteristics Common to All               interface IHuman {         DateTime GetDoB();     }      ### Extended Interface 1               interface ICivilian : IHuman {         string GetEmail();         void SendEmail();     }      ### Extended Interface 2               interface IAccountant : IHuman {                 double CalculateProfits();     }      ### Extended Interface n+               interface IAnotherSpecializedHuman : IHuman {         void DoSomethingExpert();     }      ### Specialized API Discovery and Usage How would you design   * a highly pluggable and loosely-coupled system   * with which you can carry out all the common human operations (e.g. get age),   * but also carry out any specialized operations that are available,   * depending on which modules are incorporated      * e.g. you can send email, because ICivilian module is provided     * but you cannot calculate profits, because IAccountant plug-in is not provided   * and the question is **not so much aboutproviding different implementations but about providing different specialized APIs** (and APIs that have a common parent with shared functionality)


For a socket based application : how must I handle dynamic ip adress?

I plan to write an network application whose use steps is the following :   1. Connect to the server and choose a name (and enter your email "id")   2. The list of others "free" (not playing a game) players is shown to you : so you have to select one.   3. The server use the two players ip adress in order to connect them But I think I will be facing a great issue :   * how to handle dynamic ip adress carefully : can a dynamic ip adress change while the established connection is not yet finished ?   * if yes, how must I handle that, let's with Java 7 for example ? Regards


Hiding query strings logically?

I feel uncomfortable when using query string parameters as: `http://xyz.com/default.aspx?carId=1129&country=uk&uniqueId=98745DVF4563VVf1259` I would rather use something that should not make sense to anyone who is trying to make some sense from the URL: `?a=1129&b=uk&c=98745DVF4563VVf1259` (after all this query sting info is for my use only) Firstly is this a good thing to do? (I mean to hide logic of you query string) If it is, then is there a way, that internally developers can use `carId`, `country` and `uniqueId` in code, but externally the url uses `a`, `b` and `c` respectively? So if someone goes to   `?a=1129&b=uk&c=98745DVF4563VVf1259` when I do `Request.QueryString["carId"]` I should get 1129. Can this be done?


"Kill switch" in customer hosted environments, to protect payment?

I have a difficult client. Every bill is argued and debated over, and each email is parsed with a lawyers eye (because he's a lawyer), looking for a way to avoid paying for something. No amount of generosity on my part is ever reciprocated. The client currently has 60% of his bills unpaid (these are invoices he signed off on), and it is a substantial amount of money. How it got to this stage, admittedly is a product of my own naïveté. Since the client hosts his own code, I can't shut off the hosting and demand payment. **Is it legal to install a remote "Kill Switch" to shut down the customers code unless bills are paid?**


What is the best objective way to measure language popularity trends? (What's better than TIOBE?)

The best way to get data on computer language popularity that I know is the TIOBE index. But _everyone knows_ that TIOBE is hopelessly flawed. (If someone provides a link to support this, I'll add it here.) So is there any data on programming language popularity that is generally considered meaningful? The only other option I know is to look at the trends at indeed.com, which is inherently flawed, being based on job postings. It isn't like I would make a future language decision solely based on an index, but it might provide a useful balance to the skewed perspective one obtains by talking to ones friends and colleagues. To illustrate that bias, I'll point out that based on the experience of those I personally know, the only languages used professionally today (in order of popularity) are Java, C#, Groovy, JavaScript, Ruby, Objective C, and Perl. (Though it is evident that C, C++ and PHP were used in the past.) So my question is, everyone bashes TIOBE, but is there anything else? If so, can anyone explain how we know the alternative has better methodology? Thanks.


Wrapping simple statement in a function in java?

I was working on neo4j graph database in java. To get the reference node of this db:                   GraphDatabaseService graphDb=new EmbeddedGraphDatabase(DB_PATH);              Node Root=graphDb.getReferenceNode()      I always forget to prefix graphDb when calling getReferenceNode(). So what I did :                  public Node getRootNode(){        return graphDb.getReferenceNode(); }      Now after doing this , I thought this to be overkill as I am replacing a simple statement with a function call which surely has overhead but using getRootNode seems more intuitive to me. So my question is am I right in thinking that doing the above mentioned thing is inefficient? Or does it not affect performance that much?


Should an Http API always return a body?

Is there some sort of standard regarding http api responses? After reading this discourse thread I started to wonder. We are developing our public http json api at my work, and we do not return anything when it's not strictly needed (for example a PUT to /resource/{id} only returns 200 when ok or the corresponding 4XX or 5XX code, but no json body) Should we return a generic `{"success":true}` like they discuss on that link above, or is it ok to return a "void" body and handle everything with http response codes?


What language should be used to teach object-oriented design and development in university?

My understanding is that C++ is usually offered as the 1st OOP language, and as the 2nd programming language (after C) in my country (Bangladesh). I've taught it several times, and the problem I've run into is that students often tend to think C++ as an extension of C, i.e. C with `cin` and `cout`! This has lead me to think about teaching Java as the first OOP language in the upcoming semester. What is your opinion? I would like some suggestions from professional programmers as well as academics.


Real world use of C# Delegates

I think that I conceptually understand C# delegates, however, I am struggling to find a real world example where they would be useful. Can you provide some answers detailing how C# delegates were used in real applications and what problems they enabled you to get around.


Tricky logic puzzles - Are they really useful in assessing programming skills?

In the last interview I attended, I was asked to solve a puzzle where I was expected to measure exactly blah liters of water given two buckets with capacities - blah and blah liters respectively. I was unable to solve the puzzle in given time (~5 minutes). The interviewer was a bit disappointed and said a programmer has got to have "these" skills. I didn't get what skills he was talking about. I have always felt strange about these kind of puzzles that are normally asked at programming job interviews. I do not understand what, if at all, is the connection between such puzzles and programming. Exactly what skills do interviewers intend to assess with such puzzles?


Coding for good or charity

I'm looking for an open source projects, code-a-thons, or organizations which create software used for charity purposes or to help out charities. There must be a demand, but it is hard to locate them due to the wide variety of terms used to describe what they do. My preference is for sites with some degree of a positive reputation or some proof of effectiveness, such as through the number of charities helped. I understand that many of these may be localized, but my hope is to build a list of possible organizations to consider contributing time towards. I think this is on-topic because of "freelancing or business concerns" and it's only a moderately subjective question. GiveCamp is a good example (thanks, ElYusubov!) but We Are Microsoft is not so good since it's stale from 2010.


What's the least intrusive method for creating a backup of a couchdb database?

We're looking to create regular backups of a couchdb database, to ship offsite. What's the least intrusive way to obtain these - ideally without interrupting or significantly slowing down performance on the existing database server?


What is the difference between the BSD and the BCL licenses?

What differences are there, if any, between BSD and BCL licences?


what's best language to mate with Adobe Flex-based GUI for math crunching?

I'm not a software expert but need to outsource a web-based scientific GUI application, and I'm considering Adobe Flex. My math routines are currently in Javascript and C/C+. Having no experience with Flex, was hoping someone could help me understand what options are available for performing (preferably fast and efficient) CLIENT-side calculations. That is, can Flex interact with Javascript and/or C easily? If not, is actionscript or other language preferred? Downsides/tradeoffs? Need functions like LOG10, LN, SQRT, and would be nice to also have the error function (ERF) and complementary error function (ERFC), although I may be able to derive these last two from more basic functions if necessary. Thanks!


God Files versus Ravioli Code

Recently I asked a question about whether or not I should refactor my code. the responses I received were most definitely in the camp of going through with the refactoring due to the presence of a God File. However, now I'm pushing towards what I fear is Ravioli code. I will have around 6-7 ".c" modules (which I find perfectly manageable), but I'm pushing in to having probably around 10~ ".h" headers. I also still have about 8000 lines of code I need to parse through and refactor into their own parts and I'm not even sure how many more headers I'm going to need. I will probably be condensing and combining a few headers, but my question is: What is worse from a software maintainability point of view, having potentially too many modules (making it difficult to find and change definitions) or averting previous problem by potentially having fewer files but have them be bloated with excessive functions? Is my problem inevitable due to the 12k+ lines of code? Or am I simply blowing the size of the system out of proportion?


PHP: brackets or no brackets with if/for/while/...?

Both these syntaxes are correct and equivalent: With brackets:               foreach ($listOfThings as $thing) {       echo $thing;     }      Without brackets:               foreach ($listOfThings as $thing):       echo $thing;     endforeach;      Two questions come up in mind:   * Is there any real difference between them or are they totally identical (performence, for example)?   * Is it better always to use the same one or to use both, depending of some context (for example: to recognize easely the code concerning the framework). I suspect all that to be a matter of taste and company standards, but I'm not sure of that.


Creating a web application to concatenate strings to unify naming conventions

I've been tasked with creating a small web application, where users have a series of forms (I can't currently think of a better way of doing this) which will contain, either a)text input fields or b)drop down lists. The form will look as follows: `form1` `input box input box drop down box` `form2` `input box input box drop down box input box` `form3` `input box dropdown box input box drop down box` Now for each form, I would need to concatenate the resulting string stored within each box (drop down or input). Seems fairly simple and I already have a working prototype. Problem is for each form there can be multiple rows. What would be the easiest way to approach this? My skills are limited to HTML, CSS, JavaScript and some (light) JQuery. The working prototype I currently have the user fills out all the fields and then presses a "generate" button which generates all the conctenated strings. Is this approach that you would take?


What are the various branches of the C++ language out there?

Last time I tried to use C++ several years ago I remember having to include different libraries between different IDEs even though I was using the same operating system, which left me somewhat confused about the C++ language. Are there different standardizations of the C++ language? And if so, what branches of the language exist out there? Is the syntax and/or library names for each standardization different between operating systems? Also, What is primary standardization used nowadays?


Is XML required for this?

I am writing a desktop application in Java, which has all of the Airband radio frequencies for the UK in it. I would like to make this frequency database downloadable so people can print it. Would it be best to create the database in XML or use PDF for the download to print? Or perhaps there is another, better option?


Holding a presentation about what you've done

I have to give a presentation next week to my supervisor and my teacher about the activities I have performed during my internship. I've never been good at presentations and become nervous really quick. When I get nervous I start to talk really fast and skip valuable information I should've told. I feel like I need to master giving presentations if I want to become a serious software engineer later on. Do software engineers give presentations on a regular basis? How can I prepare myself for a presenation? Would I get less nervous if I gave more presentations? Any hints & or tips are greatly appreciated.


What features are vital for good bug tracking software?

What features are vital for good bug tracking software and why are they important? What in particular is necessary for you to consider these features done right?


How long do programmers generally stay in industry?

One thing that I've heard a lot over the years is that those working in the IT world generally don't make life time careers out of it, but tend to "burn out" and start a new career doing something else unrelated (e.g. going from software development to being an accountant). Have you found this to be generally true in your experience and if so, what is the general impression on how long people work as developers before starting a new career?


Scrum vs. Agile vs. CMMI

I am pushing my project over to Visual Studio Online in order to have some source control. I am developing this project by myself. I have never used Scrum, Agile, nor CMMI before, and the detailed description I read at http://msdn.microsoft.com/library/vstudio/ms400752.aspx is assuming a lot of knowledge. (It makes no sense to someone who doesn't already know what they are talking about.) The best way for me to really learn Scrim or Agile or CMMI is by using them. But where to start? The above link does not help me there. As a solo developer who is just looking for source control, should I start off with Scrum, Agile, or CMMI? To take the opinion-basedness out of this question, I will make my official question: **What is the difference between Scrum, Agile, and CMMI in Layman's terms?** (But really, I just am trying to figure out where to start!)


Design MVC site such that UI developer can work without access to data tier?

I'm working on an ASP.NET MVC site (using Team Foundation Service for source control) that I've divided into a few separate projects under one solution:               Project.WebAPI (Main entrypoint, contains "Views","Scripts" folders     Project.Data (abstract interfaces for backend data access)     Project.Data.SqlServer (concrete implementations for data access)      For my UI designer to work, he shouldn't need access to much. Pretty much the only thing that he's working on is the "Views" and "Scripts" folders of the main project. But "Project.WebAPI" takes parameters that live in Project.Data, so there's a dependency there. The app is SPA-style, so I could easily store a fake JSON payload which would entirely remove the need for logging in and pulling real data. My ultimate goal would be to be able to share a subset of the source with the UI designer allowing him to check changes directly into the overall project rather than create a separate instance just for his work which I would have to manually merge in. Does anyone have any experience with this type of thing? Edit: for clarity: The purpose is to protect the intellectual property of the solution so that the front-end developers don't have access to the entire solution. I hope that helps...


How to break these long C++ lines in a neat way?

I'm on my first bigger C++ project and find that I have some really long lines. My goal is to break them to 79 columns, but I do not really know how to do this in a neat way. Are there some guidelines to break lines like these:               VectorHistogram::VectorHistogram(size_t bins, size_t cache) : bins(std::vector<double>(bins)), cache(std::min(cache, MAX_CACHE_ENTRIES)) {      or               VectorHistogram position_histogram {settings.position_hist_bins, settings.time_sites * settings.iterations};      or               MetropolisDriver::MetropolisDriver(Settings settings) : settings(settings), system(HarmonicOscillator {settings.time_step, settings.mass, settings.mu_squared}), trajectory(ListQuantity {settings.time_sites}), ma(MetropolisAlgorithm {trajectory, system, settings.position_seed, settings.accept_seed}) {


Is it worth registering software with the U.S. Copyright Office?

nolo.com says: "If you want to stop someone from using or otherwise infringing on your work, you must sue the infringer in federal court. However, in order to do so, you must first have registered the copyright with the U.S. Copyright Office." Is it true that the only way to take legal action against software copyright infringers in the U.S. is to first register with the U.S. Copyright Office? And is it true that that's the only way to recover statutory damages? Are there other benefits of registering software with the U.S. Copyright Office? What are the costs, besides the fee and the hassle of re-registering new versions of the software?


What's is the actual reason that JavaScript is not enough to draw?

I'm looking for a pure JS library that allows to draw the mouse trail, but I cannot find anything pure but using canvas. Is there is a reason for that it could not be achieved? I'm on the wrong thoughts?


How to turn a website into an offline usable directed graph for searching shortest ways between pages

I am an advanced-intermediate level student focused on the .NET and C#. I know all the basics as well as classes, methods, objects, inheritance, OOP principles and all that. Problem is we haven't covered data structures like trees and graphs yet. Basically what I need my program to be able to do is this: Part 1 Console application:   1. Go online to a specific website and following the net of links on it, starting with the main page, create a directed graph with weightless edges and store it locally, so that it can be used without internet connection.   2. Be able to recreate the graph from the locally saved data and then by given 2 links as parameters to find and print the shortest path between them. Part 2 Some sort of UI:   1. By given webpage address and depth - visually represent in the browser a tree structure with the given website as root and the level of depth of the possible pages accessible by following the links from it. I would really appreciate it if you can direct me in the choices I have to make to accomplish this task. Mainly I am puzzled by these:   1. How to represent a graph in C#.   2. How to save it locally (program must finish within 5 seconds, so I cannot go online and do everything from scratch).   3. What should I use for the UI part with the tree visualization. I don't seek for complete answers rather than good directives. I need to learn these fast and not to waste precious time wandering.


Is the ADO.net Entity Framework appropriate when all you do is insert records in bulk?

My department develops software to migrate databases for our customers from their old CRM software to ours. In this process we could be inserting up do millions of rows, processed one at a time as we need to do mapping and formatting to go from their old system (which could be anything from a Relational Database to a set of flat binary files) to our MS-SQL database. Currently we use a producer consumer model that reads in from their old system to our mapper, then use another producer/consumer model to go from that in to thread local DataTables which get batched out every 15,000 rows in a SQLBulkCopy operation to keep the number of objects held in ram down (larger tables can easy exhaust the 2 GB limit for a 32bit application if we try to hold the entire table in memory before inserting it.) The issue is this is kind of a kludge setup to be able to generate the new rows and insert them in to the database. Recently we have had the opportunity to re-write the database to fit our needs and I have been working away at my manager at the idea to using some form of ORM. I have been starting to look around at various ORM solutions, and I know we want to stay with a pure Microsoft stack (it was hard enough to get my manager to consider using an ORM, and I don't have a snowballs chance of convincing him of using a 3rd party library, since the main CRM app uses a 3rd party image processing library that is not very good and he has hated 3rd party libraries ever since). Comparing Linq-to-Sql and ADO.net Entity Framework I think the EF fits our needs better. However I am concerned about performance. Most CRUD apps are Read->Update at a slow rate (only displaying one record or a set of records with a common variable at one time). **However we will just be doing Create, Create, Create. Is an ORM like EF designed to do that?** My manager is obsessed with performance. When this process was done in VB6 (which is how it was done up to two years ago) it could take up to several hours to run a conversion. With our current kludge the longest ones take at most half an hour to process several Gigs of records (the slowest part is dealing with that 3rd party image library I mentioned earlier, ones that are pure text take at most 10 min). **Could I potentially see a slowdown in EF versus using SqlBulkCopy, and what can I do to mitigate the running cost if it does?** * * * Also I had a really hard time deciding if this should go here or SO, if you think it should be SO please let me know. * * * **UPDATE:** In response to Wyatt Barnett answer: if using an ORM is the totally wrong way to go, is there any other solution that will perform well other than generating generic DataTables on the fly based off of the schema of the destination database? The thing I liked most about EF was the fact that I had strongly typed data types, and that I could update both our database and our objects mapping the database with the tools built into Visual Studio in one location.


Are there languages that make it easier to understand secure coding principles?

I'm interested in expanding my knowledge of security issues: things like buffer overflows, format string vulnerabilities, etc. I'd like to be able to go through a language and understand its security implications and pitfalls to get a better understanding of secure coding practices in general. Are there certain languages that are more conducive to a learning experiment like this? Are there languages, due to abstractions or complexity, I should avoid? Where should I start?


Dynamic Post-build event in Visual Studio

I am building a video server application that has multiple projects in Visual Studio. One project, the video server project, needs to call a shell script to generate documentation. This works fine when you build the video server project, because the script is simply               cd "$(SolutionDir)"     start documentationgenerator      However, there is also an SDK project that, when built, also builds the video server project. However, when it does this, it does not know where the shell script is, since it tries to use the _SDK Project's Solution Directory_.   * SDK Project   * Video Server Project      * shell script So the question is: how do I make the SDK Project find the Video Server Project? I checked the MSBuild properties and there are no properties that seem to deal with 'nested' projects.


Cairo Rotate Text : Transformation Matrix

http://www.cairographics.org/manual/cairo-Transformations.html I have been using Cairo Vector Graphics Library for some work, and I can't quite understand some parts: What is the default value of the transformation matrix? When do I need the transformation matrix anyway? Suppose I don't want to rotate text, will I still need to set it, will it still be set?


Securing Back End API for Mobile Applications

I have an application that I am writing for both iOS and Android; this application will be served by a ReSTFUL API running on a cluster of servers on "the internets". I am curious how the rest of the world is going about securing their APIs so only specific applications running on iOS or Android can use these APIs. I could go the same route as other OAuth providers by providing a key/secret combination (2-legged OAuth), however, what do I do if I ever have to change these keys??? Do I create a new key/secret for every person that downloads the app??? The application is a social-based game that will allow the user to interact with other "participants" in the game based on location, achievements, etc. The API will provide the following functions: -Questions, Quests, etc -Profile Management -User Interaction -Possible Social Interaction Once the app gains traction I plan on opening up the API ala Facebook, Twitter, etc. Which is easy enough, I plan on implementing an OAuth Server and whatnot. However, I want to make sure, during this phase, that only people who are using the application can access and use the API.


What should I know or learn to get up to speed on being a software QA engineer?

I've been a software engineer in .NET for the past 3.5 years, and did my own integration and unit testing, but nothing too extensive. Now I'm being interviewed for an entry level QA job, and I wanted to know what concepts I should become familiar with.


When writing tests for a Wordpress plugin, should i run them inside wordpress or in a normal browser?

I have started using BDD for a wordpress plugin i'm working on and i'm rewriting the js codebase to do tests. I've encountered a few problems but i'm going steady now, i was wondering if i had the right approach, because i'm writing test that should pass in a normal browser environment and not inside wordpress.   I choose to do this because i want my plugin to be totally indipendent from the wordpress environment, i'm using requirejs in a way that i don't expose any globals and i'm loading my version of jQuery that doesn't override the one that ships with Wordpress. In this way my plugin would work the same on every wordpress version and my code would not break if they cheange the jQuery version or someone use my plugin on an old wordpress version. I wonder if this is the right approach or if i should always test inside the environment i'm working in. Since wordpress implies some globals i had to write some function purely for testing purpose, like               "get_ajax_url": function() {         if( typeof window.ajaxurl === "undefined" ) {             return "http://localhost/wordpress/wp-admin/admin-ajax.php";         } else {             return window.ajaxurl;         }     },       but apart from that i got everything working right. What do you think?


Refactoring expansive message architecture

I am currently working with a system that acts like a message bus. A message comes in to the service (WCF Windows Service hosted). The system then uses a service locator pattern to look up which dynamically loaded assembly will be assigned to the message. The assembly is found and then a method is executed which handles the message. The response is then sent back to the client. The problem is that the message base is growing enormous, as well as their associated plugins. And there is a lot of code duplication. Let me give a few examples: >   1. GetOrderMessage >   2. GetExpiredOrderMessage >   3. GetOrderMessageByCustomerId >   4. Get_something_related_to_order_Message etc, etc... > As you can see, the messages are very specific. The messages themselves are simple data contracts and they contain zero business logic. On top of this problem, there is a plug-in for some of these messages that just handles one message. Therefore, there is almost a plugin for every message type!! The system appears to support a one-to-many relationship for a message/plugin, but it appears that all the implementations are one-to-one. How could I refactor these to reduce code duplication and make the system smarter? I would like the code to be more easily digested to developers because there is a lot of duplication happening. (Due to some constraints, I cannot use an ORM for data access/entity creation) In response to Robert Harvey's comment below, I would like to clarify the following: In 99% of the use cases, the plug-in layer is just simply wrapping a data access call. Here's how it might look.               Request of GetOrderMessage ->         Order Plug-in ->              Order Data Access (ADO.NET, hand-rolled stored procedure of usp_GetOrder) ->                  value returned from Order Plug-in ->                      Response of GetOrderMessage returned to client


Most MVC-strict php framework

I have been trying to wrap my head around MVC pattern for about 6 months.I've read tons of articles, Q&A, and blog posts about MVC and HMVC patterns, but I just simply don't get it 100%. I tried learning MVC by exercising one of widely used PHP MVC framework, CodeIgniter. I've implemented few internal websites for my company with it. And STILL, I don't 100% get it. I believe one of the best ways to learn something is to follow strictly defined rules. **So my question is:** What is the most strict PHP framework in terms of how MVC pattern is implemented? One that defines how I use models, controllers, and views so that I can completely get what MVC is?


Can I apply for "Software Engineer" jobs without being an engineer?

I am from a country in which the use of the word "Engineer" or "Engineering" is strictly regulated by legislation. This means that you must hold a degree in Engineering AND passed an exam to join the Engineers' professional association to use the title. I am a bit confused about the term "Software Engineer" as used in the industry, globally. I read the wikipedia page on Software Engineer and the linked section of the page about the term usage, which offer an in-depth discussion. However my question is somehow more concrete. Knowing that I don't hold a degree in engineering (yet, I like to think I produce funcional, well designed software!), when I see an opening for a software engineer from an international company, would it be appropriate for me to apply? Should I somehow emphasise that I don't hold a degree in engineering?


How can I efficiently handle input data without a framework?

I am working on a very small project and my design would be using technologies such as JSP, servlets, and POJOs. I'm considering a workflow where a JSP page will receive input data, then submit it to a servlet. The servlet would then have a lot of helper POJOs in it that would do all the real work. One thing I've noticed with this approach very early on is that it grew into a huge number of if-then-else statements. Is there a better way to accomplish what I'm trying to do without having to resort to a framework?


Possible solutions for sharing working copy of project between multiple computers?

So there are 3 computers that I use to work on this project with, my home PC, work PC, and work Mac (for building to devices). The project has an SVN repository that two other programmers use so I can't commit broken code to it. The lead doesn't know how to use version control so the trunk contains art assets and everything else in addition to the project itself, making branching impractical (and I wouldn't want to use svn for branching anyway). I would use GIT if I could but it is not an option. My question is, how can I go to work, update my working copy, work on it a bit, send it to my mac for building, then go home and work on it some more later- keeping in mind that I may go 1-2 days without being able to commit working code to the repository?


Can I say that ASP.NET is compiled?

You know that C# is a compiled language. But when we develop web applications we use ASP.NET + C#, in this case can we say that ASP.NET is compiled? If ASP.NET is not compiled does it affect the performance of C# when ASP.NET and C# works beside each other to develop web applications?


How do I create a simple yet complex business layer?

I'm working with a fairly complex web application. It's split up into the following layers:   * Presentation - HTML   * Service layer - A REST and SOAP API communicating with the business layer   * Business layer - Contains the business logic.   * Data access - Provides access to the storage (SQL etc) The business layers contains classes encapsulating specific areas, such as customer registration, user management and more. The problem we are seeing is that the business layer is starting to get a bit messy. We have a single class handling customer management but as this area of the application grows more and more complex, the class grows and grows and become messy. For example, we may have the following classes   * class CustomerManager     * void CreateCustomer(...)     * void DeleteCustomer(...)   * class UserManager     * void CreateUser(..)     * void DeleteUser(...)      * void ActivateUser(...)     * void InactivateUser(...)     * void ResetPassword(...)  Creating a customer involves creating users as well. So CustomerManager calls misc methods in the UserManager class. As the application has evolved, creating a new customer means roughly 10 different things needs to be done except for registring the customer in the database, such as informing sales, audit logging, configuring default user accounts, creating a default configuration for the customer, notifying end-users of their auto-generated passwords and more. So CustomerManager.CreateCustomer grows to ~100 lines of fairly hairy code. I'm trying to think of a good way to handle this but am assuming that there's some common good way to do this which I'm simply not aware of. I've considered creating "Task"/"Command" classes implementing small sub- processes and then let the CustomerCreation.CreateCustomer simply execute a set of tasks. I would have more classes but they would each do less things. I've also considering implementing some kind of global application-level event/plug-in systems where CustomerManager.CreateCustomer just creates the customer in the database and then publishes an event that the customer is created. Plug-ins/something can then subscribe to these events and do stuff such as informing sales and logging the fact. Using this method, I wouldn't have to actually update CustomerManager.CreateCustomer when I want to do more stuff which is something which feels attractive to me. What obvious design pattern am I missing?


How to edit the HTML of an ASP.net site?

Assume that I'm a front-end developer (HTML, CSS) And some one who got their website built using ASP.NET came to me and asked for a new design and I don't know about ASP.NET. Then, how can I change the design of their website without affecting their code? Do I have to learn a little bit of server side languages to be able to change to the look of sites without affecting the original server code?


what will be the Output of the following code written in " C"?

#include<stdio.h>     void main()     {     char ***p="hello";     printf("%c",++*p++);     }      I haven't understand the concept of (*) indirection uses here **three times**.               When i compiled this program then the output was "j".     But actually hear the p is a pointer to pointer to pointer to Array of character.      Then why i getting the output as j.      I didn't understand what's the logic behind this.      please help me to understand the actual logic behind this. and the confusion increase more when I only use one indirection and get complied the program .then the output is i.means               void main()     {       char *p="hello";       printf("%c",++*p++);     }      **this gives output as i.** What is the difference between these two program?


What is the best way to have security auditing done?

I have an authentication system(ASP.Net library) that I want to make sure is secure. What companies/resources can I use to make sure of this? Also, what should I make sure to do before sending it off to be "broken"? A bit more background: Basically, I'm wanting to make a little bit of money by selling this system, but I don't have a whole lot to invest in it(USD $100-$200). I'm wanting to make sure I'm selling something secure, and that buyers know it's secure. I personally have looked over the code multiple times just staring trying to find a security flaw and cannot find one. This is of course not to say there isn't one. This is where I want to pay someone to come in and look at my code and how it all works and basically tell me if it's secure or not


What limitations does the JVM impose on tail-call optimization

Clojure does not perform tail call optimization on its own: when you have a tail recursive function and you want to have it optimized, you have to use the special form `recur`. Similarly, if you have two mutually recursive functions, you can optimize them only by using `trampoline`. The Scala compiler is able to perform TCO for a recursive function, but not for two mutually recursive functions. Whenever I have read about these limitations, they were always ascribed to some limitation intrinsic to the JVM model. I know pretty much nothing about compilers, but this puzzles me a bit. Let me take the example from `Programming Scala`. Here the function               def approximate(guess: Double): Double =       if (isGoodEnough(guess)) guess       else approximate(improve(guess))      is translated into               0: aload_0     1: astore_3     2: aload_0     3: dload_1     4: invokevirtual #24; //Method isGoodEnough:(D)Z     7: ifeq     10: dload_1     11: dreturn     12: aload_0     13: dload_1     14: invokevirtual #27; //Method improve:(D)D     17: dstore_1     18: goto 2      So, at the bytecode level, one just needs `goto`. In this case, in fact, the hard work is done by the compiler. > What facility of the underlying virtual machine would allow the compiler to > handle TCO more easily? As a side note, I would not expect actual machines to be much smarter than the JVM. Still, many languages that compile to native code, such as Haskell, do not seem to have issues with optimizing tail calls (well, Haskell can have sometimes due to laziness, but that is another issue).


What should a programmer know about IIS and various protocols (tcp, http, etc.) when developing web apps and services, etc.?

Often one of the biggest problem areas for me when developing software (win and web) is some of the more (seemingly) abstract areas like tcp/ip, deploying to IIS and the various configurations, etc. This especially pops up when I am deploying a web app to IIS. What should I know about this so that I can troubleshoot problems, and develop services and apps that leverage an actual understanding of these areas? Also, WHERE can I learn this??


In Agile development, who owns the software "features" and how to you manage the development?

Some development teams in my company are switching to Agile development practices and their developers' work seem to be diminishing to discuss and program minutia about trivial software features because of two week iteration cycles. And also because of "any developer can fix any bug" mentality. I have recently joined one of those team, transferring from another team in the same company... I feel strongly that developers should own their software features from start (design) to finish (implementation and unit testing). Agile seems to be going counter to this thinking. Is there any truth to my perception or am I just living a bad implementation of Agile? During our two week iterations, people somewhat arbitrarily get assigned new little features and bug fixes, depending on their workload during that cycle. Nobody seems to be owning responsibility of major features of the software. We spend stupid amount of times on trivial things, like adding a _single_ button to a dialog during a two week iteration, complete with a story, daily scrums, code review, etc. So in Agile projects, how does one manage larger features? Who own the responsibility: individual developers or the whole team? How does one extract him/herself from minutia and focus on longer term goals? Any feedback would be valuable.


Tool helping with estimations

I am looking for a tool supporting me with estimations. What I would like to do is to specify a higher level task and break it into several smaller tasks. When a task is small enough, I could assign the time it takes to finish it. The sum of these quantifiers should show up in the parent tasks. One could use Project for this, but IMHO this is some kind of overkill ... Also nice would be if you could do this like mindmapping so that a parant node sums up all of its childs estimations. Is something like this out there?


Which Open Source License is right for my project?

I'm developing a suite of software tools that I need help with which is why I want to release my software open-source. People should be able to use and modify my code as they please while contributing to my project. Ultimately, the tools that I develop will require a paid commercial license, but may be free to those for non-commercial purposes. This software suite will consist mostly of website plug-ins. Other tools I develop open source be used for consulting. What would you suggest as a license?


How do people maintain their test suite?

In particular, I'm curious about the following aspects:   1. How do you know that your test cases are wrong (or out-of-date) and needed to be repaired (or discarded)? I mean, even if a test case became invalid, it might still pass and remain silent, which could let you falsely believe that your software works okay. So how do you realize such problems of your test suite?   2. How do you know that your test suite is no longer sufficient and that new test cases should be added? I guess this has something to do with the requirement changes, but is there any systematic approach to check the adequacy of test suite?


Entity Framework as a type checking/verification system for database code

When I read pro and con lists of using Entity Framework (or any modern ORM really), I'm surprised that the following point doesn't arise (self quote): > Using strongly-typed domain entities allows for type checking at compile- > time which essentially performs a verification of all your database > operations. This is something that is not possible with ADO.NET (whether > using inline SQL or stored procedures). For me, this is one of the biggest advantages of using an ORM. An issue that I come across regularly when dealing with ADO.NET based applications are the run-time errors from SQL. Static checking completely eliminates this. Could anyone elaborate as to why this isn't hugely relevant to many developers? It appears that some don't even agree with the above statement. **Example of some pro & con resources:**   * Entity Framework VS LINQ to SQL VS ADO.NET with stored procedures? (stackoverflow)   * Five Reasons for using an ORM Tool   * Why use the Entity Framework? Yeah, why exactly?


What's a good way for a program to process an email mailbox?

Let's have a program that checks an email mailbox and then "processes" the messages contained there. (For this question it doesn't really matter what it actually does with the message). The program will run once per hour and can easily handle the volume of new messages and there is no penalty for processing a message twice. Let's say it will be using the IMAP protocol and can perform any of the standard functions that an email application can do. What mechanism would you recommend for processing the email?   * **Mark as read** \- the program marks a message as read after processing it.   * **Unmodified mailbox** \- the program doesn't modify the mailbox at all.   * **Something else** \- some other method I haven't thought of yet. Suggestions welcome.


Can we provide a login functionality in multiple language?

My username is krunal. And If i type my name in any language like Gujarati(કૃણાલ), Hindi(कृनल) or English(krunal) in username textbox than it should allowed me to login without any specific language selection. I just want to know the views of other people regarding this functionality. Is it a good to provide a login functionality like this ?


Pairwise testing, not possible to say which combinations is faulty?

Let's say I have 4 (A,B,C,D) parameters with 3 possible values, also 81 unique combinations. With e.g. orthogonal array, I will end up with 9 test cases, each combining 3 pairs. But that means that if one test case fails, I do not know which combination in the test case is faulty, right? Whether values of A,B or A,C or BC. Just wanted to be sure I understood it well. edit: Corrected (thanks GlenH7).


To refund or not to refund this client?

I'd really appreciate your advice on an ongoing project. I presented my client with a proposal and design samples which he approved, and he paid in full instead of the 50% upfront deposit as I'd given him a generous discount. He was then slow in furnishing me with some of the content, but once we did, he expected the website to be finished immediately which was not possible. Because he needed it done urgently, we agreed to try to get it done about 10 working days after the content was provided, but the developer who was helping me let me down. The next week, I completed the website myself and uploaded it to the server on a Friday afternoon. He then calls and texts me on following Sunday while I'm at church to say it's not online (there was probably a problem with his browser). The next morning, I received an email from him demanding a full refund within two days because he couldn't see the website (even though it was live, and I tested it on multiple browsers, a different computer and my phone), and he called me shouting at me because he couldn't access it. Finally when he was able to access it, he was unhappy with a certain detail regarding the slideshow which I began fixing and which was done the next day. He then referred me to another website and said he wanted it to look similar but not identical to it in terms of the layout. He also now wanted to add more features which were not in the original design. I got a designer to work on a new design which I sent to him for review, which if approved would be completed by 15 October, and he approved it last Thursday. He then called me yesterday to say that he wanted to change the design - he only approved it out of impatience. He now wants the website to be more similar to the other website he referred me to and he wants it done before the 15th! Then, he says to me that other people have done websites for him in three days - website's he's complained to me about for lacking dimension because they were just premium themes, whereas we'd designed and coded from scratch. I'm thinking of finishing the website but refunding him in full (or at least the refundable 50%) less domain registration and other non-refundable amounts, just to avoid further escalation of this matter and having him call me next week and say he wants to change it again. These are the applicable terms and conditions as laid out in the agreement: >   1. Total amount due for this project is Amount A. >   2. Client shall pay Consultant a deposit of Amount B (50% of total amount > due for project) in advance before any work commences on the Project. >   3. The balance is due within 7 working days of completion of project. >   4. Deposit is non-refundable. >   5. Should client opt to host elsewhere, applicable transferral fee of > Amount C will apply. >   6. Estimated project completion time frame is 14 to 30 days from the date > Client furnishes Consultant with Brief and all other required media and > data, provided that Client has made payment to secure the project. >   7. Consultant will make every effort to meet agreed upon due dates. The > Client should be aware that failure to submit required information or > materials, or last minute changes and excessive changes may cause subsequent > delays. Client delays could result in significant delays in delivery of > finished work. >   8. Major changes in client input or direction or brief will be charged at > normal rates. >   9. Any work the Client wishes Consultant to create, which is not specified > in the attached Proposal will be considered an additional service. >   10. Client agrees to pay Consultant for any additional expenses or > additional services not included in the attached quotation and proposal if > requested by the Client. >   11. Web design credit in the name of the Consultant, and link to > Consultant’s website shall be placed on the footer of the final Website. >   12. Either party may terminate this Agreement by giving 7 days written > notice to the other of such termination. >   13. In the event that Work is postponed or terminated at the request of > the Client, Consultant shall have the right to bill pro rata at full rates > for work completed through the date of that request, while reserving all > rights under this Agreement. >   14. If additional payment is due, this shall be payable within seven days > of the Client's written notification to stop work. In the event of > termination, the Client shall also pay any expenses incurred by Consultant > and the Consultant shall own all rights to the Work. > Advice please?


I am creating an internal application for the company I am contracted to. We wish to use a GPLv2 licensed library in this application. Some points   1. The application is to be used within the confines of the company and never be available for public use. It is for internal company use only.   2. **It will never be sold, ever!!**. So no money will be made directly from selling the code. It's not a product.   3. There are two forms of usage of the application      * Its native form which is console based exe (which uses the GPL library); and      * Usage via a web interface which calls the executable.   4. The source code will remain closed source (company use only), and be propriety  I have gone through numerous questions on SO about this (one closed as off- topic and another unmarked from Programmers ), but I have had a hard time in understanding whether my interpretation of the licence is correct. Based on my understanding thus far, I am permitted to use this library without any concern. I am not modifying the source code nor am I distributing the application or making the application publicly available. **The application will not be sold nor will it be distributed to anyone outside the company** (It will however be available at our company's offsite DR facility). I am very likely to use the released versions binaries and not re-compile from source. The following question from the GNU FAQ seems to support my thoughts. **Does the GPL require that source code of modified versions be posted to the public?** > The GPL does not require you to release your modified version, or any part > of it. You are free to make modifications and use them privately, without > ever releasing them. **_This applies to organizations (including companies), > too; an organization can make a modified version and use it internally > without ever releasing it outside the organization._** > > But if you release the modified version to the public in some way, the GPL > requires you to make the modified source code available to the program's > users, under the GPL. > > Thus, the GPL gives permission to release the modified program in certain > ways, and not in other ways; but the decision of whether to release it is up > to you. Can any GPLv2 licensed library be used in a company's internal intranet application?


What are the signs that a ten days debugging session will not resolve an issue?

Ten days ago, we fixed a bug on a large application and the hot fix has created a disappearing of some data from the user point of view ( _side effect_ ). Data are not deleted, but have been set to _hidden_ status. It could be possible to get the data back, but the thing seems to be hard: we've already spent 10 days to understand and reproduce the problem (mostly with SQL queries but sometimes it is necessary to _update_ the database to test the application logic). My questions are :   * is 10 days a normal amount of time for these kind of problems?   * should we keep on and retrieve the data or should we give up this work (so the customer-relationship person will tell these users _sorry for the loss, but your data have disappeared_ or maybe tell nothing at all)?   * what can be the signs that shows that **we should stop to search for how to solve this issue**? Edit about the context : we are a small team(3), users are not the customers, and lost data are not about the users money, bank or vital data. This is a question from a confused developer about _development methodologies_ and _business concerns_ , not about how we should deal with the customers.


Is working on a large project a good or a bad thing in the long run?

In a large project you only get to use the technology necessary for that project; smaller projects come and go, and you need to learn more technologies. On the other hand large projects are usually complex and thus hard; if you are used to hard projects then you should manage to perform well on smaller projects. So, in the long term is it better to work on small or on large projects?


Desktop GUI Client - Remote RDBMS communication

Sorry if I am asking a trivial question but I have been searching for a while without any luck. I need to design a system and I am looking for advice on the technology that should be used. The layout is very simple: it is a sales application with a centralized database and multiple clients. Each salesperson has GUI app installed on his/her laptop that should be able to connect to the database to retrieve data and upload data (i.e. register new orders). My question is the following: how should the communication between the client and the server be implemented? I doubt that connecting directly to the RDBMS is a good idea... Should I use web-services? XML-RPC? How to implement authentication and encode the data? Thanks for your advice!


Cerification Guidance

I am a fresher working in a MNC. I just want to do one .net Certification either in .net 3.5 or .net 4.0 which one'd be good for me to start certification. Please anybody suggest me with exam code and please tell me the good resourses for preparation.


Haskell: Best tools to validate textual input?

In Haskell, there are a few different options to "parsing text". I know of Alex & Happy, Parsec and Attoparsec. Probably some others. I'd like to put together a library where the user can input pieces of a URL (scheme e.g. HTTP, hostname, username, port, path, query, etc.) I'd like to validate the pieces according to the ABNF specified in RFC 3986. In other words, I'd like to put together a set of functions such as:               validateScheme    :: String -> Bool     validateUsername  :: String -> Bool     validatePassword  :: String -> Bool     validateAuthority :: String -> Bool     validatePath      :: String -> Bool     validateQuery     :: String -> Bool      What is the most appropriate tool to use to write these functions? Alex's regexps is very concise, but it's a tokenizer and doesn't straightforwardly allow you to parse using specific rules, so it's not quite what I'm looking for, but perhaps it can be wrangled into doing this easily. I've written Parsec code that does some of the above, but it looks very different from the original ABNF and unnecessarily long. So, there must be an easier and/or more appropriate way. Recommendations?


Is there such thing like a "refactoring/maintainability group" role in software companies?

So, I work in a company that does embedded software development, other groups focus in the core development of different products' software and my department (which is in another geographical location) which is located at the factory has to deal with software development as well, but across all products, so that we can also fix things quicker when the lines go down due to software problems with the product. In other words, we are generalists while other groups specialize on each product. Thing is, it is kind of hard to get involved in core development when you are distributed geographically (well, I know it really isn't that hard, but there might be unintended cultural/political barriers when it comes to the discipline of collaborating remotely). So I figured that, since we are currently just putting fires out and somewhat being idle/sub-utilized (even though we are a new department, or maybe that is the reason), I thought that a good role for us could be detecting areas of opportunity of refactoring and rearchitecting code and all other implementations that might have to do with stewarding maintainability and modularity. Other groups aren't focused on this because they don't have the time and they have aggressive deadlines, which damage the quality of the code (eternal story of software projects) The thing is that I want my group/department to be recognized by management and other groups with this role officially, and I'm having trouble to come up with a good definition/identity of our group for this matter. So my question is: is this role something that already exists?, or am I the first one to make something like this up? **Edit** : What I mean is a group driving refactoring initiatives, not doing all the refactoring work themselves. Much like an open source community to an open source product, now that I think of it.


What is it called when you're developing a web application where every url has its own php file

What is it called when you aren't using an MVC framework and each URL has it's own file associated with it. I want to say it's model 0 or class 0 but I haven't been able to find anything useful via Google. :-)


Who is responsible for fixing failed SQL code reviews?

As a DBA, most SQL is submitted to my team for review. We do not have a SQL developer, so the code is frequently very, very inefficient. Our current process is:   1. SQL is submitted for review right before it goes to beta   2. Issues are pointed out but frequently not resolved because the application has already been written around it, and is scheduled to be deployed to beta the same week   3. If the DBA team identifies an issue, the developer response is "show me how to fix it, then" It should be noted that the DBA team has no requirements around any code, no context and no idea what 1000s of lines of a stored procedure is supposed to be doing. Is this a typical scenario? Who is responsible for fixing the code? Does your DBA typically re-write the stored procdedure for you?


Can a class be inside another class?

Here's an excerpt from "The C++ Programming Language"               template<classT> class List { // optimal     public:     class Link { /* ... */ };     List (); // initially empty     void put(T *); // put before current element     T* get(); // get current element     / / ...     };      Can we make a class inside another class ? How about other languages? For PHP see this question


Randomly Accessing Data Packets in a Compressed File

In my line of work I deal with very large files, hundreds of Gigabytes in size. The nature of the data in these files is such that compression would greatly reduce their size. The problem is, the records/data packets within the file must be individually accessible. Is there a way to apply some home-grown techniques to these records to individually compress them and, once compressed, place them in a data stream such that the byte offset locations of each compressed packet is still known? Would this kind of fragmentation of the packet data substantially affect the efficiency of the compression/decompression cycle? Are zip algorithms suitable for this, or are there better methods of compression that are designed specifically for this?


A combined if/switch statement syntax with exception handling for a C#-inspired language

It is sometimes necessary to try/catch exceptions inside the "if" condition, but not the body that follows. In C#, this is really rather cumbersome, requiring locals and code that isn't entirely obvious, at a glance, as to its operation. It is also sometimes necessary to write "switch" statements, which, unlike "if", have more than two possible outcomes, although in C# this requires the use of a fairly unpopular syntax. Here's an idea for combining these. ## Merging `switch` with `try/catch` First, we change the fundamental syntax of "switch" to be close to that fairly popular replacement, but without the extra curlies:               switch (condition)         case 1 { }         case 2 { }         default { }      Next, we make it possible to catch exceptions in the condition. Under the hood, this inserts an appropriate try/catch block only when at least one `catch` is present:               switch (condition)         catch FileNotFoundException e { } // use "e"         catch ArgumentException { }         catch { }         case 1 { }         case 2 { }         default { }      Now we make it easier to chain several such statements akin to if/else chaining, by moving "default" one level up, and renaming it to "else":               switch (condition1)         catch FileNotFoundException { }         case 1 { }         case 2 { }     else switch (condition2)         case "abc" { }         case "def" { }     else         { }      And so we have a `switch` merged with `try/catch`! ## Combining with 'if' Both `switch` and `if` now have `else` clauses, so why not allow you to mix them as you please:               if (bool-condition1)         { }     else if (bool-condition2)         { }     else switch (string-expr)         catch FileNotFoundException { }         case "thing" { }     else         { }      (thanks ach_l!) ## Further improvements Switching on a list or range of values has been proposed and can be easily incorporated:               switch (int-expression)         case 1 { }         case 2, 5 { }         case 10..50 { }     else switch (string-expression)         case "abc" { }         case "def" { }     else if (boolean-condition3)         { }     else         { }      In this case it could be really convenient to be able to reference the value in the condition clause. This can be easily incorporated by allowing one to declare a single variable in this clause the same way C#'s `using` allows:               switch (var z = int-expression)         case 2, 5 { return z == 2 ? "two" : "five"; }         case 10..50 { return (z * 10).ToString(); }      ## Benefits Among other benefits, one can now express a common error-handling scenario concisely, and yet not WTFy:               switch (bool-condition)         catch FileNotFoundException e { }         case true { }         case false { }      * * * Would this solve any real-life coding difficulties you have encountered? Are there any tweaks you would apply to this?


What is an effective git process for managing our central code library?

Quick background: we're a small web agency (3-6 developers at any one time) developing small to medium sized Symfony 1.4 sites. We've used git for a year now, but have previously used Subversion. For the past 6 months we've put a lot of development time into a central Symfony plugin that powers our custom CMS. This plugin includes a number of features, helpers, base classes etc. that we use to build custom functionality. This plugin is stored in git, but branches wildly as the plugin is used in various products and is pulled from/pushed to constantly. The repository is usually used as a submodule within a major project. The problems we're starting to see now are a large number of Merge conflicts and backwards incompatible changes brought into the repository by developers adding custom functionality in the context of their own project. I've read Vincent Driessen's excellent git branching model and successfully used it for projects in the past, but it doesn't seem to quite apply well to our particular situation; we have a number of projects concurrently using the same core plugin while developing new features for it. What we need is a strategy that provides the following:   * A methodology for developing major features within the code repository.   * A way of migrating those features into other projects.   * A way of versioning the core repository, and of tracking which version each major project uses.   * A plan for migrating bug fixes back to older versions.   * A cleaner history that's easier to see where changes have come from. Any suggestions or discussion would be greatly appreciated.