Should I swap from WCF to NserviceBus

We have a central server that sends and recieves messages from a number of PCs that are located on client networks in various locations. To facilitate this, currently I'm using WCF with TCPNetBindings, using duplex communication secured with certificates. Now, we have a number of issues with this - mainly that we are being asked to support "disconnected mode" (we need to be fault tolerant). From what I know, there is no simple way to do this using the WCF stack - we'd need to implement something and perhaps use msmq. I've been looking at NServiceBus lately, and from I can see it seems to fit the bill well - fault tolerance, messages can be sent over the internet via a simple http gateway, etc. I know it's well respected in the community, and I can see why from looking into it. So, my question is...Does employing NServiceBus sound like a sensible idea, or does anyone have any other suggestions / real world experience that relate to this? I guess I'm worried of introducing a new tech that I know relatively little about, and facing problems with things like securing it, setting everything up in a reliable way, gotchas along the way.. I'm also wary of "gold-plating" the architecture, and choosing something shiny that will end up bogging me down in implementation versus sticking with WCF and just making it work for me.. Thanks!


Effective and simple matching for 2 unequal small-scale point sets

I need to match two sets of 3D points, however the number of points in each set can be different. It seems that most algorithms are designed to align images and trimmed to work with hundreds of thousands of points. My case are 50 to 150 points in each of the two sets. So far I have acquainted myself with `Iterative Closest Point` and `Procrustes Matching` algorithms. Implementing `Procrustes algorithms` seems like a total overkill for this small quantity. `ICP` has many implementations, but I haven't found any readily implemented version accounting for the so-called "outliers" - points without a matching pair. Besides the implementation expense, algorithms like `Fractional` and `Sparse ICP` use some statistics information to cancel points that are considered outliers. For series with 50 to 150 points statistic measures are often biased or statistic significance criteria are not met. I know of `Assignment Problem` in linear optimization, but it is not suitable for cases with unequal sets of points. Are there other, small-scale algorithms that solve the problem of matching 2 point sets? I am looking for algorithm names, scientific papers or C++ implementations. I need some hints to know where to start my search.


Watson Encoding Information

IBM's Watson has alot of book information encoded into a 'database' that Watson searches in real time. Does anyone know how that information is coded? I mean no one could type in all of those rules.


Implicitly or explicitly sorted elements?

So, I've got the following problem: I have a number of ordered elements, ordered in the following way:   * Type 1: Must be the first element. (only one possible, always present)   * Type 2: Must be the second and following elements, if present.   * Type 3: Must be the ordered last. Stated a bit more succintly / pseudoregex: `12*3+` Now, when constructing these elements, I do so in a method, where it is easy to do something like:               public List<IElement> CreateElements(...)     {         var list = ...;         list.Add(new Type1());         list.AddRange(GetType2Elements());         list.AddRange(GetType3Elements());     }      However, there is no explicit semantic ordering - it's just a list, that I happen to construct in a certain way. A more explicit way is to have IElement implement IComparable, and then use an explicitly sorted list and returning that instead. That would carry the "sortedness" out of my construction method, and sort the entities irregardless how they are created. However, it is suddenly a bit less trivial, since atleast 3 different Compare methods must be implemented. What would you choose?


Too many seniors in one team?

Can having too many senior programmers in one team turn out to be a bad thing? Having like say, 4-5 senior programmers in a team of 6-7 people. What is the optimal number/ratio in these kind of situations? Can this lead to too much philosophy and arguments about ideas? Has anyone had such an experience, that can share it with me?


Configuration file that can be modified by user in C#

I want to create a configuration file (text file preferred) that can be modified by user. A windows service will read from that file and behave accordingly. Can you recommend a file format for this kind of process? What I have in my is a config file like the game config files, but could not imagine how to read from it. My question is very similar to INI files or Registry or personal files?, but my question is different because I need to consider user editing.


Could a programming language work as well without statements?

As programming in JavaScript, I've noticed everything that can be done with statements and blocks can be done with expressions alone. Can a programming language work fine with only expressions? And, if yes, why are statements used at all?


MVC helper functions business logic

I am creating some helper functions (mvc.net) for creating common controls that I need in almost every project such as alert boxes, dialogs etc. If these do not contain any business logic and it's just client side code (html, js) then it's ok. My problem arises when I need some business logic behind this helper. I want to create a 'rate my (web) application' control that will be visible every 3 days and the user may hide it for now, navigate to rate link or hide it for ever. To do this I need some sort of database access and a code that acts as business logic. Normally I would use a controller for this, with my DI and everything, but I don't know where to put this code now. This should be placed **in the helper function** or **in a controller** that responds objects instead of ActionResults?


How can I charge money for open source targeted at individuals?

Most questions like this only seem to apply for big pieces of software for companies with money. I'm developing a small application targeted at individuals. Informally speaking, I want to sell the application to users, but allow them to fix and modify it(but not redistribute). Practically and legally speaking, how would I do this?


QT-C++ vs Generic C++ and STL

Been brushing up on my C++ lately, on Ubuntu QQ. I love the Qt framework for everything, especially building GUI's. I became quite familiar with it when using PyQt over the last few years. When using PyQt, I had some issues that are now more pronounced when using C++ with Qt: **Qt has many extensions to C++ that are Qt specific** \- QString being just one common example, not to mention automated garbage collection. It is possible to write Qt applications using C++ without knowing much at all about C++ and the STL. I may have to hit the job market again soon and I'd like to be able to consider C++ positions - but I'm afraid binding myself too much to Qt will limit my abilities to work with generic C++, which were once quite formidable but are now long dormant and rusty. Should I avoid Qt? Would I be better off using WxWidgets or GTK++ for building GUI's? What's the best GUI framework to use that allows/requires the most use of generic C++ and the STL? How do I make myself most marketable as a C++ programmer when it comes to GUI frameworks, etc?


Best option to send image from javascript client to SQL server

From a client (browser), using javascript I want to send an image to sql server ( and store with user profile) (sql server), along with other data such as user id or name. Which option is better? Send image as img / jpg? Or convert it to base64 and send everything as json format?


PDF or ebook Java API documentation

Since I have a long train ride to and from work I was wondering if there is a version of the Java API documentation floating around that I could put on my Kindle. It would be nice on the rare occasion I get something in my head that I want to think about some more. I know I can browse the web through the Kindle but coverage is spotty and slow. I know that the API docs are not really designed for a sequential reading format but I'm curious to see if anyone else has thought about this and given it a shot. Note I am not reading the Java API to learn how to program Java but to review classes I plan to use. The differences between things like FileReader and FileInputStream are subtle and best gained from reviewing the API and not reading a chapter in a book that will tell me a lot of stuff I already know.


How to populate a private container for unit test?

I have a class that defines a private (well, `__container` to be exact since it is python) container. I am using the information within said container as part of the logic of what the class does and have the ability to add/delete the elements of said container. For unit tests, I need to populate this container with some data. That data depends on the test done and thus putting it all in setUp() would be impractical and bloated -- plus it could add unwanted side effects. Since the data is private, I can only add things via the public interface of the object. This runs code that need not be run during a unit test and in some cases is just a copy and paste from another test. Currently, I am mocking the whole container but somehow it does not feel that elegant a solution. Due to Python mocking frame work (mock), this requires the container to be public -- so I can use `patch.dict()`. I would rather keep that data private. **What pattern can one use to still populate the containers without excercising the public method so I have data to test with?** Is there a way to do this with mock's `patch.dict()` that I missed?


How is this "interface"-like structure/pattern called?

Let's assume we have an `XmlDoc` class that contains basic functionality for dealing with an XML data structure and saving/loading data to/from a file. Now we have several subclasses, `A`, `B` and `C`. They all inherit from `XmlDoc` and add component-specific methods for setting and getting lots of data. They are like "interfaces" but also add an implementation for the signatures. Finally, we have an `ABCDoc` class that joins all the "interfaces" via virtual multiple inheritence and adds some `ABCDoc`-specific stuff, such as using `XMLDoc`-methods to set an appropriate doc type. We may also have an `ADoc` class for only saving `A` data. How is this pattern called? "Interface" is not really the right word since interfaces usually do not contain an implementation. Bonus points for C++ code conventions.


how do you manage application performance reviews

I have been trying to figure out ways to effectively do performance reviews before an install happens for all releases done by our team. Do you usually make this a part of code review process or do you handle it as a separate review task? FYI - we do not have a dedicated performance testing team. It is up to the developers to make sure the app performs well. The apps I am referring to are web applications.


Beginning a sentence with a function name?

Occasionally while typing something up that relates to a case-sensitive programming language I end up starting a sentence with a function name. Now the rules of English state that the first word in a sentence needs to be capitalized; the function name is lowercase, though. If you are wondering what could I be saying that would result in the first word being a function name, take this example: > Your fread implementation is broken. fread needs to return how many bytes > were read. I understand that I could change the second instance of _fread_ to _It_ but I want to know the best way of handling this other than just rewriting the sentence. Should I capitalize the function name? The only way I would like to hear "rewrite the sentence" as an answer is if starting the sentence with a function name violates some English rule that I am not aware of. Edit: I really thank everyone for these answers. They have changed and improved my insight into the issue. I have learned quite a bit from this. I am very surprised that I did not think of these simple but good solutions. I do think my stance on alternating the sentence was too tough and now I realize due to these good answers that overall altering the sentence appears to be the best option for dealing with these cases be it adding parenthesis after the function or saying The function before the function name and if available using formatting for the function name.


