title: Is it acceptable to decompile someone else's code for the purpose of learning what they did, and how they did it?

text: I am not talking about stealing code, or reusing someone's for profit. But I am assuming that if a program or plugin is distributed in a format where I can't readily view the source, that is a deliberate action on the part of the programmer. Is it acceptable to look anyway, for the purpose of learning? And if so, are there limitations to that freedom?


title: What percentage of change is considered artistic license vs. a clone in video game development?

text: I'm a "weekend coder" developer making mobile apps and games and I've had the desire to make my own version of a game made for the Commodore 64 back in the early 80's by a small publisher e.g. Not EA Games or similar. The game hasn't been ported / released on any platform since. I want to make my version because it was fun to play but I can obviously create much better graphics now (the original had 8 colors at most, and requires a good imagination to transform a character image in the game into something with 4 limbs and a head). Since it will take effort to make from scratch, and the game will be different when done I'd like to charge 99 cents to users... But I have fears of being sued should the original developer pop out of the woodwork from somewhere. Here's a breakdown of original vs. My game intentions. Original game was a 2D side view game (think original Mario bros) with 3 screens that flipped when you crossed the edge. You could collect items, there were AI players that "chased" you, ladders, and some ride-able objects... All within a specific theme. My version would also be a 2D sideview, but be a sidescroller with at least 3 but maybe 4 or 5 "screens" worth of content. Images would be all original, have a nice 3D look to them, full color, shadows and lighting effects. You would still collect items but they would be all different, and you'd still get chased etc. but I'd try as best as possible to make my game unique... and of course it would have a different name. To a video game enthusiast that played this game in the early 80's they'd be able to proclaim..."oh man this game reminds me of **___ _**!" I don't think they would declare it to be a "ripoff" or "just a clone" though. Are there documented cases where a developer has been sued successfully for copying another game?.. And if so just how close was it? Likewise is there a statute of limitations?... This game is pushing 30 years old... Or is the answer just build it and see?


title: Queues and threading

text: I am developing a new project where I will be constantly checking a webpage for data and adding this data to a queue for processing. This data will then be removed from the queue and added to a list if it hasn't already been added. This list will then be stored in the database. I was wondering about how to use threads as I am relatively new to programming? I think it would be ideal if I had a thread constantly checking the webpage for data, a thread processing the queue and a thread for processing the list. Any suggestions on whether this method is the most effective or not and how to achieve this would be much appreciated.


title: Comparing strings against a pool of words