How should a web API handle misspelled/extra parameters?

**Question:** For a public facing web API(send HTTP Get/Post requests, get JSON/XML data back), how should parameters be handled that are either misspelled or are extra. It seems to me that if the incorrect parameters are ignored, an error in the caller's code may go unnoticed since they would be getting back a valid result. This may be especially true in situations where it wouldn't be obvious by looking at the results returned. **I am referring to optional parameters only.** Obviously if a required parameter is misspelled, then the parameter will be considered missing and an error will be returned.    **As an example** , the Place Search API call has four required parameters(location,radius,sensor and key) and several optional parameters(types is one of them). I can run these commands(with an API key) and get back valid results:               curl "https://maps.googleapis.com/maps/api/place/search/json?location=45.47554,-122.794189&radius=500&sensor=false&key=<api_key>&type=bakery"          curl "https://maps.googleapis.com/maps/api/place/search/json?location=45.47554,-122.794189&radius=500&sensor=false&key=<api_key>&types=bakery"      The first command has the "types" parameter in the singular form which is an invalid key name. The API ignores that parameter and returns all types of entities. In this case the error is obvious, but there may be times(and other API calls) where it won't be.


How to become certified in Objective C?

> **Possible Duplicate:**   >  iOS Programming Certifications I am interested in Objective C certification or any certificate than can support me as an iOS developer, what do you recommend?


Implementing Rules-type logic without a rules engine (like Drools)?

I have a system that must output decisions and alerts based on input read from a messaging queue. This system will hold state about all objects in memory and update this state based on input from the messaging queue. Logic must be applied to data flowing into the system and as the data updates the system's working memory. Example: > I have 50 quad-rotor drones that report their current state to a RabbitMQ > queue. This includes a (latitude,longitude) location property, a 'time left > on battery' property, and an integer battery charge percentage property. The > rules run on each drone message would look like:               if (drone.charge_left < time_to_home_from(drone.location)) {       drone.state = EMERGENCY; // land immediately       send_alert("Drone must be recovered!"); // put an alert on another messaging queue     } else if (drone.charge_percentage < some_threshold) {       drone.state = RETURN_HOME;       send_alert("Drone is coming back for recharging");     }          ... and so on      Drools seems like a decent candidate for this task but only because few rules engines seem to be still under development, and it has the biggest name so to speak. On the flip side, the architecture of Drools seems heavyweight and outdated. I've seen a lot of use cases in the financial domain, which is fairly far from my use case. I'm leaning towards using a graph db based solution (ex. Neo4j), where each of the rules is a node containing an MVEL predicate and some type of Alert that is sent out when the rule's predicate evaluates true. How would you architect a system like this in 2014? EDIT: I forgot to add that only the engineering team would ever look at or modify these rules, but it would be desirable for values like `some_threshold` to be tunable by non-technical teammates through some web interface.


Is there a canonical book on Scala?

I'm interested in learning Scala, but due to is relative newness, I can't seem to find a whole lot of books about it. Is there a book out there that's the de-facto standard for describing best practices, design methodologies, and other helpful information on Scala? What makes that book special?


Recent graduate with an idea, but I need some starting out advice

As the title says, I am a recent graduate with a mathematics degree, looking to develop software as a career. The job hunting has not resulted in a job yet but over the past couple of months I have picked up quite a bit of Ruby/Rails and Objective-C, as well as learning git and deployed a simple web-app to Heroku. I want to continue to build my resume and feel making a simple app and contributing to open source projects would look really good. Which leads me to my idea: My girlfriend is a botanist with the California Native Plant Society, and they just put together this really cool rare plant database. So I'd like make a simple iPhone app which would allow the user to query that database. Eventually it would be neat to do other stuff, but just getting a prototype together that would allow lookup via scientific names of different plant species is my first goal. I'm looking for any advice or resources as I'm not even sure what to google. I'm not sure if my app is physically filling in the text fields or if there is some other way to query an Internet database which I am unfamiliar. CNPS is a pretty great not-for-profit and it would be neat to give back to them in some way. I plan to host this on github as well if anyone else is interested. Thanks


Developing a platform or mass-scale application - where does it all start?

I notice that a ton of platforms are developed nowadays. I have always wondered where it all begins - What choices has to be made, reasons why certain platforms are chosen, why certain places choose to use Open Source, or Microsoft products. I am at the stage of my .NET Development career where I would like to write something big, and make a platform out of it utilizing many different technologies to comprise a single solution. This question is probably double sided too. **Where does platform development start?** **What needs to be researched and known by the developer before he embraces the challenge of writing a mass-scale application** **Is it a good idea to involve communities in the project, even if you plan not to fully use open-source technologies?** These are just a couple of questions which boggles my mind. I am a young developer seeking to improve my skill in developing, creating and building applications. Not always fun when millionaires depend on me for my hard work where I can use my own work to make ends meet more comfortably. Thanks


What's so bad about pointers in C++?

To continue the discussion in Why are pointers not recommended when coding with C++ Suppose you have a class that encapsulates objects which need some initialisation to be valid - like a network socket.               // Blah manages some data and transmits it over a socket     class socket; // forward declaration, so nice weak linkage.                class blah     {       ... stuff        TcpSocket *socket;     }          ~blah {        // TcpSocket dtor handles disconnect        delete socket; // or better, wrap it in a smart pointer     }      The ctor ensures that `socket` is marked NULL, then later in the code when I have the information to initialise the object.               // initialising blah     if ( !socket ) {        // I know socket hasn't been created/connected        // create it in a known initialised state and handle any errors         // RAII is a good thing !         socket = new TcpSocket(ip,port);     }          // and when i actually need to use it     if (socket) {        // if socket exists then it must be connected and valid      }      This seems better than having the socket on the stack, having it created in some 'pending' state at program start and then having to continually check some isOK() or isConnected() function before every use.   Additionally if TcpSocket ctor throws an exception it's a lot easier to handle at the point a Tcp connection is made rather than at program start. Obviously the socket is just an example, but I'm having a hard time thinking of when an encapsulated object with any sort of internal state shouldn't be created and initialised with `new`.


how to approach pharmacy software project

I would like to complete a pharmacy software proof concept. But I have a few questions I do not know. **Physician information** In order to refill or dispense a new RX the software needs to have access to a database of current doctors, is there a downloadable database or a service I can interact with to get a list of current practicing doctors ? **Medication information** needs to access a database of medications, which I believe companies like Medispan offer for a price. How much does interacting with these kinds of companies cost. **Billing** How can I interface be it with an insurance company, medicare, medicaid, etc for billing ? I have seen these programs are able to submit orders and get a response automatically for how much was billed and how much was paid etc. **What I have done** I started to just work on basic windows form application which would be the client and then I imagine I would have to connect it to my server in order to perform authentication etc before I billed for them from the server. Are the client applications connecting with the APIs directly or just an intermediary web service which in turn does all the work ? I also found one open source project http://www.anshealth.com/ but it seems like its pretty complicated to setup and there isn't much documentation. There hasn't been a post in their forums since last year. **Edit** I edited my question in order to make it more specific, I have asked specifically three questions.


Single page app permissions represented through RESTful APIs

I'm trying to figure out the right way to handle permissions in a single page app that talks directly to several RESTful APIs, that implement HATEOAS. As an example: "As a user of my application I can view, start and pause jobs but not stop them." The underlying rest API has the following resource:               /jobs/{id}       Which accepts GET and PUT. The GET returns a job model and the PUT accepts a job model as a _request body_ in the form:               {      "_links" : {          "self" : "/jobs/12345678"      }      "id" : 12345678,      "description" : "foo job",      "state" : "STOPPED"     }      Accepted job states can be: dormant | running | paused | stopped. The requirement says that on the UI I must have the buttons: START, PAUSE, STOP ... and only display based on the logged in user's permissions. From the API perspective everything works as the underlying logic on the server makes sure that the user cannot update the state to a STOPPED state when a request is made (a 401 is returned maybe). What is the best way to inform the app / UI of the user's permissions, so it can hide any buttons that the user has no permission to action? **Should the API provide a list of permissions, maybe something like :**               {      "_links" : {          "self" : "/permissions",          "jobs" : "/jobs"      }      "permissions" : {           "job" : ["UPDATE", "DELETE"],           "job-updates" : ["START", "PAUSE"]        }     }      **OR should the API change so that the permissions are reflected in the HATEOS links maybe something like :**               {      "_links" : {          "self" : "/jobs/12345678",          "start" : "/jobs/12345678/state?to=RUNNING",           "pause" : "/jobs/12345678/state?to=PAUSED",       }      "id" : 12345678,      "description" : "foo job",      "state" : "DORMANT"     }      **Or should it be done in a completely different way?**


Parameterized tests - When and why do you use them?

Recently at work we've been having some differences of opinion with regard to Parameterized testing. Normally we use a TDD-style (or at least try to) so I understand the benefits of that approac. However, I'm struggling to see the gain parameterized tests bring. For reference, we work on a service and it's libraries which are exposed via a RESTful interface. What I've seen so far is tests that are, at least using JUnit within Eclipse:   * Lacking in detail - when a test fails it's very hard to see the parameters which caused it to fail   * Often complicated to create   * Tend to be created after the code has been written - strictly not a drawback as such but do people set out with parameterized tests in mind when they start a piece of code? If anyone has any examples of where they are really useful or even any good hints for using them that would be fantastic. I want to make sure I'm not just being obstinate because I personally don't choose to use them and see whether they are something we should consider being part of our testing arsenal.


What does neo4j's licensing guide mean?

There are three versions of Neo4j apparently, called Community, Advanced, and Enterprise. Neo4j's Licensing Guide says that Community is GPL3 (which I confirmed from the LICENSE file in the tarball) and the Advanced/Enterprise seems to be dual licensed under AGPL3 and a proprietary license. What exactly does statement of the guide mean?: > If you’re using Neo4j to build closed-source online applications that are > central to your business, then you’ll want to talk to us about commercial > licensing of Neo4j Advanced or Enterprise editions. What exactly is meant by a closed source application in the context of server software? Does writing software that merely talks to neo4j over RPC trigger the AGPL under Neo's interpretations? If so, that's vastly differently from how the 10gen treats MongoDB (AGPL). The above wouldn't be as confusing if it weren't for the following statement: > ... you’re free to use the Community edition of Neo4j Server under a GPL > license – which means you can use it anywhere you would use something like > MySQL. _Used in this way, only changes you make to the Neo4j software itself > should be open-sourced and shared with the community._ That last sentence is not required of GPL3 software modified for an organization but never distributed and only ever made available as a web application. In fact that's the exact reason AGPL3 was invented, to plug that gap. Further, the following statement makes no sense since a public domain project is a project without copyright: > We love open source development: so you are free to use all Neo4j components > for your open-source, public domain project under either the GPL (for > Community edition) or the AGPL (for Advanced and Enterprise).


Most Appropriate Authentication Type for MVC5 project

I am about to start a new ASP.NET MVC5 project and I am planning the authentication / authorization requirements at present. The client wants Windows authentication, to prevent their users having to remember another new password. The site is web facing, so the downside would be an ugly pop up box asking for their credentials when they are accessing it offsite. Worse yet, on mobile, this box would be a problem. The Active Directory Authentication options from out of the box are new to me, but after some reading appear to be more about controlling roles and authorization through your AD groups. I intend to keep all authorization concerns internal to the application. Ideally, users will have Window authentication but with a nice login page where they can select their domain from a dropdown box and enter their domain login credentials. From some reading I thought possibly ActiveDirectoryMembershipProvider is the answer. However with the new available options I want to be sure there is not other options before blindly taking this route.


How to choose parameter for Golomb coding?

I am trying to implement Golomb coding, but I don't understand how it's tuned to obtain optimal code. It is said that > Golomb coding uses a tunable parameter M to divide an input value into two > parts: q, the result of a division by M, and r, the remainder. The quotient > is sent in unary coding, followed by the remainder in truncated binary > encoding. I don't understand how should I choose the parameter _M_ \- I can't see how the explanation in Wikipedia relates to actual data. I believe it should be related to statistical moments, is that true? For example, if I have this example set:   {3,4,4,4,3,1,2,2,3,1,2,1,4,1,2,2,2,2,1,1,2,2,1}   I believe _M_ should be very small for this kind of data. I bet it's either 1 or 2. It's mean is ~2.2 and standard deviation is ~1.1. My intuition would tell me to choose 2. Another dataset here:   {2,7,11,19,6,2,6,13,11,1,5,2,19,7,6,9,6,7,2,4,5,12,3}   This time the mean is ~7.2 and standard deviation is ~5.0. Is 7 the right value in this case? And should I prefer Rice code (use 8 as it is a power of 2) if I get a value like 7? I understand that division will be easier if I use Rice coding, but are there any benefits in NOT using it? I mean - 3 bits will be used for remainder in either case, how could pure Golomb code be more optimal then? One more nuance - Golomb code is for nonnegative integers. If I have positive integers instead, should I save x-1 instead? It would change a lot for the first of the mentioned datasets.


Are Scrum and XP comparable things or are they used for different things? what is the main features of each of them? how do they overlap? I've been reading about both XP and Scrum over the past weeks and something is vague about them for me. Scrum does have a definitive official rulebook but for XP I'm not sure where to look.


Should validation messages contain punctuation?

When building an application should all validation messages have punctuation?


Visitor only applicable when using the Composite pattern?

For a long time I've tried to get my head wrapped around the visitor pattern, and somehow this thing keeps being rather fuzzy to me. I'm currently under the impression it is only useful to apply operations on objects that implement the Composite pattern. At least as far as PHP is concerned. Is that an accurate observation, or am I missing something? I'm in the process of reimplementing some functionality, and this includes computing a diff between two Entities. These Entities contain various value objects. Different derivatives in the type hierarchy of these Entities have different value objects. Originally the diff code was contained in the entities themselves, though this caused quite some clutter, so I'd rather move it out into dedicated service objects. The Visitor pattern sprung to mind, though I do not see how I can actually sanely apply it. Would all the value objects need to implement some EntityElement interface? That seems bad. Is this a case where the Visitor pattern indeed does not apply, or am I simply failing to see how it would be applied nicely here?


Using table-styled divs instead of tables

I was referred here from stackoverflow as my question was apparently too broad. I'm working on a template, and I know using CSS is preferred over HTML tables for positioning... But, is it acceptable to get the best of both worlds and use table-like styles on my divs? For example:               display: table;      This not only helps solve the sticky footer problem, but it also avoids the pains associated with using floats. Somehow it feels dirty, but I can't logically explain why because it works without any "tricks" or ugly hacks, which is how it should be, right? Is this technically incorrect, or does it ultimately boil down to just a matter of opinion? ...Thoughts?


is there a term for doing this: func1(func2(), func3());

I know that `obj.func1().func2()` is called method chaining, but what is the technical term for:               func1(func2(), func3());      Where return of a function is used as an argument to another.


What is the philosophy/reasoning behind C#'s Pascal-casing method names?

I'm just starting to learn C#. Coming from a background in Java, C++ and Objective-C, I find C#'s Pascal-casing its method-names rather unique, and a tad difficult to get used to at first. What is the reasoning and philosophy behind this? I'm guessing it is because of C# properties. Unlike in Objective-C, where method names can be exactly the same as an instance variables, this is not the case with C#. I would guess one of the goals with properties (as it is with most of the languages that support it) is to make properties truly indistinguishable from variables and methods. So, one can have an "int x" in C#, and the corresponding property becomes X. To ensure that properties and methods are indistinguishable, all method names I'm guessing are also therefore expected to start with an uppercase letter. (This is just my hypothesis based on what I know of C# so far--I'm still learning). I'm very curious to know how this curious guideline came into being (given that it's not something one sees in most other languages where method names are expected to start with a lowercase letter) (EDIT: By Pascal-casing, I mean PascalCase (which is basically camelCase but starting with a capital letter). Method names typically start with a lowercase letter in most languages)


Best way to deal with Floors and Ceiling when using substitution method to solve Recurrences

I'm currently using substitution method to solve recurrences. The problem I'm having is dealing with T(n) that have either ceilings or floors. For example in the following example see example here. They end up using the guess: `T(n) ≧ c(n+2) lg(n+2)` My first guess was `T(n) ≧ n lg(n)`, which turns out to not work but my problem is I end up having to play around with guess to try get one to work. So questions are as follows:   1. What is the best way to deal with these floors and ceiling in general?   2. With regards to guesses, does this come with practice or are there betters ways of deducing the correct guess off the first shot without having to use Recursion Trees. (PS not sure how to write equations in math notation, its my first time using this forum)


Strategies to troubleshoot an error that only happens on a specific device

As an Android developer, the target market I create apps for is very fragmented. While I can specify certain requirements - e.g. my app only supports Android version x.x or above, sometimes errors may occur that are only evident on one specific phone model. **Are there any strategies to handle device-specific errors, without buying the phone in question?** We maintain a suite of phones for testing, but can't afford to go out and buy a new phone when 2 or 3 users report that there's a bug that only occurs for their model of phone. I'm sure other Android developers have encountered similar issues in the past, and I'm curious what cost-effective strategies are available to help squish device-specific bugs. **Update to add a few details:**   * I use Bugsense to capture bug reports, so whenever exceptions are thrown I will know the model of the phone, the stack trace, the number of times it has happened to my users, and a few other details.    * The users may be located in different countries, so I can't assume I'll ever be able to borrow their phone. **Imagine a scenario like this:** 100 users have installed the app, but three people complained that a button doesn't work properly when pressed. None of the models of phone I have for testing experience the problem. There doesn't appear to be an emulator for the problem phone model.


Javascript business model

Does anyone know anything about slidedeck's business model (see link below)? These guys are a javascript component that they sell online. As the tech savvy know - It's very difficult to sell javascript online, because it's pretty much like selling source code. But check out: http://www.slidedeck.com/pricing-b/ These guys give away a "GPL Branded" branded version of their code and then sell two premium "unbranded" versions that allow licensing of servers. They have some impressive clients. I'm just about done with a project of my own that is similar. I was just going to open source it and then use that source to create a demo to go and find financing for a bigger server side project (with a more clear cut monetization strategy), but seeing this made me take pause. I'm thinking - could I monetize the client source in the short run and raise less money? This seems like an option - but it also raises lots of questions: 1) If slidedeck's code is "GPL Branded" - how do they enforce that it's branded? Couldn't I just remove the branding, release my update to the community? (That would be a crappy thing to do, but would it be illegal or against GPL?) 2) While it's quiet obviously - the right thing to do - Outside of premium support models what are the main drivers for companies to license this code outside of the honor system? 3) Given Slidedeck is GPL what protections do they have from flat out plaugerism and people coying their code and selling it for less? Are there legal measures that can be taken to prevent this? How could they enforce this? Copyright perhaps?