text: I am creating an app where the user enters 8 characters. After he enters the string I have to see if it is an eight letter word. If not, check if contains a seven letter word etc. I am checking against a given pool of 150k+ words. I only care about the longest possible match. Is there a better way then this one:   * WordPool.Contains(word.substring(0,8))   * WordPool.Contains(word.substring(0,7)),    WordPool.Contains(word.substirng(1,7))   * WordPool.Contains(word.substring(0,6)),    WordPool.Contains(word.substirng(1,6)),   WordPool.Contains(word.substirng(2,6))   * etc... _Edit_ I forgot to add that I am checking against an english dictionary. So far I am using this:               for(i = 8; i >= 3; i--)       for(j = 0; j <= 8 - i; j++)           if(words.contains(word.substring(j, i))              //do something      **Edit 2** I have been using the approach defined above just with a minor change. I am using a few background agents which all search for a word of a certain length. They all then return a result and I just pick the one which gives the user the highest score.


title: Should I reuse variables?

text: Should I reuse variables? I know that many best practice say you should not do it, however later when different developer is debugging the code and have 3 variables that look a like and only difference is that they are created in different places in the code he might be confused. unit-testing is a great example of this. However I do know that best practice are most of the time against it. For example they say not to "overide" method parameters. Best practice are even are against nulling the previous variables (in Java there is Sonar that has warning when you assign null to variable that you don't need to do it to call garbage collector since Java6. you cant always control what warnings are turned off, most of the time the default is on)


title: Is it OK to use same variable to store similar stuff sequentially?

text: Say I have a variable name `len` in a function and several strings. Can I use this to store length of those strings one after the other or should I create separate variables? Basically this:               size_t len;     len = string1.size()     ....//some code     len = string2.size()     ...//more code      versus               size_t str1len, str2len;     str1len = string1.size()     ....//some code     str2len = string2.size()     ...//more code      All are local variables within a function BTW.


title: Topics that should  be learned before graduating with a CS Degree

text: Feeling slightly underwhelmed with the content in my degree path of Computer Science at my University, I have been attempting to learn on my own. I am looking for direction into topics that will be helpful to know when going into the working world. As a senior I've learned basics of data abstraction, and basics of C++, vb.net, and php.


title: Real world analogy for a clustered index

text: A db index is analogous to a table of contents. This helps me understand db index in an easy way. My question is are tehre any real world analogies for a clustered index?


title: Apache License 2.0 and source code recompile

text: I am not a licenses expert so I got confused a bit... The license Apache 2.0; Does it allow to get source codes and modify them for new projects? I mean modify source codes (some its parts) and recompile them?


title: Is it wrong to push messages from server to client in a client-server application?

text: I practically never see any web application where server pushes messages to the client. While pushing messages from server to client is hugely used in multiplayer games, why this model is so underused in web apps? Is it wrong? Does it destroy the client-server model?


title: Can testers peer review the developers' design and code?

text: I am a junior developer for a small business using scrum / agile development. A long-term goal of ours is to be appraised at CMMI lvl 2. We have a team of 3 senior developers who implement user stories and a handful of junior developers for support. We are moving towards a "three amigos" methodology, especially in regard to separating the duties of development and testing (the third amigo being the product owner / business stakeholders). This way our senior developers can focus on implementation and our junior developers can focus as impartial testers. We are using peer reviews as a specific practice for verifying work products, such as source code. This paper, http://repository.cmu.edu/cgi/viewcontent.cgi?article=1208&context=sei, describes on p. 19 that an optimal peer review process for design and code ranges from 50-65% of the time spent designing and coding. **My question is this** : is it appropriate for our testers to peer review the developers' design and code? An advantage would be that the developers can spend more time implementing user stories. A disadvantage would be that the testers may sacrifice their objective/impartial view of the system, since peer reviewing creates a shared ownership of the code.


title: Is it valid to initialize an instance of a class within the same class?

text: I was wondering if it's valid to initialize an instance of a class within the same class? For example:               public class Person()     {         string name;        string age;        public Person getPerson()        {             Person p1=new Person();            //some logic here            return p1         }     }      I ended up doing that for a part of my code at work and thus wanted to know if there are any potential problems with doing something like this.


title: When defining Product Backlog items, is it s a bad idea to describe what will be part of the user experience?

text: First, I am using the TFS 2010 SCRUM template. I am wondering if this is a bad idea... I started defining a PBI for User Interface Elements. Basically, this will hold all the tasks that developers will be assigned when developing UI elements for a web application. Since this has to do with user interaction and usability I was thinking it may be OK, however my struggle is that it also can be considered functionality and may not fit as a PBI.


title: What is the best way to estimate when using Agile with Scrum? Hours or Story Points?

text: I was at a company that switched us over from Hours to Story Points for our estimations. I remember it being difficult to understand it, and we all chaffed against the idea. However, once we figured out how to do it and started doing it, I think our estimations became much more accurate. We were much better able to complete our sprints on time and to better be able to estimate duration of remaining work. Once a couple weeks had passed, we had a good idea of our individual teams’ velocities and could then translate the story points into days and weeks of work. We then used that to know what we could complete within a given time-span. I guess the same could work if estimating in hours, as long as it is understood that each team will have a different number of hours per week in their velocity. One team may do 200 hours, while another may do 150 hours on average. This doesn't mean one team is working any harder than the other, it just means that they estimate hours differently, or that some team members may not have as much time available to work on the project, for instance, they may always be pulled into bug fixes, or help on other projects, which reduces their available time for this project. Anyway, what do you think? And why? Which is best? Hours, or Story Points?


title: Searching in a repository

text: I'm very new to source control management and one thing puzzles me: is it possible to search through the whole repository for a string? For example I'm tracking one file, which has 100 commits and I would like to see all the version of the file which contain "xyz" inside. Is this possible? I'm using various GUI clients and non of them has this..? Yes, they can search trough commit messages but I want to find a version even when the commit message does not contain the string. To put it differently, which GUI client has such a feature? I don't care about which SCM it uses - git, hg, bazaar, all are fine.


title: Should I use branches for example uses of a github repo?

text: I'm working on a Github repo called Designemplate at https://github.com/benwatkinsart/Designemplate and was thinking of developing some example uses of the CSS file to show how it's used. Should I use a branch called examples and store them there?


title: Do you have to have boxing of primitives in OO language?

text: Is boxing of primitives required in OO languages to keep them consistent with the rest of the object system (generics etc.)? Or is it avoidable - is it possible to avoid any additional performance cost of having both primitives and objects in a language? One solution I can come up on the spot is having references big enough to store values of every possible primitive type. Are there other (better) solutions and are there implemented in popular languages?


title: Unit testable code: method visibility vs test complexity

text: I can't decide how to refactor code right. Let's say I have a complex hypothetical logic piece:               public class ImageService     {          public void UploadImage(VectorData data) {              var image = ConvertVectorDataToImage();              var thumbnail = CreateThumbnail(image);              SaveThumbnail(thumbnail);              SaveImage(image);              SendEmail(image);              ...          }     }      _(If something in example is out of single responsibility, let's pretend, that I could make up a better example)_ If I make UploadImage visible (public), then writing tests become complicated. They tend to be long, hard to read and if you would like to avoid code duplication, then logic in tests appears. If I make all those small pieces visible, the API becomes messy (because in my example, the only interesting thing to everyone is UploadImage method). Even worse, after some time people will tend to use those small methods, because they are public, not because they should be used outside the class. So my question is, how do you balance between visibility and test complexity? Or am I doing something wrong in first place?


title: Is 'Aurora' a good release paradigm?

text: As we all know, there is 'alpha', and 'beta' release status. Mozilla Firefox, however, labels its releases differently: 'nightly', 'aurora', 'beta'. Is this an example to follow? Is aurora the new alpha? Does it create confusion, since it is basically public beta testing with a cool name and cool icon?


title: The best way to open source my website

text: I'm creating a website where trust is a big issue, I want to prove by making it open source I actually do what I claim. Question 1. If I make my source code open, how can I prove the actual website runs on this code? But I also have a dilemma, it is a commercial project and I don't want others to run off with it and claim it theirs. So I think I need a correct license. Question 2. What license is best for me? Currently I'm thinking about GPL v3.


title: Are object oriented programming languages procedural?

text: Procedural programming means coding the application is a series of tasks. Do A, then do B, then Do C. And often wrap these tasks in procedures or functions that can be easily called and run several times in the code. Object Oriented Programming is also often done by doing A, then doing B, then doing C. But objects are used (and correct me if I'm wrong because I'm not sure) as sophisticated ways to store, manipulate and hide data. This affects significantly the design of the program. But the overall flow of the application is still do A, then do B, then do C. Do you agree? If so, would you say that OOP is essentially a type of Procedural Programming?


title: Validating best practices, property vs dto, simple type vs object

text: Consider a user profile page. User can add many emails to his/her profile (something like GitHub's profile page). So, theoretically, user hits the plus button, then enters an email address, and clicks the save button. Now we have some dispute in our team over how to validate this email address. Some developers (including me) believe that we should validate this simple string via an extension method:               bool isValid = newEmail.IsEmail();      They argue that any validation mechanism other than a single method call would be overhead, and an anti-pattern (against KISS principal). While others argue that this email should first be added to a new instance of `UserEmail` DTO, then that DTO should be passed to a the relevant validator:               UserEmail userEmail = new UserEmail() { Email = newEmail };     bool isValid = new UserEmailValidator().Validate(userEmail);      The second group argues that validating a single property makes no sense, because a property can't exist on its own. Thus we should always validate an object, not a property (I mean, value type properties, like strings and integers, etc.) I searched but didn't find good resources on the net in favor or against these methods. What disadvantage could each approach have? I would be grateful if somebody point me to the right direction and show us best practices for validation.


title: Discovering elegant ways of coding

text: I read this thread on programmers today and thought that looked like a really elegant way of coding. I would like to discover more neat methods of coding. What are the best ways of discovering new elegant ways of coding? (Im already aware of the standard design patterns)


title: What are programmers made to do in spare time in jobs?

text: Well, with no prior job experience I am completely ignorant of how things happen at software companies. I want to know what programmers are made to do when there is nothing to do? Lets consider Facebook or Twitter. Now it is quite improbable that Facebook people have something or other feature in mind to be implemented. So software developers are quite expected to have some time when there is nothing to do. Are they free to do anything in this?


title: Observer pattern: "Web of observers" - Is this ever in use?

text: I had an idea (which I'm sure already exists), to create a sort of 'network of observers/subjects'. I would like to describe how it works and than ask several questions about it. Say we have 5 objects: Objects **A** , **B** , **C** , **D** and **E**. Objects **D** and **E** need to observe objects **A** , **B** and **C**. With the regular Observer pattern, both **D** and **E** would register as observers to **A** , **B** and **C**. This means both **D** and **E** would have to register three times as observers, creating **six** observer-subject relationships total. ![enter image description here](http://i.stack.imgur.com/OR0ii.png) The idea is to add another object in the middle, let's call it Object **O**. It implements both the Observer and Observable interfaces. It registers as an observer to objects **A** , **B** and **C**. Objects **D** and **E** register as observers to object **O**. Whenever objects **A** , **B** and **C** notify object **O** , object **O** notifies it's own observers - **D** and **E**. Thus creating a sort of network. This network has a total of **five** observer-subject relationships. ![enter image description here](http://i.stack.imgur.com/4LjjX.png) **As I see it, this has two main benefits:**   * **The less important benefit:** This solution allows for less observer-subject relationships, and thus (I think) creates less complexilty in the system. In this simple description the number of relationships only gets reduced by one, but the more observers and subjects there are, the bigger the benefit.   * **The more important benefit:** Please consider an application with two groups of objects, group A and group B. **All objects in group A need to observe all objects in group B.** If we decide to add an object to group B, than using regular Observer we'd have to update a lot of code to register all objects in group A as observers to the new object. With the 'network' solution (which I'm sure has a different name), we only register the 'middle' object (object **O** ) as an observer to the new object in group B, and all objects in group A would be notified when the new object in group B changes state. **My questions:**   1. **Is this solution ever in use in professional projects?** Did you **ever encounter this** in use? Or is it just a cool idea but never used in practice?   2. What would you say are this pattern's disadvantages?   3. Does it have more advantages that I'm not aware of?   4. Does this have a name?


title: Where do I start to learn systems analysis?

text: Though I learned Systems Analysis in college, I feel like I am out of date. All I really remember is certain aspects of the SDLC which I realize is a little passé. I've been on the implementation end of the development process for the past five years, and I am wanting to explore design and perhaps do a few projects of my own. So I have two questions. What is the most popular design methodology? And what book would be a good place to start for someone who wants to learn that methodology. I know quite a lot of methodologies and patterns (PRISM, MVVM, UML, etc..), but I am having a very hard time picturing the overall process of design. Also, is there a website that offers sample requirements documents? That's the hardest part of starting your own projects is finding something to do.


title: Unit testing and Test Driven Development questions

text: I'm working on an ASP.NET MVC website which performs relatively complex calculations as one of its functions. This functionality was developed some time ago (before I started working on the website) and defects have occurred whereby the calculations are not being calculated properly (basically these calculations are applied to each user which has certain flags on their record etc). Note; these defects have only been observed by users thus far, and not yet investigated in code while debugging. **My questions are:**   * Because the existing unit tests all pass and therefore do not indicate that the defects that have been reported exist; does this suggest the original code that was implemented is incorrect? i.e either the requirements were incorrect and were coded accordingly or just not coded as they were supposed to be coded?   * If I use the TDD approach, would I disgregard the existing unit tests as they don't show there are any problems with the calculations functionality - and I start by making some failing unit tests which test/prove there are these problems occuring, and then add code to make them pass? Note; if it's simply a bug that is occurring that can be found while debugging the code, do the unit tests need to be updated since they are already passing?


title: The need for Explicit Type Conversion in C#

text: Consider the following code:               DerivedClass drbObj = (DerivedClass)obj;      Here `obj` is of type `Object` and this is reasonable since Object is the base type of every Class in C#. Here, since the type of `derObj` is defined at compile time, what is the need to explicitly use type conversion here. Can't the compiler predict on it's own that it will be of `DerivedClass`. I understand that, the Conversion type doesn't have to match the `Derived` type, but for practical purpose, it will only be as useful as the `Derived` type. Could someone explain with a small, hypothetical example, as to why the Explicit Type Conversion is necessary when a reference of type Object is being assigned to a derived class. From what I know, in C, there is no need to do perform Explicit type conversion from `void*` to any pointer and the compiler can handle it, based on the type of the pointer to which the converted value is being assigned.


title: How can I overcome the communication problem(oral language)

text: I am a junior developer who living in Korea. I think I am quite passionate and active. and I want to be one of famous developer all over the world. For spreading my area, I try to join Open Source Projects. But the problem is always _English_. I often can't understand what the member are speaking at the IRC channel. As all you know, for resolving an issue We have to discuss in detail. So English is a big problem for me. And there's no oriental among my Opensource members. How can I solve this communication problem? if you know someone who can overcome this problem, please give me your opinions. Thanks in advance.


title: How do I share different files in a git repo with different people?

text: In a single directory with a Git root folder, I have a bunch of files. I am working on one of those files, X.py, with my friend Alice. The other files I am working on with other people. I want Alice (and everyone else) to have access to X.py. I want Alice to only have access to X.py though. How can I achieve this with Git? Is there a way I can split a directory into two repos? That sounds rather cumbersome. Maybe I could add a remote repo that Alice can access containing X.py?


title: Is it necessary to understand what's happening at the hardware level to be a good programmer?

text: I'm a self-taught programmer, just in case this question is answered in CS 101. I've learned and used lots of languages, mostly for my own personal use, but occasionally for professional stuff. It seems that I'm always running into the same wall when I run into trouble programming. For example, I just asked a question on another forum about how to handle a pointer-to-array that was returned by a function. Initially I'm thinking that I simply don't know the proper technique that the designers of C++ set up to handle the situation. But from the answers and discussions that follow I see that I don't really get what happens when something is 'returned'. How deep a level of understanding of the programming process must a good programmer achieve?


title: method to allow me ability to freely modify my classes, but make them immutable to others?

text: I am creating the model part of an MVC architecture. My one class will provide all the accesses to allow one to fetch system state. I want most of this state to be immutable as it shouldn't be changed and I don't want anyone accessing my model to be able to break the state by making a foolish change. However, The objects representing the state have a bit of a tree structure. object A contains a set of B which contains a set of objects C which contain a set of Object D etc etc. Due to the nature of how I have to fetch the data I can't build the structure from the bottom up; the bottom most 'chid object' will be generated after all the others are completed. This is making it rather inconvenient to build the immutable objects in an intuitive manner, I want to add a set as my last phase of building but I can't if I already built immutable objects. I know of three approaches, but not sure I like any. One is a builder patern, but keeping track of all the builders for a complicated structure until I'm done seems like it could be very ugly. Second is to have a sort of 'clone' method that builds a new immutable object by cloning the old but adding a newly provided set to it (what is this pattern called again?). This gets ugly when I try adding the child most element to the set since I need to pretty much rebuild the entire tree with 'new' immutable objects to add one value. The third, and so far easiest, solution is to just get rid of the tree structure and make them make a call to my model to get the data they want. so instead of calling myObject.getChildren they call Model.getObjectChildren (myObject). This one will work, but darn it I wanted the pretty tree structure for my immutable state. Is there some other way to conveniently build up my state in a manner where my Model can freely modify the state while being built; but still have in immutable when it's finally published to the Controller? ps. I'm running in java if that matters.


title: How do you efficiently keep your tests working as you redesign?

text: A well-tested codebase has a number of examples, but testing certain aspects of the system results in a codebase that is resistant to some types of change. An example is testing for specific output--e.g., text or HTML. Tests are often (naively?) written to expect a particular block of text as output for some input parameters, or to search for specific sections in a block. Changing the behavior of the code, to meet new requirements or because usability testing has resulted in change to the interface, requires changing the tests as well--perhaps even tests that are not specifically unit tests for the code being changed.   * How do you manage the work of finding and rewriting these tests? What if you can't just "run 'em all and let the framework sort them out"?   * What other sorts of code-under-test result in habitually fragile tests?


title: Testing for equivalence of two programs in different architectures (Sequential, Multi Processor, Multi Core)

text: I've found a question that I'm having trouble to realize. It's as follows: Consider the program               P ::           x := 1;           y := 1;           z := 1;           u := 0;          and the program          Q ::           x,y,z,u := 1,1,1,1;           u := 0;      Which of the following is true? (only 1 option is correct)                1. P and Q are equivalent for sequential processors.      2. P and Q are equivalent for all multi processor models.      3. P and Q are equivalent for all multi core machines.      4. P and Q are equivalent for all networks of computers.      5. None of the above.      At a first glance it appears that option (1) is true. But in order for P & Q to be equivalent, their respective instructions are to be executed sequentially, they themselves can be executed in any order (even parallelly). Which holds true for options (1) & (2) [or even with option (3)]. > E.g: P is being executed on processor-1 & Q is being executed on processor-2 > (parallelly), but their individual instructions are being executed > sequentially on their respective processors. In such a case both of them are > equivalent, which makes option (2) true. Here is where ambiguity comes in. Can anybody help me ?


title: Ruby on Rails: Converting a Rails 3 app to Rails 2?

text: I just recently learnt ruby on rails using ruby 1.9.2 and rails 3 using Michael Hartl's tutorial. I'm making an application which I wanted to host on my preexisting server. However, I found that they still do not support rails 3 as it breaks compatibility with mongrel. My question is: How difficult will it be to port my whole Rails 3 app onto Rails 2 if need be? Keep in mind that although I understand rails 3 quite well by now, I have never used rails 2 and do not have any idea of the differences between them.


title: Good coding problem for teaching and practicing how to write good unit tests?

text: Every once and a while I find myself teaching others some techniques useful for writing effective unit tests (usually in Java where many people find writing tests challenging). However, I have yet to find a small-but-not-too- small problem to use to demonstrate the techniques. Likewise, I have not yet found a great problem we can use to practice writing tests. Some problems I have tried have felt completely unrealistic or irrelevant to real life. Does anyone know of a great problem I can use which is small but complex enough and realistic enough to use to teach and practice with? In this case _small_ = _low enough complexity to be a approachable for most developers_ , not necessarily _easy to finish in a short amount of time._ It is okay if we don't finish implementing a solution during the workshop.


title: Is experience in business analysis useful when moving into a programming career?

text: _**Note: If you want the gist of this post, skip to the last two paragraphs._** Before expanding on the question, just a short preamble:   * I figured that the Programmers Q&A network was a better place to ask this question than StackOverflow. **I might be wrong**.   * This is cross-post of a question I asked on Quora some time ago. The general gist of the answers was that, **even though it might not necessarily help you to actually land a job in programming, experience in business analysis will most likely benefit a programmer**. Main reasons for this included:     * the "ability to understand and empathise with the business side of [a] company's operations";     * the idea that the business analysis skill and mindset "might map pretty well to [programming] and help you pick up skills more quickly"; and     * that "analytical skills are critical to being a good programmer".   * Someone elsewhere on this network asked whether "[i]s it more important to focus on a business domain or programming stack/technology". This question resonates with one element of my question, as it asks about whether to focus on specific domain knowledge (e.g. beer brewing) versus specific technology stacks (e.g. barrel ageing, double dropping, etc.). The other element contained in my question (additional to the value of specific domain knowledge) is the value of **general analytical thinking (that can be applied to any business domain) for a programmer**.   * Another guy on this network (sorry, can't paste the hyper-link as I'm already capped at 2 per post at my current reputation level) asked "[h]ow much system and business analysis should a programmer be reasonably expected to do?". He states that in most jobs he held there were no formal business or systems analysis roles. The programmers were expected to play those roles. Consequently, he would often **"lose out to guys who may be average programmers but have a much better understanding of the business processes"**. I guess that, by merit of asking the question, the asker already contributed toward answering mine - business analysis knowledge (i.e. both general analytical thinking skills as well as specific business domain knowledge) and experience ("embracing and internalising a customer-oriented approach" as stated in one answer) is useful to a programmer. So here's **my question in a bit more detail** : I currently work as a consultant for a consulting house. I primarily do business analysis work in the financial industry (to get a good idea about what it is I actually do, consider looking at what the International Institute of Business Analysis has to say). I have been at it now for one and a half years, straight out of university, where I obtained a degree in informatics (which is a fancy word for business analysis). **I am considering a career move into programming**. The question: will my qualification in business analysis, and one and a half years of experience working as a business analyst, add any value to a prospective career in software development. **Another question that naturally follows** : I do realise that, as pointed out by the answers on Quora, that it might not actually help me to _land_ a job in programming. So what _would_? (Obviously I do have a plan, but I'm keen to hear what the community has to say.) Feel free to ask questions or recommend edits to the question, and thanks in advance!


title: Is there an Editor that I can run code using SSH

text: I need an editor where I can edit my code client side, then highlight part of it and run the highlighted code on the connected server. An Example of this would be SQL management studio, but I need it for shell scripts and other languages. UltraEdit does something close with a copy-paste mechanic, are there any others?


title: Facebook contest and vote(like) exchange

text: **UPDATED** we are running a contest using a facebook application to connect with facebook and identify users. a user follows through the standard facebook procedure to allow the application and login. the user then can vote for any entry only once. the vote is saved to avoid the same user voting twice. since the contest has a cash prize we face the problem of vote exchange. vote- exchange is the process where one individual goes to a group-page-forum-etc and trades his voting to another contest, for people voting for his entry in our contest. in essence "buying" votes. they achieve higher number through fake profiles (another problem) so we are faced with:   1. how to detect this vote exchanging    2. how to detect fake facebook profiles   3. in general how to safeguard such a procedure (with or without facebook) right now we are looking for the blindingly obvious violations   1. Very similar emails(john1@ , john2@)   2. Sudden spike in votes (in terms of timing and vote count)


title: Community blog sites

text: I'm considering writing a blog about my experiences while programming. Unfortunately, I doubt I'll be able to post regularly. What I'm wondering is if there are any good software development blogging sites that incorporate posts from multiple people, allowing each one to post at their own rate and, because there's a number of them, wind up with enough content that it's worth visiting them? Context: There are three types of posts that I'd likely create:   * Personal thoughts on various topics (I think language feature X is important because..., etc)   * Personal experience with a given language/framework/etc (I had problems with framework X because...)   * Personal experience trying to solve a specific problem (Here's what I needed, here's the problems I ran into, and here's how I solved it) Edit: Of course, I mistyped the title as "community glob sites" at first. That doesn't bode well for my blogging performance ;)


title: version control workflow for environment with shared code

text: I work at a company that is looking into "upgrading" our version control system. We have about 200 websites that operate in their own directories. However, all of these websites use the same shared code. We basically use the 200 directories for the display code (html/css) and then the shared code for the processing and database queries. Its a little more detailed but I'll leave it at that for now. We also have a backend system that primarily uses shared code only. We currently have multiple programmers and multiple coders/designers that all need access to the code on a regular basis. Unfortunately our shared code isn't exactly modular, so it is hard to split something off into a "project" when something needs done since so many files are hit. I am basically looking for suggestions on the best workflow available for a version control system. As far as we can tell from research, git seems to be the way to go. But being the version control newbies that we are, we still have concerns on general workflow. Can anyone give me any advice on this topic? **Edit:** I'm trying to be a little more detailed, hopefully I answer some questions from the comments. Pretty much anyone is allowed to change any code at any time. If a change is made to shared code then it is immediately applied to the central code base. We don't really have a versioning scheme. We used to in the past but it was never enforced when new developers were brought on board. The shared code is clearly separated from the rest of the code. There are a few files in our system that get edited a lot. We are constantly "stepping on each other's toes" with these files. These files are very important to our system. I'll be the first one to say this is not an ideal work situation. We are well aware these files need to go. We are in the planning process of modularizing them but we would still need to consider them when choosing a versioning system. I guess another good thing to mention is the fact that we have a large number of files. This isn't ideal either but its happened primarily from not having a sound version control system put in place. Many developers over the years would just save a back up of a file if making a significant change. This is another reason we want to move away from the current scheme. Thanks for your responses already.


title: Recommendations for implicit versus explicit line joining

text: I would like to know recommendations about Implicit Line Joining versus Explicit Line Joining in Python. In particular, do you favor one form over the other? What do you recommend as the general default? What criteria do you have for choosing one over the other, and if you do have a preference of one, when do you make exceptions for the other? I have an answer in mind for this question that reflects my own biases, but before I post my own answer I would like to know what others think... and if you can have a better set of criteria than what I have in mind, then I'll certainly accept your answer over my own. Some of the recommendations may be generalized to this choice in other programming languages, but my own bias is somewhat stronger in Python due to some language-specific features, so I'd like to know both the general and the Python-centric reasoning you may have on this topic. For some background, the discussion happened around a particular question on stackoverflow, but I thought it was more appropriate to move the discussion over to here as a question to avoid cluttering up the answer on SO with this tangent since it has veered off-topic from the original question. You can look at that question and its answers for the example code snippets that got the discussion going. Here is a simplified example:               join_type = "explicit"     a = "%s line joining" \         % (join_type)     # versus     join_type = "implicit"     b = ("%s line joining"          % (join_type))


title: Is defining every method/state per object in a series of UML diagrams representative of MDA in general?

text: I am currently working on a project where we use a framework that combines code generation and ORM together with UML to develop software. Methods are added to UML classes and are generated into partial classes where "stuff happens". For example, an UML class "Content" could have the method DeleteFromFileSystem(void). Which could be implemented like this:               public partial class Content     {         public void DeleteFromFileSystem()         {             File.Delete(...);         }     }      All methods are designed like this. Everything happens in these gargantuan logic-bomb domain classes. Is this how MDA or DDD or similar usually is done? For now my impression of MDA/DDD (which this has been called by higherups) is that it severely stunts my productivity (everything must be done The Way) and that it hinders maintenance work since all logic are roped, entrenched, interspersed into the mentioned gargantuan bombs. _Please refrain from interpreting this as a rant - I am merely curious if this is typical MDA or some sort of extreme MDA_ **UPDATE** Concerning the example above, in my opinion Content shouldn't handle deleting itself as such. What if we change from local storage to Amazon S3, in that case we would have to reimplement this functionality scattered over multiple places instead of one single interface which we can provide a second implementation for.


title: Software design approach for large relational database

text: I am working on a personal side project that will utilize a complex and large relational database. During the design of the database I had some co-workers give advice to how I should approach my application; they advised to use the entity framework. From what I've read and what I am watching it sounds like the entity framework is the right tool for the job. However what I have come to programmer.stackexchange for is to ask whether or not somebody who has just going going in their career should do. Let me rephrase; I have 3 years web design / development experience (html/css/js/php/mysql) and now about 1 year experience with actual software engineering C#/VB. So the question is should I utilize the entity framework or should I build this rather complex and ambitious project without the entity framework; ergo building all the SQL that will handle massive amounts of relational data? The reason why I ask is because I want to get the most ROI (knowledge and experience) from the project. Once again... thanks!


title: From a design perspective, what are the best practices for logging?

text: I want to add logging to an application I'm currently working on. I've added logging before, that's not an issue here. But from a design perspective in an object-oriented language, what are the best practices for logging that follow OOP and patterns? _**Note:_** I'm currently doing this in C#, so examples in C# are obviously welcome. I would also like to see examples in Java and Ruby. * * * **Edit:** I'm using log4net. I just don't know what's the best way to plug it in.


title: How to use the Decorator pattern to add little functionality to big objects?

text: This question regards the usage of the Decorator pattern to add little functionality to objects of large classes. Following the classic Decorator pattern, please consider the following class structure: ![enter image description here](http://i.stack.imgur.com/FCyEd.png) For example, imagine this happens inside a game. Instances of `ConcreteCharacterDecorator` are meant to add little functionality to the `ConcreteCharacter` they are 'wrapping'. For instance, `methodA()` returns an `int` value representing the damage the character inflicts on enemies. The `ConcreteCharacterDecorator` simply adds to this value. Thus, it only needs to add code to `methodA()`. The functionality of `methodB()` stays the same. `ConcreteCharacterDecorator` will look like this:               class ConcreteCharacterDecorator extends AbstractCharacterDecorator{              ConcreteCharacter character;              public ConcreteCharacterDecorator(ConcreteCharacter character){             this.character = character;         }              public int methodA(){             return 10 + character.methodA();         }              public int methodB(){             character.methodB(); // simply delegate to the wrapped object.         }          }      This is no problem with small classes containing two methods. **But what if`AbstractCharacter` defined 15 methods?** `ConcreteCharacterDecorator` would have to implement all of them, even though it's only meant to add little functionality. I will end up with a class containing one method that adds a little functionality, and another 14 methods that simply delegate to the inner object. It would look like so:               class ConcreteCharacterDecorator extends AbstractCharacterDecorator{              ConcreteCharacter character;              public ConcreteCharacterDecorator(ConcreteCharacter character){             this.character = character;         }              public int methodA(){             return 10 + character.methodA();         }              public int methodB(){             character.methodB(); // simply delegate to the wrapped object.         }         public int methodC(){             character.methodC(); // simply delegate to the wrapped object.         }         public int methodD(){             character.methodD(); // simply delegate to the wrapped object.         }         public int methodE(){             character.methodE(); // simply delegate to the wrapped object.         }         public int methodF(){             character.methodF(); // simply delegate to the wrapped object.         }         public int methodG(){             character.methodG(); // simply delegate to the wrapped object.         }         public int methodH(){             character.methodH(); // simply delegate to the wrapped object.         }         public int methodI(){             character.methodI(); // simply delegate to the wrapped object.         }         public int methodJ(){             character.methodJ(); // simply delegate to the wrapped object.         }         public int methodK(){             character.methodK(); // simply delegate to the wrapped object.         }         public int methodL(){             character.methodL(); // simply delegate to the wrapped object.         }         public int methodM(){             character.methodM(); // simply delegate to the wrapped object.         }         public int methodN(){             character.methodN(); // simply delegate to the wrapped object.         }         public int methodO(){             character.methodO(); // simply delegate to the wrapped object.         }          }      Obviously, very ugly. I'm probably not the first to encounter this problem with the Decorator. How can I avoid this?


title: Why do game developers prefer Windows?

text: Is it that DirectX is easier or better than OpenGL, even if OpenGL is cross- platform? Why do we not see real powerful games for Linux like there are for Windows?


title: How to tell client I no longer want to work on his project

text: This is probably going to sound messed up, but here it goes. I've been working on a project for a client for a while now. I wasn't given any details except for "It has to be an XYZ plugin and interface with ABC product". Which was fine, but now we're towards the end (I think) and it's just dragging out. I don't have any time to spend on it and I'm already over schedule by 3 months. Trying to get the client to describe to me how he would like to be able to navigate the data (a UI issue) is just difficult. I've submitted mock ups on what I think he wants but his latest response is "you should look at XXX product", it has similar functionality. Of course, I looked at it and it looks similar to what I submitted, but I don't think that the way I've built the framework is going to support what he is now describing to me. We've had good communication throguh out the process but he doesn't know what he wants. I explained how I was going to build the framework and he agreed, so it isn't a bad choice on my part about design. When I go over what I think are finalized modules, he says, "You should have done it this way" which requires me to go back and rework code and UI. Some smaller items could have been better thought out by me, but the big things are how I interpreted his requirements and I've gone over this module several times during development. I've already received final funds last month so i'm working for free at this point. I no longer want to deal with this project. I've already received payment. I've done other successful projects with this client before and he has a lot of other projects he wants to do. What the heck should I do? I don't want to work on this project anymore. I don't want to ask for any more money (money isn't really the issue). I don't want to make him mad either. I know it looks like I want to have my cake and eat it too. If you think I should call it quits, how should I do it given the circumstances?


title: Is the rule of 10% code is comments still valid?

text: I've used some older languages before C# and I always felt the need to comment what I was doing so it is clear for anyone who reads the code. But now that I use C# decently, I often feel that it's a pain to write most of the comments because I feel like I state the obvious. So unless I do complicated formulas or algorithms, I'm not sure how I should comment. Microsoft has reached such a readability in C#, I'm mesmerized. Do you have the same feeling? How do you write your comments so they are not pure redonduncy? Have you changed your commenting habbits / best practice?


title: Books or help on OO Analysis

text: I have this course where we learn about the domain model, use cases, contracts and eventually leap into class diagrams and sequence diagrams to define good software classes. I just had an exam and I got trashed, but part of the reason is we barely have any practical material, I spent at least two good months without drawing a single class diagram by myself from a case study. During the exam the teacher gave us the domain model, two or three use cases on some vital system operations and a glossary. We had to model up a class diagram and some sequence diagrams for these. The thing is, the jump from real-life modeling to OO classes didn't seem clear to me.      I handle the GRASP principles pretty well, but I lack practice. I could use something that gives a pre-made analysis and asks you to draw the OO design in form of class diagrams or something. I know it varies from one person to another, but some concepts should always make sense. I'm not here to blame the system or the class I'm in, I'm just wondering if people have some exercise-style books that either provide domain models with glossaries, system sequence diagrams and ask you to use GRASP to make software classes? I could really use some alone-time practicing going from analysis to conception of software entities. I'm almost done with Larman's book called "Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development, Third Edition". It's a good book, but I'm not doing anything by myself since it doesn't come with exercises. I've been programming in OO for four years now in Java and C++. It was oriented on business applications. I've also spent 6 months on UML syntax in a crash course in college. It's just that I don't understand how they can expect me to define software entities from use cases into class diagrams if I've done like one or two in my life.


title: How strictly do you follow the "No Dependency Cycle" rule (NDepend)

text: A bit of background: As a team lead I use NDepend about once a week to check for the quality of our code. Especially the test-coverage, lines of code and cyclomatic complexity metrics are invaluable for me. But when it comes down to levelization and dependency cycles I am a bit ... well concerned. Patrick Smacchia has a nice blog post which describes the goal of levelization. To be clear: Under "dependency cycle" I understand a circular references between two namespaces. Currently I am working on a Windows CE based GUI framework for embedded instruments - just think of the Android graphics platform but for very low end instruments. The framework is a single assembly with about 50.000 lines of code (tests excluded). The framework is split into the following namespaces:   * Core Navigation & Menu Subsystem   * Screen Subsystem (Presenters / Views / ...)    * Controls / Widget Layer Today I spent the half day on trying to bringe the code to proper levels [thanks to Resharper no problem in general] but in all the cases some dependency cycles exist. So my question: How strictly do you follow the "No Dependency Cycle" rule? Is levelization really that important?


title: Using XSLT for messaging instead of marshalling/unmarshalling Java message objects

text: So far I have been using either handmade or generated (e.g. JAXB) Java objects as 'carriers' for messages in message processing software such as protocol converters. This often leads to tedious programming, such as copying/converting data from one system's message object to an instance of another's system message object. And it sure brings in lots of Java code with getters and setters for each message attribute, validation code, etc. I was wondering whether it would be a good idea to convert one system's XML message into another system's format - or even convert requests into responses from the same system - using XSLT. This would mean I would no longer have to unmarshall XML streams to Java objects, copy/convert data using Java and marshall the resulting message object to another XML stream. Since each message may actually have a purpose I would 'link' the message (and the payload it contains in its properties or XML elements/attributes) to EXSLT functions. This would change my design approach from an imperative to a declarative style. Has anyone done this before and, if so, what are your experiences? Does the reduced amount of Java 'boiler plate' code weigh up to the increased complexity of (E)XSLT?


title: How to comment the file system?

text: When certain parts of code are unusual or unclear, common practice is to leave a comment explaining why it is so. However, sometimes a filesystem may have unusual configuration, such as a directory with 0477 privileges. **Is there any convention for leaving comments about this?** I am writing a 'Developers Wiki' for the company as that would be the place for such things. However I would prefer something **more standard if it exists** and more accessible when, for instance, the next guys has to SSH in from home in the middle of the night and he might not think to check the wiki (or even have access to it).


title: Is it true that "Real programmers can write assembly code in any language."?

text: > Real programmers can write assembly code in any language.   >  (Larry Wall). As far as I can make out, Mr. Larry Wall is trying to say that to a real programmer any language can have the same functionality as ASM. But I seriously do not understand. How can you write assembly code in high level languages like Perl, Python, Java and C#? Languages like Perl and Python don't even have pointers. Or Does he mean something else? What is Mr. Wall actually trying to say?


title: How would I make a compiler in C++?

text: This probably been asked for but I can't google "How to make a compiler in C++" because I will just get "How to compile C++" as the results. Anyway, for my question, I'd like to make a simple programming language in C++. Now I understand basic file IO stuff but what I don't get is how to build a EXE. The problem here is I don't know how EXEs exactly are "planned out", granted that most people don't. I was going to simply parse the language into assembly and assemble it using an assembler. But I don't want to do that, I want to actually compile it directly into a EXE. Does anyone know how this would be done? PS: To all you people who say making a compiler is virtually impossible, it's a fairly fast process, it's just implementing OOP features that's hard


title: Can you actually produce high quality code if you are sleep deprived?

text: I have heard about programmers coding for two days without sleep and drinking coffee and Red Bull. Also in movies like The Social Network, in a scene they show that Mark Zuckerberg has been programming for 36 hours. Also it's said that in companies like Facebook, Google, foursquare, etc. they can code for more than 24 hours without sleep. Is this really true? Can you actually produce high-quality code if you are sleep deprived? _Can things like Red Bull make up for sleep?_


title: What are the best practices to use NHiberante sessions in asp.net (mvc/web api) ?

text: I have the following setup in my project:               public class WebApiApplication : System.Web.HttpApplication     {         public static ISessionFactory SessionFactory { get; private set; }              public WebApiApplication()         {             this.BeginRequest += delegate             {                 var session = SessionFactory.OpenSession();                 CurrentSessionContext.Bind(session);             };                       this.EndRequest += delegate             {                 var session = SessionFactory.GetCurrentSession();                      if (session == null)                 {                     return;                 }                      session = CurrentSessionContext.Unbind(SessionFactory);                 session.Dispose();             };         }              protected void Application_Start()         {             AreaRegistration.RegisterAllAreas();                  FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);             RouteConfig.RegisterRoutes(RouteTable.Routes);             BundleConfig.RegisterBundles(BundleTable.Bundles);             var assembly = Assembly.GetCallingAssembly();             SessionFactory = new NHibernateHelper(assembly, Server.MapPath("/")).SessionFactory;         }     }          public class PositionsController : ApiController     {         private readonly ISession session;              public PositionsController()         {             this.session = WebApiApplication.SessionFactory.GetCurrentSession();         }              public IEnumerable<Position> Get()         {             var result = this.session.Query<Position>().Cacheable().ToList();                  if (!result.Any())             {                 throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound));             }                  return result;         }              public HttpResponseMessage Post(PositionDataTransfer dto)         {             //TODO: Map dto to model             IEnumerable<Position> positions = null;             using (var transaction = this.session.BeginTransaction())             {                 this.session.SaveOrUpdate(positions);                      try                 {                     transaction.Commit();                 }                 catch (StaleObjectStateException)                 {                     if (transaction != null && transaction.IsActive)                     {                         transaction.Rollback();                     }                 }             }                  var response = this.Request.CreateResponse(HttpStatusCode.Created, dto);             response.Headers.Location = new Uri(this.Request.RequestUri.AbsoluteUri + "/" + dto.Name);             return response;         }              public void Put(int id, string value)         {             //TODO: Implement PUT             throw new NotImplementedException();         }              public void Delete(int id)         {             //TODO: Implement DELETE             throw new NotImplementedException();         }     }      I am not sure if this is the recommended way to insert the session into the controller. I was thinking about using DI but i am not sure how to inject the session that is opened and binded in the BeginRequest delegate into the Controllers constructor to get this                   public PositionsController(ISession session)         {             this.session = session;         }      **Question:** What is the recommended way to use NHiberante sessions in asp.net mvc/web api ?


title: Are you allowed to "copy" the GUI/Features of another application

text: I'm making a app which is based heavily on another application that serves a similar purpose. I'm not actually planning on selling it, but I'm wondering whether it would even be legal for me to sell it. I don't borrow graphics from the other application, but I have a very similar color scheme, virtually the same features (I added a few, but not really significant), and a very similar interface layout. Obviously, I'm not borrowing any code (It's written in Objective-C and mines written in Java). Again, I'm not actually planning on selling it, I was just wondering in the hypothetical. I'm not sure whether it's just the code that's copyrighted or the actually design itself.


title: Should I swap from WCF to NserviceBus

text: 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!


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

text: 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.


title: Watson Encoding Information

text: 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.


title: Implicitly or explicitly sorted elements?

text: 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?


title: Too many seniors in one team?

text: 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?


title: Configuration file that can be modified by user in C#

text: 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.


title: Could a programming language work as well without statements?

text: 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?


title: MVC helper functions business logic

text: 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?


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

text: 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?


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

text: 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?


title: Best option to send image from javascript client to SQL server

text: 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?


title: PDF or ebook Java API documentation

text: 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.


title: How to populate a private container for unit test?

text: 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?


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

text: 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.


title: how do you manage application performance reviews

text: 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.


title: Beginning a sentence with a function name?

text: 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.


title: How should a web API handle misspelled/extra parameters?

text: **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.


title: How to become certified in Objective C?

text: > **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?


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

text: 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.


title: Is there a canonical book on Scala?

text: 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?


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

text: 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


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

text: 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


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

text: 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`.


title: how to approach pharmacy software project

text: 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.


title: Single page app permissions represented through RESTful APIs

text: 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?**


title: Parameterized tests - When and why do you use them?

text: 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.


title: What does neo4j's licensing guide mean?

text: 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).


title: Most Appropriate Authentication Type for MVC5 project

text: 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.


title: How to choose parameter for Golomb coding?

text: 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.


title: Should validation messages contain punctuation?

text: When building an application should all validation messages have punctuation?


title: Visitor only applicable when using the Composite pattern?

text: 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?


title: Using table-styled divs instead of tables

text: 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?


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

text: 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.


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

text: 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)


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

text: 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)


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

text: 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.