AVL Tree Balancing Problem

Take the following tree:                         50                              40            30          20        10       Which node will be balanced first? 50 or 30 **Case 1: 50**   The tree is                            30               20    40            10          50      **Case 2: 30**   The tree is                             40                 /   \               20     50            10    30       Well, both are AVL Trees, so are both correct?


Is COM truly dead?

I have previously worked on COM, however I have observed for quite sometime that hardly any company asks for COM exp. Is COM dead or reports of its demise are highly exaggerated?


C/C++: Who uses the logical operator macros from iso646.h and why?

There has been some debate at work about using the merits of using the alternative spellings for C/C++ logical operators in `iso646.h`:               and        &&     and_eq     &=     bitand     &     bitor      |     compl      ~     not        !     not_eq     !=     or         ||     or_eq      |=     xor        ^     xor_eq     ^=      According to Wikipedia, these macros facilitate typing logical operators in international (non-US English?) and non-QWERTY keyboards. All of our development team is in the same office in Orlando, FL, USA and from what I have seen we all use the US English QWERTY keyboard layout; even Dvorak provides all the necessary characters. Supporters of using the `iso646.h` macros claim we should them because they are part of the C and C++ standards. I think this argument is moot since digraphs and trigraphs are also part of these standards and they are not even supported by default in many compilers. My rationale for opposing these macros in our team is that we do not need them since:   * Everybody on our team uses the US English QWERTY keyboard layout;   * C and C++ programming books from the US barely mention `iso646.h`, if at all; and   * new developers may not be familiar with `iso646.h` (this is expected if they are from the US). /rant Finally, to my set of questions:   * Does anyone in this site use the `iso646.h` logical operator macros? Why?   * What is your opinion about using the `iso646.h` logical operator macros in code written and maintained on US English QWERTY keyboards?   * Is my _digraph and trigraph_ analogy a valid argument against using `iso646.h` with US English QWERTY keyboard layouts? EDIT: I missed two similar questions in StackOverflow:   * Is anybody using the named boolean operators?   * Which C++ logical operators do you use: and, or, not and the ilk or C style operators? why?


How do you cope with ugly code that you wrote?

So your client asks you to write some code, so you do. He then changes the specs on you, as expected, and you diligently implement his new features like a good little lad. Except... the new features kind of conflict with the old features, so now your code is a mess. You _really_ want to go back and fix it, but he keeps requesting new things and every time you finish cleaning something, it winds up a mess again. What do you do? Stop being an OCD maniac and just accept that your code is going to wind up a mess no matter what you do, and just keep tacking on features to this monstrosity? Save the cleaning for version 2?


Parallel programming against a database: managing locks and transactions

I have first experience of parallel programming of code which actively works with relational database. I find it interesting to combine .NET parallel programming primitives with database locks/transactions and I'm interested in articles on this topic. Could you please advice some (.NET is optional)?


How do you stay in touch with a programming language?

I'll be starting work for the first time in the IT Industry on the 18th of this month. I'll be working mostly with Microsoft technologies such as C#.NET and MS Dynamic CRM. I spent the last year working with C++. Developing small applications to automate taks and organize my notes. During this time I have developed a good basic understanding of the language. My question is how do you guys stay in touch with a programming language that you love when you need to use something else at the office?


0.00006103515625 GB of RAM. Is .NET MicroFramework part of Windows CE?

The .NET MicroFramework claims to work on 64K RAM and has list of compatible targets vendors. At the same time, same vendors who ship hardware and create Board Support Packages (vendors like Adeneo) keep releasing something named Windows 7 CE BSP for the same hardware targets. Obviously the OS as heavy as WinCE needs more than 64K RAM. So, somehow .NET MicroFramework is relevant to WinCE, but how ? **Is it part of bigger OS or is it base of it, or are both mutually exclusive ?** Background: 0.00006103515625 GByte of RAM is same as 64Kbyte of RAM. I am looking for possiblity to use Microsoft development tools for small target like BeagleBone. http://www.adeneo-embedded.com/About-Us/News/Release-of-TI-BeagleBone Nice. Now .. where is a MicroFramework for the same beaglebone ? Is it inside the released pile ?


Issues Tracker for both developers and end users

currently, we have a closed source project on hand. However, we would like to have a communication channel together with our end users.   * We would like to have our end users to know, what features we are currently working on, and what features they are going to get in next release.   * We would like to know users' thought, on our planned features. They may always provide input/suggestion on our planned features.   * We do not planned to host on our own server. Hence, a ready-available service is welcomed.   * **But we would like to remain our source code in closed model** Is there any web based service available for this purpose? Free or commercial doesn't matter.


How can I write a set of functions that can be invoked from (almost) any programming language?

I'd like to find a way to write an API that can be accessed from any other programming language via language bindings (or some other framework). Is it possible to do this? If so, which programming language would be the most suitable for writing a "cross-language" API? My goal is to create a single set of functions that I can access from any programming language that I'm working with, so that I won't need to manually re-write the entire API in each language.


Any programming language can be mastered easily if the fundamentals of programming are strong. A fact or a myth?

Is it true that a person with fairly good fundamentals in programming can easily learn any programming language? Well, when I say programming languages, I refer to the agile and dynamic languages like PHP, Perl, Ruby, etc but not the former programming languages of the distant past. I've worked only on java, groovy and flex to some extent. So considering the fact that I am an amateur programmer but a fast learner, on a rough basis, how long would it take to get a foothold on any one of such languages?


Is it unreasonable to write user documentation in the style of a technical book?

Tell me if this sounds familiar: > something something something... as seen in figure 1-1 on the next page... It's in practically every book I've ever read about programming. So when I was writing a small instructional booklet on how to use some in-house software, which had images of the screen that the user will be on at this certain step I wrote something like "The screen that pops up looks like the one shown in figure 1-1 below." But I'm thinking: I'm used to that style of writing, but if my target audience is the 'average person' are they going to be confused? So, more generally, are there any common practices in technical books that should be avoided when writing documentation for average people?


What tools do you use to manage requests from users?

I'm drowning in user emails and I'd like to implement a better way to manage all these requests I get and put them in a queue where those people on a team, as well as users, have access to them and can make common notes. I'm thinking about some sort of task management tool that would allow multiple tasks to be created under a project where emails, comments, ideas, etc. could be dropped/entered and easily accessible. I need something that all parties can be involved in - users, managers, team leaders, developers. I'm looking for a tool that can allow:   * Users to just drag/drop an email to submit a request for maintenance or enhancement.    * Developers to just see their queue and the weighted priority of each task/project.    * A team of developers to see what everyone is working on in real-time.    * Management to keep a a log of time spent on each task. I I am starting to look in more of a Agile/Scrum direction for solving this problem. I found list of scrum agile sofware project management open source tools. Since I am limited on time, has anyone used these? Which one should I test to see if it will meet my needs? TeamPulse is a good direction, but think it is a little too bloated. I need something simple for all parties.


How to prioritize tasks when you have multiple programming projects running in parallel?

Say you have 5 customers, you develop 2 or 3 different projects for each. Each project has Xi tasks. Each project takes from 2 to 10 man weeks. Given that there are few resources, it is desired to minimize the management overhead. Two questions in this scenario:   1. What tools would you use to prioritize the tasks and track their completion, while tending to minimize the overhead?    2. What criteria would you take into consideration to determine which task to assign to the next available resource given that the primary objective is to increase throughput (more projects finished per time unit, this objective conflicts with starting one project and finishing it and then moving on to the next)? Ideas, management techniques, algorithms are welcome


How to time the sprints in Scrum to allocate time for TDD?

We have sprints of 4 weeks duration. What I have been doing is 3 weeks dev time and 1 week of pure manual/automated testing, stabilization and shipment assurance testing. How to manage TDD within dev time? In my previous experience writing tests and getting 80% coverage requires round about 50% of the development time. Following the same we would get only 1 and a half week of development which is not enough. My actual problem is how to allocate time for TDD? I want to make TDD a mandatory but with these it becomes really difficult for me. Do you think this is correct approach we are using or are we missing something and alter our approach to Scrum?


Naming in Security Protocols: Alice, Bob and Eve

Among computer scientists and programmers, there's the common habit of naming people in the context of security protocols e.g. `Alice`, `Bob` or `Eve`. Descriptions of more elaborate attack vector sometimes refer to `Charlie` (as does this XKCD strip), but is there a convention for additional participants?


Making simple forms in web applications

How do you work with forms in your web applications? I am not talking about RESTful applications, I don't want to build heavy front-end using frameworks like Backbone. For example, I need to add "contact us" form. I need to check data which was filled by user and tell him that his data was sent. Requirements:   * I want to use AJAX.   * I want to validate form on back-end side and don't want to duplicate the same code on front-end side.  I have my own solution, but it doesn't satisfy me. I make an AJAX request with serialized data on form submit and get response. The next is checking "Content-type" header.   * **html** -> _It means that errors with filling form are exists and response html is form with error labels._ -> I will replace my form with response html.   * **json** and **response.error_code == 0** -> _It means that form was successfully submited._ -> I will show user notification about success.   * **json** and **response.error_code != 0** -> _Something was broken on back-end (like connection with database)._   * **other** \- I display the following message : > We have been notified and have started to work with that problem. Please, > try it later. The problem of that way is that I can't use it with forms that upload file. What is your practise? What libraries and principles do you use?


Design pattern and best practices

I am an iPhone developer. I am quite confident on developing iPhone application with some minimal feature. I would consider myself as a fair application developer but the code I write is not so much structured. I make very little use of MVC because I don't seem to find places to impose MVC. Most of the time, I create application with viewcontrollers and very few models only. How could I improve the skill for making my code more reusable, standard, easy and maintainable. I have seen few books on design patterns and tried few chapters myself but I don't seem to skip my habit. I know few of them but I am not being able to apply those patterns into my app. What is the best way to learn the design patterns and coding habit. Any kind of suggestion is warmly welcomed.


Why is String Templating Better Than String Concatenation from an Engineering Perspective?

I once read (I think it was in "Programming Pearls") that one should use templates instead of building the string through the use of concatenation. For example, consider the template below (using C# razor library)               <in a properties file>     Browser Capabilities     Type = @Model.Type     Name = @Model.Browser     Version = @Model.Version     Supports Frames = @Model.Frames     Supports Tables = @Model.Tables     Supports Cookies = @Model.Cookies     Supports VBScript = @Model.VBScript     Supports Java Applets = @Model.JavaApplets     Supports ActiveX Controls = @Model.ActiveXControls      and later, in a separate code file               private void Button1_Click(object sender, System.EventArgs e)     {         BrowserInfoTemplate = Properties.Resources.browserInfoTemplate; // see above         string browserInfo = RazorEngine.Razor.Parse(BrowserInfoTemplate, browser);         ...     }      From a software engineering perspective, how is this better than an equivalent string concatentation, like below:               private void Button1_Click(object sender, System.EventArgs e)     {         System.Web.HttpBrowserCapabilities browser = Request.Browser;         string s = "Browser Capabilities\n"             + "Type = "                    + browser.Type + "\n"             + "Name = "                    + browser.Browser + "\n"             + "Version = "                 + browser.Version + "\n"             + "Supports Frames = "         + browser.Frames + "\n"             + "Supports Tables = "         + browser.Tables + "\n"             + "Supports Cookies = "        + browser.Cookies + "\n"             + "Supports VBScript = "       + browser.VBScript + "\n"             + "Supports JavaScript = "     +                  browser.EcmaScriptVersion.ToString() + "\n"             + "Supports Java Applets = "   + browser.JavaApplets + "\n"             + "Supports ActiveX Controls = " + browser.ActiveXControls                    + "\n"         ...     }


How to solve linear recurrences involving two functions?

Actually I came across a question in Dynamic Programming where we need to find the number of ways to tile a 2 X N area with tiles of given dimensions.. Here is the problem statement Now after a bit of recurrence solving I came out with these.   F(n) = F(n-1) + F(n-2) + 2G(n-1), and   G(n) = G(n-1) + F(n-1) I know how to solve LR model where one function is there.For large N as is the case in the above problem we can do the matrix exponentiation and achieve O(k^3log(N)) time where k is the minimum number such that for all k>m F(n) does not depend on F(n-k). The method of solving linear recurrence with matrix exponentiation as it is given in that blog. Now for the LR involving two functions can anyone suggest an approach feasible enough for large N.


Liskov substitution principle with abstract parent class

Does Liskov substitution principle apply to inheritance hierarchies where the parent is an abstract class the same way if the parent is a concrete class? The Wikipedia page list several conditions that have to be met before a hierarchy is deemed to be correct. However, I have read in a blog post that one way to make things easier to conform to LSP is to use abstract parent instead of a concrete class. How does the choice of the parent type (abstract vs concrete) impacts the LSP? Is it better to have an abstract base class whenever possible?


Efficient way to find unique elements in a vector compared against multiple vectors

I am trying find the number of unique elements in a vector compared against multiple vectors using C++. The vectors are in sorted order and it can be of size 2,000,000. Suppose I have,               v1: 5, 8, 13, 16, 20     v2: 2, 4, 6, 8     v3: 20     v4: 1, 2, 3, 4, 5, 6, 7     v5: 1, 3, 5, 7, 11, 13, 15      The number of unique elements in v1 is 1 (i.e. number 16). I tried two approaches.   1. Added vectors v2,v3,v4 and v5 into a vector of vector. For each element in v1, checked if the element is present in any of the other vectors.   2. Combined all the vectors v2,v3,v4 and v5 using merge sort into a single vector and compared it against v1 to find the unique elements.  Note: sample_vector = v1 and all_vectors_merged contains v2,v3,v4,v5               //Method 1     unsigned int compute_unique_elements_1(vector<unsigned int> sample_vector,vector<vector<unsigned int> > all_vectors_merged)     {         unsigned int duplicate = 0;         for (unsigned int i = 0; i < sample_vector.size(); i++)         {             for (unsigned int j = 0; j < all_vectors_merged.size(); j++)             {                 if (std::find(all_vectors_merged.at(j).begin(), all_vectors_merged.at(j).end(), sample_vector.at(i)) != all_vectors_merged.at(j).end())                 {                     duplicate++;                 }             }         }         return sample_vector.size()-duplicate;     }          // Method 2     unsigned int compute_unique_elements_2(vector<unsigned int> sample_vector, vector<unsigned int> all_vectors_merged)     {         unsigned int unique = 0;         unsigned int i = 0, j = 0;         while (i < sample_vector.size() && j < all_vectors_merged.size())         {             if (sample_vector.at(i) > all_vectors_merged.at(j))             {                 j++;             }             else if (sample_vector.at(i) < all_vectors_merged.at(j))             {                 i++;                 unique ++;             }             else             {                 i++;                 j++;             }         }         if (i < sample_vector.size())         {             unique += sample_vector.size() - i;         }         return unique;     }      Of these two techniques, I see that Method 2 gives faster results. 1) Method 1: Is there a more efficient way to find the elements than running std::find on all the vectors for all the elements in v1. 2) Method 2: Extra overhead in comparing vectors v2,v3,v4,v5 and sorting them. How can I do this in a better way? [edit] Vectors are in sorted order.


From Slashdot: Does being a loyal developer pay?

I saw this question posted on Slashdot and thought it would make a great question here on Programmers.SE. _It's not my question, nor my situation._ Here goes: > "As a senior developer for a small IT company based in the UK that is about > to release their flagship project, I know that if I were to leave the > company now, it would cause them some very big problems. I'm currently > training the other two 'junior' developers, trying to bring them up to speed > with our products. Unfortunately, they are still a long way from grasping > the technologies used – not to mention the 'interesting' job the outsourced > developers managed to make of the code. Usually, I would never have > considered leaving at such a crucial time; I've been at the company for > several years and consider many of my colleagues, including higher > management, to be friends. However, I have been approached by another > company that is much bigger, and they have offered me a pay rise of £7k to > do the same job, plus their office is practically outside my front door (as > opposed to my current 45 minute commute each way). This would make a massive > difference to my life. That said, I can't help but feel that to leave now > would be betraying my friends and colleagues. Some friends have told me that > I'm just being 'soft' – however I think I'm being loyal. Any advice?" What are your thoughts on this Anonymous Slashdotter's situation?


How do I package a J2SE app for sale to a market of buying customers?

Currently, I enjoy my Java 101 class. I have some ideas for apps that I'd like to make and with time and work I think the process of developing an application from the ground up will work out fine. When I get my Java app(s) up and running - will it be easy to find a place where I can offer them for sale? In the Enterprise labor marketplace, I see ads for developers with expertise with J2EE, WebSphere, Hibernate, Spring, etc. As a Java newbie, I'm aware that I can forget about ever qualifying for those jobs. An alternative for me might be to make something that I can build a micro- business with. Is there a straightforward way of doing that?


Is a MSDN subsciption worthwhile for personal use?

I code primarily in .net at work, but was wondering if home MSDN subscriptions were available/worthwhile as a tool to stay in touch with the latest technology for Microsoft development?


What is the impact of CSS Validation Failure?

I am developing a asp.net website. When I used the CSS property "word-wrap", VIsual Studio 2010 is showing a warning: Validation (CSS 2.1) 'word-wrap' is not a known CSS property name. When I tested the website, it is working fine. However, can there be any issue in using this property ignoring the warning?


How can I keep Web services requests in a DAO layer without tying the code to the DOM?

I'm working on a single page application on the node-webkit desktop app platform, which means 99.9% of all of the logic is written in JavaScript. Since this is a reboot of a project we're working on, I wanted to approach the architecture from more of an MVC approach on the client side. I'm planning on creating a DAO layer for access to localStorage, IndexedDB, as well as Web services via REST requests. The problem is, the first tool I reach for to make HTTPS requests to the server is jQuery AJAX. It feels a bit weird to use jQuery in the DAO layer, even though I don't plan to manipulate the DOM, but it works really well on node-webkit and is a tried and tested tool for retrieving and sending data to the servers. Despite the popularity of certain JavaScript application frameworks that have a certain _way_ of doing things, we're not planning on using any frameworks other than JavaScript libraries that are fairly lightweight and unobtrusive, such as jQuery, Underscore, Mustache, Node.js modules, but nothing that forces us to unequivocally exclude certain technologies. I'm planning to inject jQuery into the DAO layer for the purposes of making calls via AJAX to the Web services. My question is this:   * How should I approach Web services? Do I treat Web services as just another data source like the local database?    * Or do I just simply use the raw XMLHttpRequest object? What's the proven method for dealing with this architectural problem on the client side, **_without JavaScript frameworks_**?


Should we use any JS framework which makes HTML as scripting language

After studying HTML 5, I learnt that HTML is purely for defining semantics of data. And it has provided various tag for each purpose. Although we can create our own tags, can provide styling and it will work still we use standard tags because they are known at global level. And all search engines can understand them. JS frameworks like AngularJS provide the way of creating own directive/tags. Which are non-standard tags. Moreover, I believe that programming logic should be kept apart from HTML :ng- if, ng-repeat etc. It makes HTML page very difficult to understand by a pure UI designer. I would say these frameworks make a HTML page developer friendly not designer friendly. If we put all the logic on a HTML page, there would not be any difference between a server side page & a HTML page. I believe **there should not be any non-standard tag and no programming logic** (like conditional or looping statements) **presents on HTML page**. Instead JS should handle/control HTML from outside. Please tell me if I am incorrect somewhere. Or give me some positives views So I can think about using such frameworks.


Should we encapsulate everything in a try{} block in a Try object?

Why can't I make a class for a `Try` including what I try and then run that in the `try {}` block? Why is it impractical?               class DBConnectTry extends Try {           TryResponse response[] attempt(TryObject o[]...){          //try to connect to database       }         }      Then in a `try ... catch` I could invoke only the `DBConnectTry.attempt`. Would that improve readability / clarity / modularization or is it not a good idea?


What is the good way of sharing specific data between ViewModels

We have IAppContext which is injected into ViewModel.   This service contains shared data: global filters and other application wide properties. But there are cases when data is very specific. For example one VM implements Master and the second one - Details of selected tree item. Thus DetailsVm must know about the selected item and its changes. We can store this information either in IAppContext or inside each concerned VM. In both cases update notifications are sent via Messenger. I see pros and cons for any of the approaches and can not decide which one is better. **1st:**   \+ explicitly exposed shared proerties, easy to follow dependencies   \- IAppContxt becomes cluttered with very specific data. **2nd:**   the exact opposite of the first and more memory load due to data duplication. May be someone can offer design alternatives or tell that one of the variants is objectively superior to the other cause I miss something important?


DDD: Can immutable objects also be entities?

I've read countless posts on differences between Entities and Value objects and while I do think that at least conceptually I understand how the two differ, it appears that in some of these posts authors consider a particular domain concept to be a VO simply because it is immutable ( thus its state will never change, at least within that particular domain model ). Do you agree that if the state of an object will never change within particular domain model, then this object should never be an entity? Why?


C++ Using Intrinsics in a Cross-platform Manner

I have a cross platform math library that I am working on and I want to make sure that some common operations are performed in an optimized manner, so I wish to use some intrinsic functions wrapped in inline functions to compute things such as sqrt(float/double). I should mention that at this point I only plan on targeting a select few platforms which are mentioned in the source below. I have started a single prototype of the a sqrt() function but before I proceed any further I want to know if I am doing anything blatantly wrong. I am following the documentation at: http://msdn.microsoft.com/en- us/library/windows/desktop/ff471376%28v=vs.85%29.aspx   http://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html Also, you will note I have a blank line under the pound define for macintosh. I know the newer versions are using clang/llvm. How do you get access to intrinsic functions under the newer versions of mac os and its associated compilers?               #ifndef INTRINSICS_H_INCLUDED     #define INTRINSICS_H_INCLUDED          #if defined(_WIN32)     #elif defined(__gnu_linux__) || defined(__linux__)     #elif defined(__ANDROID__)     #elif defined(__CYGWIN__)     #elif defined(macintosh)     #else     #include <cmath>     #endif          #if defined(_WIN32)     #pragma function( sqrt )     #endif     template<typename T>     inline float sqrt(T &val)     {     #if defined(_WIN32)       return sqrt(val);     #elif defined(__gnu_linux__) || defined(__linux__)       return __builtin_sqrt(val);     #elif defined(__ANDROID__)       return __builtin_sqrt(val);     #elif defined(__CYGWIN__)       return __builtin_sqrt(val);     #elif defined(macintosh)       // How do I do this     #else       return std::sqrt(val);     #endif     }     #if defined(_WIN32)     #pragma function( sqrt )     #endif     #endif


What level of queries should I expect from an interviewer regarding my official software tasks?

_**Assumption:_**   Post that I am applying for: _Software developer_   Experience in years: _5_ _**Background:_** > I have been working with a robotics company and I am not a robotics person. > I haven't handled a "project" by myself yet. So, the kind of work that I > have handled so far are "small" C++ programming related stuffs in the > projects. > > _Tiny examples:_   >  1\. Someone has already made classes and written socket programming for > this software X with UDP. My job was to add the TCP code using Qt API.   >  2\. I had to add a "callback" functionality (using C++ templates) somewhere > in the project for some reason. > > _Another somewhat bigger example:_   >  I had to set up a functionality of message exchanging between two > components (according to a standard protocol) in C++. Both these example tasks are related to the proprietary software of this company. _**What kind of questions (in which depth) should I expect the interviewer to ask regarding these example tasks?_**


Should the analyst define the programmers and their seniority needed by the project?

It might be obvious, but I am not sure. Should the analyst who interview the client, gather and analyse requirements then give an estimate, also specifies how many and with how much experience developers should be required to develop it? Maybe I'am not so sure on how I go about this allocation thing, maybe this is just not my work.


Should I "Fight" to use development environment I want to use and how?

I am the only developer for some of projects. I used to pick environment I like, alike C# and C++. But this time new task could come from another department head who used to write programs ~20 years ago. That person reject all the new technologies alike .net and even C++ with no sane reason. Sure everything could be written in C and it could be fast and stable but forcing me (as only one developer) to write large scale-able project in plain C is not anyhow sane for me.   * Must developers aware of directions like that?   * Must developers fight to pick development environment? My current position is a bit weird. I don't like the situation and I say that I'm able to go and start project in C but I will not tell any development time only apparent minimum and I guess this time will not be anyhow acceptable. That could make me look as really bad developer.   * What will you suggest me in such situation?   * Have you experienced such situations?


How to convince team members of the existence of a "mandelbug"

We are developing an application; it includes a library developed by another coder, this library communicates with server via multiple network connections, and this involves multiple threads working together. The server side code is quite complicated, and we don't have access to the source code. Recently I've discovered a mandelbug making application crash sometimes. I could reproduce it once and got a stack trace, so I opened a bug report. The bug itself is easy to fix (uncaught web exception in one of background threads, that makes CLR terminate the program). The problem is that developer is refusing to fix the bug, because "he is not convinced it exists". Unfortunately for me the boss is siding with him and says this bug cannot be fixed unless I make a "solid test case" to prove existence of the bug, and to make unit test verifying that it's gone. What is basically impossible due to a nature of the bug. Any advice?


I don't really understand "Backend/Serverside" when it comes to web-development?

In the Web development world, what exactly do backend/server-side programmers do? I guess I don't really understand the whole concept. I've done the HTML/CSS layouts and website design and a little bit of SQL with PHP (still enhancing my skills, it's more of a side project for me). I've also done a small amount of JavaScript/JQuery. But I don't understand the "backend" work, such as the scripting languages (Rails/Python/etc) and such. What exactly do you "do" with them? Are there any books on the subject? I'm not even sure what it means. Is it kinda like what Web Application Frameworks do? Or not so much?


Is Model-View-Presenter (MVP) scheme useful for Android?

How to separate View and Presenter in Android, while the reactions on the user actions (Presenter part of MVP) are set into the same activities that shows GUI elements (View part of MVP). "In model view presenter just as Martin Fowler or Michael Feathers [2] say, the logic of the UI is separated into a class called presenter, that handles all the input from the user and that tells the "dumb" view what and when to display" (cited from here). Till now I thought that one of the main features of Android is the **_smart_** Activity that takes actions, reacts to them and shows the results. Is MVP scheme in contradiction with Android philosophy? Has it sense to try to realize it on Android? If yes, how could it be done?


Why is Java version 1.X referred to as Java X?

I saw that Java 1.2 is also known as Java 2. Do "Java 1.x" and "Java x" (for example "Java 1.6" and "Java 6") refer to the same version of Java? And if yes, why the need for this duality?


Does having to scroll horizontally make code less readable?

Well, does it? Is it considered bad practice? IMO, it is less readable. I hate having to scroll to the right, then back left, right, left, and so on. It makes coding more painful and confuses me sometimes. For example, anytime I am coding a long string, I will do the following...               bigLongSqlStatement = "select * from sometable st inner join anothertable at" +     "on st.id = at.id" +     "and so on..." +     "and so on..." +     "and so on..."


Simple approach to Rails

I recently got into web development through the PHP framework, CodeIgniter. I knew some PHP before I started learning that framework and overall I found it very easy to learn. The CodeIgniter documentation made it really easy to get started and figure out what each specific helper/library/function accomplished and how it was used. After making a somewhat basic CMS/Forum in the framework, I decided to start learning Rails and see which one I liked more. Needless to say, I've had a somewhat difficult time understanding Rails. I'm not sure if Rails just takes more time to learn, doesn't fit my way of thinking, or if I'm using the wrong book to learn. I've been working through http://ruby.railstutorial.org/ with little success. I understand many of the main points, but I feel as though I lack any real understanding. There seems to be a lot going on 'under the hood' with Rails compared to CodeIgniter. I tried looking at the Rails API for help, but didn't find much help there. I'm more or less looking for a book or reference sheet that clearly outlines what each specific line of code is doing or what's going on behind the scenes. Something similar to the CodeIgniter documentation or a book that has less words and more basic examples for each aspect of the framework. I've also tried reading through Why's poignant guide to Ruby, but that had far too much talking and not enough examples or clear documentation. I feel like it's the easiest for me to learn something when it's heavily tied to basic logic/math. In the end I believe that it will just end up being a combination of the Rails API and spending more time working with the framework; however, I'm hoping that someone learns the same way that I do and has a suggestion. Again, I'm very new to programming and haven't spent more than 40 or so hours working with PHP/Ruby combined, so I apologize if my question doesn't make sense or if it's just a matter of putting a lot more time into it. If Ruby doesn't seem like the right language for me, would Python be a better option? My plan was to build something basic with PHP/Python/Ruby and decide which I liked the best. **TLDR:** Trying to learn Rails in limited free time. Finding that it's taking a lot longer to learn than CodeIgniter. Not sure if I just haven't been able to find a book/reference sheet similar to the CI documentation. Looking for suggestions or advice. Thanks in advance for any advice or suggestions.


Pattern for a class that does only one thing

Let's say I have a procedure that _does stuff_ :               void doStuff(initalParams) {         ...     }      Now I discover that "doing stuff" is quite a compex operation. The procedure becomes large, I split it up into multiple smaller procedures and soon I realize that having some kind of _state_ would be useful while doing stuff, so that I need to pass less parameters between the small procedures. So, I factor it out into its own class:               class StuffDoer {         private someInternalState;              public Start(initalParams) {             ...         }              // some private helper procedures here         ...     }      And then I call it like this:               new StuffDoer().Start(initialParams);      or like this:               new StuffDoer(initialParams).Start();      And this is what feels wrong. When using the .NET or Java API, I always never call `new SomeApiClass().Start(...);`, which makes me suspect that I'm doing it wrong. Sure, I could make StuffDoer's constructor private and add a static helper method:               public static DoStuff(initalParams) {         new StuffDoer().Start(initialParams);     }      But then I'd have a class whose external interface consists of only one static method, which also feels weird. Hence my question: Is there a well-established pattern for this type of classes that   * have only one entry point and   * have no "externally recognizable" state, i.e., instance state is only required _during_ execution of that one entry point?


Is it correct to fix bugs without adding new features when releasing software for system testing?

This question is to experienced testers or test leads. This is a scenario from a software project: Say the dev team have completed the first iteration of 10 features and released it to system testing. The test team has created test cases for these 10 features and estimated 5 days for testing. The dev team of course cannot sit idle for 5 days and they start creating 10 new features for next iteration. During this time the test team found defects and raised some bugs. The bugs are prioritised and some of them have to be fixed before next iteration. The catch is that they would not accept the new release with any new features or changes to existing features until all those bugs fixed. The test team says that's how can we guarantee a stable release for testing if we also introduce new features along with the bug fix. They also cannot do regression tests of all their test cases each iteration. Apparently this is proper testing process according to ISQTB. This means the dev team has to create a branch of code solely for bug fixing and another branch where they continue development. There is more merging overhead specially with refactoring and architectural changes. Can you agree if this is a common testing principle. Is the test team's concern valid. Have you encountered this in practice in your project.


What's a good light-weight source repository for local development?

I'm doing some prototyping locally that I would like to keep in source control (for backup and revert purposes) but I don't necessarily want to publish it as open-source or make available online for others to view. What source control system would you recommend for local development? Any setup or walk through for my scenario is greatly appreciated. I'm looking for:   * Easy setup and administration. As this is my local machine, I'm constrained to Window OS and would really like to minimize the amount of environment configuration changes and necessary learning curve. There will only be one user, so I don't want to configure access rights, etc.   * Low resource overhead, I want to host locally on my developer machine, so I don't want it sucking up my CPU. I don't plan on storing massive amounts of data, either.   * Familiar. I've used SVN clients before. Visual Studio integration is a nice-to-have.   * Portable. If I have to move it to a external drive or to another machine.   * Free. Yes I want it all and don't want to have to pay for it.


Should `setX(Object o)` methods perform deep or shallow copies of objects?

My particular situation is related to Java, but I believe this is a more general OOP question than _just_ Java programming. **The Question:** Should "mutator" methods perform _deep_ or _shallow_ copies? **An example:**   Let's assume my object has the following structure:               public class MyObj {       ArrayList<Integer> myList;       //constructors, etc.            public void setMyList(ArrayList<Integer> list) {         this.myList = list; //Option 1         //OR         this.myList = new ArrayList<Integer>(list); //Option 2       }     }      My assumption is that Option 2 is best. This is because it prevents an external class from having direct access to `MyObj`'s list. For example, if I did:               public class SomeOtherClass {       public static void main(String[] args) {         ArrayList<Integer> exampleList = new ArrayList<>(Arrays.asList(1, 2, 3));              MyObj a = new MyObj();         a.setMyList(exampleList);              exampleList.add(4);       }     }      At the end of `main`, Option 1 means that `a.myList` contains `4`, while Option 2 means `a.myList` still consists of `1, 2, 3`. To me, the second seems preferable. Is there a standard/convention regarding this situation?


Is wrapping third-party API calls a design smell?

Five methods within my API call the same third-party method. In trying to abide by DRY, does it make sense to wrap this call in a private method?


I have this App idea, what technologies can I use/need to learn?

It's pretty straight forward: You have an object (let's say a car, or house, or clothes, or whatever), and all you want to do is to add different kind of textures to it (Let's say one can add 5-10 different types of textures to the object) The object will pretty much be static (in movement), and I'd like a pretty fast rendering time. The textures can be uploaded by the user, or picked from a DB. Sounds like a really easy project, but I'm very new to app programming. I've done some programming before, but mostly just Windows(C#,Java,Python) and microcontroller stuff(C). Where should I start? From similar products that I've seen, they seem to use everything from Asp.net to Flash for their solutions(these are websites, though).


What are the advantages and disadvantages of the various git modes available for emacs?

I just started using git, and because I tend to live in emacs, I want to use one of the emacs integration packages. Looking at this list, I see that there are a lot of packages available, but the blurbs for each of them don't explain very much about their capabilities, especially since I don't know git very well. Which git modes for emacs have you used, and what are the advantages and disadvantages of each?


Where can I test my Silverlight/WPF knowledge online?

Do you of know any sites where I can take a quiz on Silverlight/WPF that isn't Braindumps?


How to mix different styles of programming on several languages?

I know that Senior Developer doesn't use only one language and only one platform or IDE. Can you advise how to mix different styles of programming to make efficient code? For example, **best** mixing is **Perl + Objective-C**. `$ObjectiveCLongNameOfVariablesAndMethods` are worst for Perl-style, but good for iOS-team. `[self method:[[NSArray alloc] initWithobjects:[hash objectForKey:name]]]` style is weird for an eye, but not for perl simple-looking arrays and hashes and autovivification. Also, i try to mixing **SAS + Objective-C style** , but here i have a trouble. **SAS** doesn't support names long names, only 32 symbols. So, big trouble to naming variables. Another difficulty is features of current language. So, if I can't use current language for a task, that it can **solve 'like a BOSS'** , I become angry and see weird code. Using libraries is good, but it makes code not natural, 'cause eating soup with fork is strange'. And at the end: where can I trust compiler and interpreter of language? So, **C++-style** is best for pointers (you make destructors, constructors, etc.), but many languages now support mechanism like **ARC in Objective-C** or don't use pointers (like **C#** ).


Is code reviewing good practice?

When the company I work in hired new managers, they offered us to overview someone's code on every meeting. We have meetings every two weeks, so each time one of developers was to show his/her code on the projector, and others were going to discuss it. I thought this would be great: each developer would be more careful when writing code and we could share our experience better. But somehow we forgot about this and the offer just remained an offer. What are the benefits of this and are there any drawbacks?


What is the appropriate amount of guidance and mentorship a junior programmer should receive?

I'm a junior software developer, and just got this job working with a very small group of engineers. I've been coding for a few months in this group in a professional settings - before I just coded at school - and it's definitely been a learning experience. I feel like I'm taking a long time to learn - things like the design patterns, the different methods of different classes throughout the codebase - I make a lot of mistakes in my code and need to ask a lot of questions. I also think that I don't have the greatest mentorship and this is where I'm wondering if it's me being slow or I'm not in the best learning environment. Currently there's one lead engineer that reviews everyone's code and sends back feedback. In a code review, I will often get short comments such as "use XXX method here". Usually the XXX method is a method in our code base which I have never used or seen, on an object in our code base that I'm not familiar with. I'll have to ask for more clarification and extend the review process. In a case like this - is it entirely up to me to find this method and try to figure out what it does? I feel like these types of comments should have more explanation - why I should use that method and what I did wrong - but instead it's more along the lines of "do XXX". Of course I go and try and find the method, but most of the time I don't have enough experience and context to fully understand the issue. Another issue is that when I have questions and the lead engineer comes over, they tend to interrupt me, shush me (literally - they say "no, no, shhh shh" if I'm still explaining the question), take over my mouse and keyboard and just fix the issue after looking at it for a second. Usually my question will have the underlying reason for the problem I'm having (I misunderstood a concept), and if I can't express it and show the engineer where I have a wrong idea or concept then how will I be able to improve and learn? I feel like they're not correcting me and teaching me - they're just fixing the problem on my screen - but since I'm not learning, I tend to repeat it again. This is not helpful for me - I'd rather they sit with me and let **me** drive with the keyboard mouse, let me ask the question with my own words, and explain to me with words what I did wrong instead of just changing my code. Am I asking for too much? At the end of the day, I'm definitely learning and getting better, it's just been taking a long time. I'm frustrated with the lack of mentorship and guidance I have. I'm confused and feel that sometimes I'm expected to know everything that the lead engineer who's been building up this codebase on their own for the past 4 years knows. I feel like a burden when I do have questions. So, I'm wondering what is the right amount of help and guidance a junior engineer should have? Obviously I know how to use SO, I know how to search google. I'm talking about learning our code base, our patterns, and the way we do things for our product. Is my experience normal? Or am I building this all up in my head?


Do designer tools degrade the programming experience?

I've been looking around lately, specifically at some of the MS tools that are available, and I'm noticing a big focus on designer tools and wizards. Not just for UI development but for everything.   * Entity Framework has the modeller   * RIA Services has the DomainService wizard(s)   * Workflow has the whole workflow designer thingy... (I don't know, haven't really used it) There's more, but I think you get the idea. There's lots of designer tools. Using some of these I find that: **They complicate matters beyond the prescribed use cases** (ie all of the tech demo videos) I have been evaluating some of these technologies recently, and trying to work with them I end up having to dissect exactly what the designers, modellers and wizards are doing for me... otherwise I'm lost when I actually have to try to do something with whatever was created. This ends up being a case where I have to fight the tool, or fight its output enough such that I could have just done the whole thing myself without it - and had a _much_ stronger understanding of what's going on. I find this particularly infuriating with the silverlight designer and RIA services domain service wizard. I find myself asking "What good is this tool if I have to figure out its inner workings or re-write half of its output in order to use it?" **They're not as fast** The selling point of these tools is to increase productivity and this point may change over time using the tool, and doesn't necessarily apply to UI designers (though, in some cases it still does -> I'm looking at you silverlight designer). I find that I can hack some code much faster than I can drag-and-drop, resize, move, whatever in a designer. **The UI gets in the way of the model** Maybe this is just me, but when I am using anything reminiscent of a UML design tool I end up spending more time laying everything out so that my lines don't cross and so that I can see it all on the screen than modelling what I'm trying to achieve. **They're no fun** Half of the reason that I code for a living is that I enjoy it. Clicking checkboxes and selecting comboboxes and then fixing everything that comes out isn't fun. **I don't appear to be alone** The community seems to _not_ want these tools either. The best example I can think of at the moment is Entity Framework Code-First. So I ask:   1. Do designer tools _actually_ improve productivity?   2. Are they fun-killers?   3. Is 'the community' _actually_ asking for more designer tools, or are vendors just thinking we are?


How should I name the language data files?

Recently I decided to add some translations to my program. I wonder how I should name the language files?   1. in the culture's name of the language (example: english = en, french = fr, italian = it, etc...)   2. in the name of the language [in english] (example: english = english, french = french, italian = italian, etc..) I know you'll choose the second way because you dont have to detect which filename it is because both have the same name. But the problem is this - I show the name of the languages in its langauge (example: english = english, french = française, italian = italiano, etc..) so I still need to detect which filename it is. The main question is which way I should choose? the name of the language in english or the culture name? and why?... Thanks!


Evaluating a Programmer for Startup

I have sorted through the previous questions and couldn't find a specific answer to the following (and thank you in advance): I have fully developed my idea on paper and am looking to move forward with it, create it, and grow it. Since I am non-technical, I am looking to either partner or employ (I would pay for his/her services) for a very talented and well-rounded programmer to help create and develop the project. I am looking for someone that can act as a IT manager/CTO and get the job done while I use my resources to develop and deploy the strategy, deal with the business side of things, raise capital, grow, etc. However, due to my lack of IT knowledge, it is always hard for me to differentiate between a good and bad programmer and therefore only find out if he/she is good or not when it is too late. So my question that I have been asking everyone around me is "How do I assess whether the programmer is good or not if I cannot evaluate them myself?" and "Is there any website that reviews and rates programmers?" I have asked many to refer me to talented programmers but all are either not local (important for me to work side by side with them), happily employed or working on their own startup. I have also asked these programmers to help me find others but none seem to be able to help. Any help would be extremely appreciated. Thank you so much, HelpJ


What is the best way to handle different TimeZones?

I'm working on a web application where there will be many different users from all over the world making updates. I'm wondering what the best way to handle timezones would be? Ideally, as an event happens, all users view it using their local times. Should the server OS time be set to GMT, physical location time, or my development location time? Should the application logic (PHP) and database (MySQL) be set to store data as GMT or local time (local to users)? Is there an industry standard or even a simple/obvious solution that I'm just not seeing?


Can a loosely typed language be considered true object oriented?

Can a loosely typed programming language like PHP be really considered object oriented? I mean, the methods don't have returning types and method parameters has no declared type either. Doesn't class design require methods to have a return type? Don't methods signatures have specifically-typed parameters? How can OOP techniques help you code in PHP if you always have to check the types of parameters received because the language doesn't enforce types? Please, if I'm wrong, explain it to me. **When you design things using UML, then code classes in PHP with no return- typed methods and no-type parameters... Is the code really compliant with the UML design?** **You spend time designing your software architecture, then the compiler doesn't force the programmer to follow your design while coding, letting he/she assign any object variable to any other variable with no "type- mismatch" warning.**


Openfire licensing with custom code

I am thinking of integrating the openfire chat server with my custom website. Openfire server and the smack client library is licensed under Apache License, Version 2.0. If I decide to use openfire, will it require my website source code to be also made available under the Apache license? Tried going through the licensing terms, but the legal language is a bit confusing. Thanks in advance for any insights! Rohit.


Valid reason for employer to breach freelance contract

Please don't close this as offtopic. According to the FAQ I can post programming related questions. I was working on a project and when it was half way completed (1 weeks work), the employer backs out and refuses to pay me. Shortly before this he was being very rude. He was having problems configuring the server and he told me it was my fault and that I had to fix it. After I spent several hours trying to figure out the problem, it turned out to be his fault. After this when I put the code on the server. He found 1 bug that I had missed. He freaked out, accused me of being a bad programmer and told me that the code was shit and that he couldn't use it. He said that if there is a bug in the code, that means the code is bad and he can't use it. He would have to throw the code away and hire someone else. His kept reiterating his argument: "why should I pay for code that I can't use". And I kept telling him the code was fine and urged him to have another programmer give him a second opinion. But he would have none of that. He said he would compensate me for my troubles by paying me 250$. Then he changes his mind and lowers that to 200$. Then a third time he changes his mind and says he doesn't want to compensate me at all. I'm left frustrated because besides being rude, he did not at any time tell me he was unhappy with the work that I was doing. So my question is; Is the above a valid reason to back out of a verbal contract in your opinion?


Would you consider using training/mentoring from LearnersParadise.com?

My initial question deserves some explanation. I signed up for an account at learnersparadise.com. After signing up I couldn't login so I opted to use their "send password" feature. Upon receiving my password in my email I confirmed two things A) They trimmed off 2 of the last digits of my 10-digit password without informing me and saved it that way in their database B) my password is not saved in their database using a one-way hash since they were able to email me my password. I'm quite certain that both of these are perfectly awful programming practices. I suspect that the mentors/trainers at learnersparadise are not necessarily affiliated with the website and it's design since they are basically people like you and me (hopefully more skill than me) who have signed up to become mentors. However, I'm still uncertain about signing up for training/mentoring at a site that uses such poor programming practices themselves? Would you let learnersparadise poor programming practices affect your opinion of their trainers/mentors?


Passing the data of a certain page to another page. Windows Phone 7

The user will fill out information in page 1, and the data will be seen in the other page listed in a listbox. Is it advisable to use data binding? I've been studying/researching about data binding already for about 2 days and still couldn't understand it. Simple example would really help.


Sync / send data between front end and back end systems for an Ecommerce site

A client recently had a new backend .net stock management system developed that hooks into their EPOS and allows their stores to keep track of orders, products, customers, etc from a single central database that utilizes MS SQL Server 2003. The client hopes to use this as an opportunity to renew/re- develop their site to also utilize this centralized back end database. I have experience with e-commerce, but this is my first time developing a site that needs to work with the companies back end systems. I had been hoping to use an off the shelf platform such as Magento to make the development process smoother and allow for easy upgrades and the use of plugins/modules in the future. However, having looked at the schema for their new backend systems it is apparent that there could be several problems. Their database has a lot of design issues, the tables are badly normalized, and their approach to the database design seems dated to me. If I was to use an off the shelf platform like Magento, the only way I can see it working is to re-create all the products/categories/customers in the front end DB, this may have to be done manually because of the differences in schema between the backend (centralized db) and frontend(magento db). That would be a mamoth task, and would create a new problem of how to deal with the replication of data (products, stock levels, prices, orders, order statuses). The client currently manages all the products and order data on their .net system and wants to continue to do so, so there would need to be a way to update the sites db when they make changes to their back end systems (E.G in the case order has been shipped/canceled/etc). Like wise the centralized database would need to be updated from the front-end when a customer makes an order, updating stock levels, etc. These are just two examples of data that will need to be synchronized, but their are countless other scenarios. Does anyone have experience working with Magento or other platforms in situations similar to the above? How did you deal with data replication and sending data between the back end centralized db and Front end db? I am having a hard time wrapping my head around the best setup/architecture for a site like this, any pointers in the right direction would be really appreciated. In retrospect I can't help but feel the best solution would be to create an in-house platform from scratch that can directly connect to their centralized database instead of using an off the shelf platform and worrying about syncing data between backend/frontend. Any thoughts?