title: Best practices for App Idea ownership and shares

text: I am developing apps on my sparetime. I am the sole developer, and two non- programmer friends of mine provide vision, content, algorithms and ideas. We always agree happily on all the features, todos and prioritizations. But naturally, coding it is the biggest part. When selling, we agree on **splitting profit equally** , that is 33% each. But version 1.0 naturally does not sell much. And I go on to try to make the app more viral. This includes tons of stuff where the others are of little help. Examples: Adding support for sharing, facebook connect, gameifying, letting users add content, home page, support, maintenance, server services to make it easier for to update content. The list is long. Suddenly I will be doing 100% of a lot of work but only "own" a third of the income. My friends may either "fade out" of the project after 1.0, or they continue to contribute, but with less value and I would rather exchange them for more programmers or graphic designers. The effort they made to version 1.0 is worth a lot to the app and I realize I would have never done it without them. But **I am doing all the work** in the end. It is hard to negotiate about splitting 90, 5, 5 instead of 33% each, because the idea is still theirs. How to solve this? What are the best practices to regard the ownership of the app? What kind of agreements could I make that make it beneficial and motivational for me to continue developing the app?


title: Which VCS is more applicable for our workflow?

text: Currently we have code stored on a shared network drive and do not use any kind of VCS. The code stored on our shared network drive is always being backed up. We would like to keep things as close to they are now as possible, while using some kind of VCS software. I am envisioning a centralized workflow with each developer having a local copy of the code on his/her machine. We don't do any branching or working offline. Typically when we spin off a new version we would just copy the current working directory to a new directory. I believe we would continue doing this and just create a repository for the new version. I would rather not get into an argument over which VCS is better, just hoping to get some opinions for which is best suited and most applicable for what we are trying to do.


title: Does lots of Instance Variables within my class suggest flawed Design?

text: Ok so I am setting out to consolidate some learning I have been doing. What I am going to do is create a small game relating to a game I enjoy called Persona. For reference a persona you can think of as a pokemon. Basically I want the flow to be user chooses a character, a weapon, and a persona (from a list of predefined personas and people i.e. predefined stats and spells for the persona and predefined weapons, stats and personas for the characters). They will choose and I will use maths/ifs/whiles etc to calculate winners. I currently have a Characters class (with Persona, Stats and Weapon instance variables), a Character Stats class (health, mana etc IVs), a Persona class(with persona stats and name iv), a Persona stats class (agility strength etc IVs) (later I will make the PersonaSpells class) and a Weapons class (attack, hit etc IVs), as well as a Duel class (where all the calculations will be run and methods for player select, enemy selection etc. Additionally with my current implementation all character objects, persona objects and weapon objects etc will be defined in this class and assigned using for example using Character char = new Character(Name, Health, Persona, Weapon, ...), with constructors for persona and weapon defined before this. Finally a main class where I will effectively use an object of the duel class to run the game, and keep the main class and method clearer. My question is, is this design flawed in that, I end up having to declare loads of objects (as IVs) from constructors of my classes. (So I have an object of all 20 weapons, all 10 characters, all 20 Personas, all 10 character stats, all 20 persona stats) All within my Duel class. Code example below:               private Weapon deusXiphos = new Weapon();     (x 20 more like this)          private PersonaStats artemisiaStats = new PersonaStats();     (x 20 more like this)          private Persona artemisia = new Persona();     (* 20 more like this)          private CharacterStats mitsuruStats = new CharacterStats(400, 250);     (* 10 more like this)          private Character mitsuru = new Character("Mitsuru", artemisia, deusXiphos, mitsuruStats);     (* 10 more like this)


title: When copy/pasting private methods is it necessary to carry along the Javadoc?

text: So, unfortunately, I'm stuck with code where I'm doing this:               @Override     method A{         //calls private methods 1-8     }          private method 1{         //copy/pasted     }      And so on for all of the private methods. I'd have preferred if the developers of the method I'm overriding had made the private methods protected, but I can't change that now. All of these private methods have javadoc along with them - should I carry this along with the copy/pasted functions in my class and adjust them accordingly, or not waste my time since it is documented in the original file?


title: Effective Repository in C# - Where to put methods?

text: I'm trying to build a new application using the Repository pattern for the first time and I'm a little confused about using a Repository. Suppose I have the following classes:               public class Ticket     {          }     public class User     {        public List<Ticket>AssignedTickets { get; set; }     }     public class Group     {        public List<User> GroupMembers { get;set; }        public List<Ticket> GroupAssignedTickets { get;set; }     }      I need methods that can populate these collections by fetching data from the database. I'm confused as to which associated Repository class I should put those methods in. Should I design my repositories so that everything _returning_ type T goes in the repository for type T as such?               public class TicketRepository     {        public List<Ticket> GetTicketsForGroup(Group g) { }        public List<Ticket> GetTicketsForUser(User u) { }     }     public class UserRepository     {       public List<User> GetMembersForGroup(Group g) { }     }      The obvious drawback I see here is that I need to start instantiating a lot of repositories. What if my User also has assigned Widgets, Fidgets, and Lidgets? When I populate a User, I need to instantiate a WidgetRepository, a FidgetRepository, and a LidgetRepository all to populate a single user. Alternatively, do I construct my repository so that everything _requesting_ based on type T is lumped into the repository for type T as listed below?               public class GroupRepository     {         public List<Ticket> GetTickets(Group g) { }         public List<User> GetMembers(Group g) { }     }     public class UserRepository     {        public List<Ticket> GetTickets(User u) { }     }      The advantage I see here is that if I now need my user to have a collection of Widgets, Fidgets, and Lidgets, I just add the necessary methods to the UserRepository pattern and don't need to instantiate a WidgetRepository, FidgetRepository, and LigetRepository class every time I want to create a user, but now I've scattered the concerns for a user across several different repositories. I'm really not sure which way is right, if any. Any suggestions?


title: How to handle committed and merged code that has no tests?

text: When developing an application in a team not everyone on this team will be equally good developers. Some will be skilled in some things and some in others and some not at all. As a team working in an agile process you usually have a definition of 'done' to follow. In our DoD it says never to merge code that is not documented and have proper tests. Sometimes though, a feature is so critical to some team member so the code has to be merged without tests. Sometimes a lazy developer might merge and call it a weekend. A merge like this means that when other team members pull the code, they will receive code that may or may not function properly and since there are no tests it is hard to verify. It can be very cumbersome to walk through that code to make sure it works before the team member can work on their task. It has happened on several occasions that the code that was committed without tests has been broken by other team members without them noticing. So my question becomes:   * How would you handle issues like this?    * Does it point to bad planning rather then bad behaviour?   * Who is to "blame" if code that lacks tests is broken?


title: When did the term "snake case" come into use?

text: Many people use the term Snake Case to describe variables or other symbols `with_the_form_of_underscores`. When did this term enter into use?


title: Natural Language Processing (NLP) open source algorithms

text: I am looking for a way to give an algorithm (service) a sentence, and it will tell me if its positive context or negative or even neutral. Does such a service exist?


title: Password Validation using regular expressions in html 5

text: this question may sound stupid, but no one has ever taught me this. I have an HTML input for a password field, and you can only log on with one specific password with JS. Could someone please give me a syntax on assigning a variable to document.getElementById(""); syntax or a different syntax? Thanks.


title: Practices for navigating and changing "long" code files?

text: Many a times I have to deal with code files which are quite long - about 5 screen pages at the minimum. Almost always there is something _towards the top/bottom_ that I need to refer when I'm at the bottom/top (respectively). It's a mammoth overhead to constantly scroll back-n-forth between the file parts. It's a cognitive overload to just remember each and everything throughout the file and it's quite necessary to be able to refer to parts of the file. Yes, the _Outline_ view in some editors like Eclipse/NetBeans helps, but sometimes they will work well only for parts recognizable by that parser. Sometimes outline views don't show up e.g. when coding in CoffeeScript or JavaScript using closures/namespaced functions etc. The fallback is then just manual scroll overhead. So as programmers what are some of the techniques/practices that can be employed to reduce this ridiculous overhead? Yes, I can _shorten_ the files, but specifically javascript libraries like Backbone.js etc. are all as one file since you really can't split them into multiple file due to lack of Java-like _packages_. So under the constraints of inability of splitting a file and the outline views not working, what are some of the techniques I can use to navigate through long source files? I work a lot on Eclipse/Netbeans and Aptana and sometimes Vi (but seldom in production environments). It'd be great to be able to split a window into two and see the same file on one side and code in the other. Not doable with Eclipse/NB/Aptana IMO. Vi, yes but can't use it all the time. PS: As of now, I split the file among multiple editors e.g. Eclipse and Aptana. It'd be great to have it at one place, but is that the best that we can do? :) **UPDATE** \- Seems Eclipse _has_ way for doing this and can be found here


My understanding is that Google is not using MapReduce for Google Instant, but I can't find anywhere that states what they're using as the datastore for Google Instant. What is the datastore used by Google for Google Instant?


title: Saving Passwords To The Local Device

text: So In my app (iOS), you have to register in order to use the service (a food service). But in order to change details about your account (username, password, and email), you have to reenter your password. Except for if the user logged out, this is the only time you need your password to use the app. So I was wondering, since the user basically never uses their password, and its likely they would forget it the one time they might need it, is it ok if I store their password to their local device (in `NSUserDefaults`)? Since their password would only be on their local device, it doesn't seem like a security risk. If the app was hacked, the only password they could get would be their own. Further, I was planning on just storing it as a string (no encryption). Would it make a difference if I hashed it or encrypted it before saving the password to their defaults? Thanks in Advance.


title: Why would one bother marking up properly and semantically?

text: > Note that I (try) to mark up as semantically as possible because I like they > way it looks and feels, but not because I'm aware of any other stunning > advantages. The point of my question is to be able to educate others Well, I've seen a lot of articles and tutorials which often state "Let's mark this up in the most semantic possible way". But a strange thought came to me, **why?** Why would one need (or want) to bother with the specific elements which convey the correct semantic meaning? Specifically, I'm referring to the new HTML5 elements, such as `<time>`, `<output>`, or `<address>`. Especially, if the page "works" (it renders nicely in all browsers). Why would I want to use elements like `<time>` or `<address>`, where nothing at all (or at the worst case, a generic `<span>`) works just as nicely? I'm asking this because I'm seeing a multitude of (very popular) websites (this one included) which does not follow these so-called best practices.


title: Recovering an anemic domain model into a multitier architecture

text: I have spent the past several days learning about domain driven design and attempting to apply it to a current project. I decomposed the problem domain into the canonical logical components: domain, infrastrucutre, and presentation. Having completed a first pass, I stepped back and realized that the architecture I created resulted in virtually all of the business logic being contained in the application services, which is the tell-tale sign of the anemic domain model code smell. After further consideration, domain driven design may not be the correct fit for my application, and even if it is, given the small number of business logic rules in my application, the layering overhead may not be worth it. Since I have only written UML and psuedo code I haven't invested too much time and effort, but I would like to leverage what I can if it's possible. My architecture consists of 4 physical components:   1. The "domain" project: abstractions and CRUD methods for the data type I use   2. The "infrastucture" project: the logical representation and methods to be performed on the data   3. The "presentation" project: the user interface (WinForms or WPF)   4. The "services" project: coordiates the domain and infrastucture objects according to business rules If I were to use the components as designed in a multitiered architecture, my presentation layer would only hold references to 3 or 4 services to handle all application functionality. Is this a valid approach?


title: Should the most recent date be named 'start' or 'end'?

text: So I have a function that takes two dates. The SQL query gets all the results between the two dates. I currently have my function setup as such:               function myFunc(start, end)      Where start is the most recent date and end is the oldest date. Is this intuitive/correct or is there another naming/ordering convention I should be using?


title: Formal name for left/right-hand-side of an expression

text: Given an expression, such as `int x = y + 5`, we'd call `int x` the `left-hand side` (or `LHS`), and `y + 5` the `right-hand side` (or `RHS`). The whole expression is called, of course, an `expression` (or `equation`), but is there a generic term for a "side" of an expression? `LHS` and `RHS` don't quite cut it when it comes to an expression such as `int x = y = 5` (gloss over the fact here that such assignments are generally bad practice!). I'm toying with the term `component` to describe any "side", but was interested to see if there was a formal standard term already in use. Wikipedia only has "Sides of an equation", any better suggestions?


title: Any tips/tricks/resources on actually TEACHING a class on OOP?

text: I may slowly be getting into teaching an Object-Orientated Programming class at my school in a year or two. I just graduated and work at my school as an Application Programmer. I'd first start off as a TA/grader and then slowly move into the Professor role. The class would be in Java. I always see resources on this fine site about HOW to program, but does anyone know any tips/tricks/resources on how to TEACH a programming class? It would be full of all different skills levels(but still semi-technical) so it would have to be a little more understandable than if it was just CS kids.


title: Not okay to take notes at meetings?

text: I started working at a new job, and have made it a point to take notes at every meeting, of 2 to many people. So far it's worked well for me. It helps me organize and refactoring concepts, a useful exercise for a programmer. I take notes so often and end up rewriting them in e-mails or documentation that I have decided to buy a netbook/notebook/chromebook for this purpose. I recently had a conversation with a colleague about this and note-taking. He said that while he was working as a software consultant in the past, note- taking was frowned upon in some settings. Why would this be? Using the machine as a distraction is one thing, but the benefits to taking notes are so many that I don't see why anyone would be against doing so. **Other considerations** In settings where there's a high value placed upon actual retention and learning from the discussion (e.g. a university lecture, requirements- gathering) taking notes is common and even expected. So is studying those notes later. A lot seem to argue here in favor of pencil-paper vs. machine. There must be some merit to this argument. But by analogy, we could insist programmers develop w/ Notepad (instead of Visual Studio) and without an internet connection. That should remove distractions, but then it's questionable how much productivity is gained through limitations such as this. From reading some of the answers/comments given here, it's interesting that one of the reasons note-taking is discouraged is when they _don't_ want people to walk away with anything after the meeting, e.g. intellectual property that's worth holding a meeting on, but.


title: Do reactive extensions and ETL go together?

text: I don't fully understand reactive extensions, but my inital reading caused me think about the ETL code I have. Right now its basically a workflow to to perform various operations in a certain sequence based on conditions it find as it progresses. I can also imagine an event driven way such that only a small amount of imperative logic causes a chain reaction to occur. Of course I don't need a new type of programming model to make an event driven collaboration like that. Just the same I am wondering if ETL is a good fit for potentially exploring Rx further. Is my connection in a valid direction even? If not, could you briefly correct the error in my logic?


title: How should I start refactoring my mostly-procedural C++ application?

text: We have a program written in C++ that is mostly procedural, but we do use some C++ containers from the standard library (vector, map, list, etc). We are constantly making changes to this code, so I wouldn't call it a stagnant piece of legacy code that we can just wrap up. There are a lot of issues with this code making it harder and harder for us to make changes, but I see the three biggest issues being:   1. Many of the functions do more (way more) than one thing   2. We violate the DRY principle left and right    3. We have global variables and global state up the wazoo.  I was thinking we should attack areas 1 and 2 first. Along the way, we can "de-globalize" our smaller functions from the bottom up by passing in information that is currently global as parameters to the lower level functions from the higher level functions and then concentrate on figuring out how to removing the need for global variables as much as possible. I just finished reading Code Complete 2 and The Pragmatic Programmer, and I learned a lot, but I am feeling overwhelmed. I would like to implement unit testing, change from a procedural to OO approach, automate testing, use a better logging system, fully validate all input, implement better error handling and many other things, but I know if we start all this at once, we would screw ourselves. I am thinking the three I listed are the most important to start with. Any suggestions are welcome. We are a team of two programmers mostly with experience with in-house scripting. It is going to be hard to justify taking the time to refactor, especially if we can't bill the time to a client. Believe it or not, this project has been successful enough to keep us busy full time and also keep several consultants busy using it for client work.


title: What are the career options in Delphi

text: I am a fresher working in an Antivirus company in India. We work in Delphi 7. now i know that delphi is not very widely used. My concern is that I will be something of a pariah in the industry dominated by Java and C etc. Also, my company is not that great. I would like to switch to a bigger company in near future. Can you tell me some companies (mnc) which do their projects in delphi? Thanks


title: Interview: Review another developer's code

text: One of my colleagues recently left and I've been asked to review the code of an interviewee coming in to replace him. I have no idea what code he'll bring along with him and moreover have never been given this sort of responsibility before, so am eager to give some useful and fair input. Can anyone provide a succint list of things to look out for?    _I understand this is a very broad question, but this does equally seem like a very appropriate forum for asking it._


title: How could multiple people work on one website?

text: Hey guys, I recently watched The Social Network, and this might be a stupid question, but how is it possible for multiple people to work on one website? I mean, if they're working on the same page, how is that possible? And also, is it possible to upload files to an online host without making them live? Thanks in advance.


title: Distributing my Application inside a Debian Virtual Machine Image-- How to meet GPL obligations?

text: I have a Linux application I've developed, and I have created a standalone VMWare Image that people can download to try out the application without needing to install and configure a Linux Server. I created this VMWare Image by starting with a base Debian system, installing a bunch of packages and then configuring all the packages and daemons my application depends on. Upon load, the VMWare Image boots right into an X Server running only my application and no Window manager, so its more of a "Virtual Appliance" than a normal Linux Desktop environment. Users generally will never see a command prompt or any application other than my own. (My application itself I have a handle on the licensing issues of) Now I would like to distribute this image, but I'm not sure how to meet my GPL (and other licenses the various Debian components are released under) Obligations. As I understand it, I have two primary obligations to meet.   1. Providing Copyright and License Information for each component I use. As I understand it, all the information I am required to present is located in the /usr/share directory in the Debian, but since my users generally will never touch a console or terminal, they will never see this. Does providing a text file containing a concatenation of all the files inside /usr/share meet this obligation   2. Making source code available for all components I distribute. Since I am not creating the image from source, but from binary packages, I can't provide the actual source code that results in exactly my image being generated. Does providing an ftp mirror and an offer to send that mirror on DVDs of the Debian source debs for all the packages I use meet this obligation?   3. Anything Else I'm required to do to legally distribute this image?


title: Best way to search through directory structure

text: I'm working on a python program which organizes a music library. The program will basically help me detect misspelled file or directory names, wrong FLAC tags or unknown/superfluous files. It will also make sure that the FLAC files are named correctly according to their FLAC tags etc. The structure I though of looks as follows (`/` being the root of the music library):               /         [category]             [artist]                 [year] - [release]                     [track number] - [title].flac                     [...]                     [artist] - [release].jpg                     [artist] - [release].cue                     [artist] - [release].log             Various Artists                 [artist_0 [, artist_1 [, ...]]] - [year] - [release]                     [track number] - [title].flac                     [...]                     [artist_0 [, artist_1 [, ...]]] - [release].jpg                     [artist_0 [, artist_1 [, ...]]] - [release].cue                     [artist_0 [, artist_1 [, ...]]] - [release].log             [...]         [...]      I started writing some code but pretty soon I noticed that this is actually not a too easy problem to solve. I wrote 4 functions, `category`, `artist`, `release` and `file`, which are called accordingly while iterating through all the directories. Basically like that (pseudo code):               func category:         do some checks         for each file in this directory:             artist(file)          func artist:         do some checks         for each file in this directory:             release(file)          func release:         do some checks         for each file in this directory:             file(file)          func file:         do some checks (FLAC tags etc)          for each file in the root directory:         category(file)      Now I'm wondering, are there any known algorithms or techniques which could be used to solve this problem in an elegant way?


title: Why lifting of binary function into the list monads goes over all the element combinations?

text: Say, if I want to create a cartesian product of two lists, I could do (here in Haskell, but I can do the same e.g. in Scala or any other FP-able language)               cartesianProd = liftM2 (,)      then               >cartesianProd [1,2] [3,4]     >[(1,3),(1,4),(2,3),(2,4)]       Obviously, using (lifting) `+` instead of tuple pairing, will produce list of sums of all combinations. By FP definition, "lifting is a concept which allows you to transform a function into a corresponding function within another (usually more general) setting." The way I understand it, if I have monadic arguments, I can transform my binary function to work with them via liftM2. Where does the cartesian product comes from, though? Intuitively, I would expect `[(1,3), (2,4)]` from the example above.


title: PHP Interview test. Any advice?

text: I am going to be doing a short PHP test/project (20-30 mins) at an interview very soon. The job is at a junior to mid-weight salary (although no specific knowledge level is in the job spec) at a media agency. I am looking for any advice on where to concentrate my revision? Should I focus on core concepts (design patterns) or more on method syntax recall? I am not sure if I will have web access during the test, is this normal? any example of a what a small project might mean? Any advice at all would be gratefully received.


title: How to improve upon Bloch's Builder Pattern, to make it more appropriate for use in classes that may be extended and sub-extended many times over?

text: I have been greatly influenced by Joshua Bloch's Effective Java book (2nd edition), probably more so than with any programming book I've read. In particular, his Builder Pattern (item 2) has had the greatest effect. Despite Bloch's builder getting me much farther in the couple of months than in my past ten years of programming, I am still finding myself hitting the same wall: Extending classes with self-returning method-chains is at best discouraging, and at worst a nightmare--especially when generics come into play, and _especially_ with **_self-referential generics_** (such as `Comparable<T extends Comparable<T>>`). There are two primary needs that I have, only the second of which I'd like to focus on in this question:   1. The first problem is "how to share self-returning method chains, without having to re-implement them in every...single...class?" For those who may be curious, I've addressed this part at the bottom of this answer-post, but it's not what I want to focus on here.   2. The second problem, which I am asking for comment on, is "how can I implement a builder in classes that are themselves intended to be extended by many other classes?" Extending a class with a builder is naturally more difficult than extending one without. Extending a class that has a builder _that also implements`Needable`, and therefore has significant generics associated to it_, is unwieldy. So that is my question: How can I improve upon (what I call) the Bloch Builder, so I can feel free to attach a builder to _any_ class--even when that class is meant to be a "base class" that may be extended and sub-extended many times over-- _without discouraging my future-self, or users of my library_ , because of the extra baggage the builder (and its potential generics) impose on them? * * * _**Addendum_**   My question focuses on part 2 above, but I wanted to elaborate a bit on problem one, including how I've dealt with it: The first problem is "how to share self-returning method chains, without having to re-implement them in every...single...class?" This is not to prevent _extending classes_ from having to re-implement these chains, which, of course, they must--rather, how to prevent _non-sub-classes_ , that want to take advantage of these method chains, from having to re-implement every self- returning function in order for _their_ users to be able to take advantage of them? For this I've come up with a needer-needable design that I'll print the interface skeletons for here, and leave it at that for now. It has worked well for me (this design was years in the making...the hardest part was avoiding circular dependencies):               public interface Chainable  {           Chainable chainID(boolean b_setStatic, Object o_id);           Object getChainID();           Object getStaticChainID();       }     public interface Needable<O,R extends Needer> extends Chainable  {         boolean isAvailableToNeeder();         Needable<O,R> startConfigReturnNeedable(R n_eeder);         R getActiveNeeder();         boolean isNeededUsable();         R endCfg();     }     public interface Needer  {         void startConfig(Class<?> cls_needed);         boolean isConfigActive();         Class getNeededType();         void neeadableSetsNeeded(Object o_fullyConfigured);     }


title: Microsoft Certification : 70-511 Is Practice test sufficient to manage an exam?

text: After reading the Self-Paced Training kit **Microsoft Windows Applications Development with Microsoft .NET Framework 4** , I ran the Microsoft Press Training Kit Exam Prep. I would like to know if it sufficient to pass and manage the 70-511? **EDIT** Ok, I did not pass the Exam this morning. So I Disencourage people which want to pass a certification without a meaningful experience. For your information, here my result : ![enter image description here](http://i.stack.imgur.com/BmVEq.png) As we can see, I've failed in two exam objectives :   * "Building a User Interface by Using Basic Techniques" which covering these chapters :      * Choose the most appropriate control class     * Implement screen layout by using nested control hierarchies.     * Create and apply styles and theming.     * Manage reusable resources.     * Implement an animation in WPF.    * "Enhancing the Functionality and Usability of a Solution"      * Integrate WinForms and WPF within an application.     * Implement asynchronous processes and threading.     * Incorporate globalization and localization features.     * Implement drag and drop operations within and across applications.     * Implement security features of an application.     * Manage user and application settings.     * Implement dependency properties. I really don't understand why I've failed the first objectif. I think to know the fundamentals of WPF. One the other hand, I know why I've failed the second objectif exam : this is an aspect I don't masterize. This exam shows me my weakness. Now I will focus on them.


title: The Programming Mindset

text: I'm going to start off by saying that I'm in my second year as a Software Engineering major at R.I.T in New York. I had no experience programming in high school and ever since attending college I have been programming my ass off. I have had some struggles trying to think things through from a logical programming stand point and I was curious, for all of you professionals and people that have been programming from an early age: How do you approach situations? Do you get implementation ideas from past experience or does it just come to you?


title: Should I be using a JavaScript SPA designed when security is important

text: I asked something kind of similar on stackoverflow with a particular piece of code however I want to try to ask this in a broader sense. So I have this web application that I have started to write in backbone using a Single Page Architecture (SPA) however I am starting to second guess myself because of security. Now we are not storing and sending credit card information or anything like that through this web application but we are storing sensitive information that people are uploading to us and will have the ability to re-download too. The obviously security concern that I have with JavaScript is that you can't trust anything that comes from JavaScript however in a Backbone SPA application, everything is being sent through JavaScript. There are two security features that I will have to build in JavaScript; permissions and authentication. The authentication piece is just me override the Backbone.Router.prototype.navigate method to check the fragment it is trying to load and if the JavaScript application.session.loggedIn is not set to true (and they are not viewing a none authenticated page), they are redirected to the login page automatically. The user could easily modify application.session.loggedIn to equal true (or modify Backbone.Router.prototype.navigate method) but then they would also have to not so easily dynamically embedded a link into the page (or modify a current one) that has the proper classes, data-* attributes, and href values to then load a page that should only be loaded when they user has logged in (and has the permissions). So I have an acl object that deals with the permissions stuff. All someone would have to do to view pages or parts of pages they should not be able to is to call acl.addPermission(resource, permission) with the proper permissions or modify the acl.hasPermission() to always return true and then navigate away and then back to the page. Now certain things is EMCAScript 5 like Object.seal() or Object.freeze() would help with some of this however we have to support IE 8 which does not support those pieces of functionality. Now the REST API also performs security checks on every request so technically even if they are able to see parts of the interface that they should not be able to, they still should not be able to actually affect any data. The main benefits for me in developing a JavaScript SPA application is that the application is a lot more responsive since it is only transferring the minimum amount of JSON data for the requested action and performing the minimum amount of work too. There are also other things that I think are beneficial like you are going to have to develop an API for the data (which is good if you want expand your application to different platforms/technologies) or their is more of a separation between front-end and back-end however if security is a concern, it is really wise to go down the road of a JavaScript SPA application for the front-end?


title: How can I send audio input as chunked HTTP?

text: I am trying to create an interface with an external server, and don't know where to start. I would need to take audio as input to my computer, and send it to the remote server as a chunked HTTP request. The API that I'm trying to connect to is described here p1-5 http://dragonmobile.nuancemobiledeveloper.com/public/Help/HttpInterface/HTTP_Services_for_NDEV_v1.2_Silver_Version.pdf I have never worked with audio programmatically, so don't know what would be the most straightforward way to go about this? Are there solutions that exist out there that already do this? I've come across references to Shoutcast, VLC, Icecast, FFMPeg, Darkice, but I don't know if those are appropriate for what I'm trying to accomplish or not.


title: Encoding to ASCII where original encoding of string is not known

text: Given that we do not know the encoding of a string what is the best way to make sure that it is transformed to say ASCII? Also in such situations we are willing to accept potential loss of data.


title: I believe my solution is better than my boss's, so should I ignore him?

text: I'm working with php and sql. I think that my method of implementing functions is better than what my boss proposes. Just now he explained me how to do a check on a list of email addresses, and I do not like his idea. I proposed mine which is better and quicker to implement, but he disagreed. Now I think I will go ahead and implement my idea, because his idea was not clear enough to me. Do you think he will be mad?


title: In an if statement, what are an "if clause" and a "then clause"?

text: I am a bit confused about the nomenclature for the parts of an _if_ statement. Consider the following example:               1:  if condition then     2:      statement_1;     3:  else     4:      statement_2;     5:  end if;      What is the "if clause" in this statement? Here are a few possibilities:   * Is it lines #1 and #2?    * Is it line #1?    * Is it line #2?    * Is is the _condition_ in line #1? And in the same example, what would be the "then clause"?   * Is it line #2?    * Is it the _then_ keyword, plus line #2?   * Is it just a synonym for "if clause"? My main reference is Code Complete 2nd Ed., but the author seems to use exclusively the term "if clause", with the meaning being lines #1 and #2 in this example.


title: What is ServletUtilities?

text: The answer in this question suggests creating a ServletUtilities class to handle text conversion between Java strings and XML text. > Generally when you create a JEE web application you put together a class > that handles general conversions like this in a class named > ServletUtilities. I did a bit of a google for ServletUtilities, but I can't find much about it. Is having a ServletUtilities class a convention? How common is it? When should you have one? When should it be used?


title: Starting an HTML canvas game with no graphics skills

text: I want to do some hobby game development, but I have some unfortunate handicaps that have me stuck in indecision; I have no artistic talent, and I also have no experience with 3D graphics. But this is just a hobby project that might not go anywhere, so I want to develop the stuff I care about; if the game shows good potential, my graphic "stubs" can be replaced with something more sophisticated. I do, however, want my graphics engine to render something approximate to the end goal. The game is tile-based, with each tile being a square. Each tile also has an elevation. My target platform (subject to modification) is JavaScript rendering to the HTML 5 canvas, either with a 2D or WebGL context. My question to those of you with game development experience is whether it's easier to develop an isometric game using a 2D graphics engine and sprites or a 3D game using rudimentary 3D primitives and basic textures? I realize that there are limitations to isometric projection, but if it makes developing my throwaway graphics engine easier, I'm OK with the visual warts that would be introduced. Or is representing a 3D world with an actual 3D engine easier?


title: database migration: upgrade schema deployed on client machines

text: I'm working on an application, which when deployed is installed locally on client machines, and uses a local database server. Stupidly, I didn't plan for schema changes -- and now it needs to change. Perusing lots of SO and Programmers questions, and googling, I've found a few strategies:   * **many SQL files.** One for each version. When upgrading, use version number to decide which SQL file(s) to execute   * **one SQL file.** No `drop`-statements, tables created with `create table if not exists -- so when upgrading or installing the first time, simply run this file. Everything already in the db will be fine, all new tables etc. will be created   * **blow away, then rebuild db.**       1. make a copy of all the data     2. drop the entire schema     3. load in the new schema     4. reload the data   * **auto-generated diff file.** Seems to be mistrusted by some; tool for generating such a file costs money (??) I'm looking for advice to help decide between these strategies. An additional note: the data is upwards-compatible (if that's the right term): none of the schema changes involve dropping tables or columns, or changing FK/PK relationships.


title: Developing assistance tools for games, is it legal against the game creator?

text: Imagine if for a realtime strategy game, for reaserch and some fun a tool has been made which monitors the minimap of the game and warns the user if the enemy movement is being detected. Does selling and/or distributing such stuff have legal issues, against the game creators ToS or such (Considering its usage in multiplayer)?


title: Javascript frameworks for large development teams

text: My company is reevaluating what kind of web framework we want to use. We are currently using the Ext 4.0 framework but there are questions being raised that it may not be the right framework to use. I like what Ext has to offer (rich GUIs, data package and class system) are there other frameworks out there that are similar? Are there frameworks out there tailored to medium/large software companies? Info: Potentially 100's of developers converting thick client screens to the web. Data modeling is important and well as rich GUI support. Maintainability and uniformity across multiple products important as well. Any info is greatly appreciated.


title: Private interfaces within a package

text: This is basically the same as Coding to interfaces, but played out in the real world of com when there are various engineering complexities such as immutability of published interfaces and implementations, etc. * * * Consider the following situation: A OS-level object-oriented library with a set of published interfaces and an implementation provided by the OS. Some extension points are provided so that third parties can extend specific behaviors by implementing a subset of the published interfaces and registering them with the OS. A programmer looks at the whole set of published interfaces, and says to self, "it seems like I can re-implement most of the functionalities (with better algorithms), including those areas which aren't designated as extensible." And so the programmer worketh. Only when the programmer's own implementation mash up (COM-style) with the OS implementation and fails miserably, did the programmer realize that the **suite of objects** as implemented by the OS rely heavily on communications using non-published interfaces, because the published interface was minimalistic and blocked many opportunities to optimizations(*). (*) In encoding/decoding/trans-coding (of data/image/sound/video compression) tasks, it is well known that certain pipelines stages can cancel each other if they perform the exact opposite operation / inverse, e.g. `G(F(x)) == x`. A typical interaction is like:   1. Consumer asks Producer if it implements a special interface X that only vendor V knows.   2. If yes, Consumer talks to Producer using interface X and see if they are exact opposite (#1).   3. If yes, Consumer asks Producer for its "upper stage" (i.e. bypassing Producer) (#2) so that in effect both are being cancelled out. (#1) and (#2) are capabilities that are missing in the minimalistic published interface. On first glance it seems that the vendor might have a chance to provide them as well, but choose not to. It might also be the case that providing those performance-oriented interfaces would severely pollute the namespace. * * * The end result is that whenever a programmer provides its own implementation of a certain class, it would either (i) fail miserably, or (ii) perform very slowly, because it could not interact with the rest of the _suite_ using the performance-enhanced internal interfaces only known to that _suite_. Is this a more frequent problem with some flavors of Object-Oriented technology? Or is it more common with some flavors of Component-based Engineering? Advocates of OOP will argue that Refactoring and Publishing those interfaces would solve the problem. This assumes that it is possible to distribute a new version of the library along with new set of interface. For some technology this is not possible. * * * The way it matters to com is that its `QueryInterface` method allows run-time query (and run-time response) of additional interfaces implemented by a class. Its Java equivalent would be like a library that makes heavy use of `instanceof` for interfaces internal to the package. _To Reviewers: I'm open to suggestions on trimming down the question to its essence._ The correct term seems to be Mixin, thanks to this question. * * * This answer is partly relevant, but my example focuses on the lost opportunities for optimizations within a single library. Basically, if a third-party implementer didn't do both:   1. Implement both encoder and decoder   2. Implement its own proprietary interface on both the encoder and decoder, in order to detect and bypassing operations that cancel out each other Then the implementation will only get "baseline performance" when inter- operating with different encoders/decoders from other vendors.


title: Value of maintaining debug outputs

text: A developer on our team litters his code with debug outputs. He passes many parameters into methods that are only used for debugging. Personally I find this clutters up the code. If I need to debug something I prefer to use breakpoints and the watch window instead of reading through all the debug output. I am making major changes to several classes written by this other developer, should I maintain his debug outputs or can I justify removing them? I have only been in this team for a few months and don't want to upset this developer but also I expect he will rarely be updating this part of the system.


title: Licensing libraries (which do code generation, etc) and GPL boundaries

text: I want to really opensource a project that did start as a personal hobby, but I'm an ignorant of licensing details. This project, provides some libraries for a given $language, and some wrapper command line utilities for those libraries. Those libraries, across many things, do generate more code in the same language, code which can be reused by the caller. On my drafts, I always used a MIT style license for the sake of brevity, but it's unreleased copies I'm reviewing right now to merge on a finally released version. I would like to use GPL style policies for usage/contribution of _my code_ (lets call it a framework). But. Could choosing GPLv2 (3?) for my project, limit the things that a given user can do with the code generated or managed by my libraries/utilities? (i.e. commercial profit of such generated code without release her improvements/changes to my code) Is there something to consider (in a plain language) when licensing code that generates code ? **Update:** To try to answer some comments:   1. _What do you wish to accomplish with your license?_   The best goals for the project health (from the view point of a community- based opensource project).   2. _Who do you want to use your code?_   Anybody   3. _What do you want to happen to changes?_   To be back-ported to the project as much as possible.   4. _What do you want to happen to generated code?_   To don't be affected by my licensing choice. It belongs to the user who generated it.   5. _What about money - if the user makes money do you want that to affect the licensing?_   If the user makes money from the generated code, great. If the user makes money _modifying_ my code, I would like to force to publish the changes. I did a group-therapy with those answers. Now, choosing GPL (2? 3?) I could be ok or not? **Update2** > So they have to bundle/compile your library in with theirs when they deploy > it, in order for it to run? yes, the library needs to be installed previously, or bundled with the result (there is an option for this).


title: How can I monitor the JVM memory in a proper way?

text: I'm thinking of how we do JVM memory monitor in a low overhead way in production environment even under busy hour. Suppose I have two tomcat app server in production, load balance set up behind them. If I can see the jvm memory statistics I can tell load balance to stop sending the request to the server which will encounter OOM issue. Do this make sense? Jconsole or VisualVM eats more performance resourse is not my choice.


title: GUI programming - who should be an owner

text: I know nothing about gui programming. I try to learn. I have simple question... For example, I have small program. I have class that extends JFrame with main Window (MyWindowClass) and my "logic" class (MyClass) that do something (for example calculate something and I want to display it in window). Should I implement this like:               class MyClass {         // ...         // ...         MyWindowClass window;     };      Or like this:               class MyWindowClass extends JFrame {        // ...        MyClass c;     };      I don't know which class should be an owner and which class should be have main method... Please help me... I try to write in Java (Swing) but this is general question I guess.


title: What copyright date for an update to an open-source project from last year?

text: In 2011, I released some open-source code that was licensed using the Apache license. As such, all the source files have this boiler plate message at the top:               /*        Copyright 2011 My Name             Licensed under the Apache License... <blah blah>     */      So now it's 2012, and I am readying to release a version 1.1. As such, most all of the source files have been touched in some way. And some new source code files have been added. How do I update the copyright date on the existing files? Is the following the correct update to each source file? (i.e. change 2011 to "2011-2012")               /*        Copyright 2011-2012 My Name             Licensed under the Apache License... <blah blah>     */      Do the new source files get `Copyright 2011-2012` applied equally as well? Or does the new code just get `Copyright 2012`?


title: Branching strategy for parallel development that won't be in the same release?

text: My team is working on a product, which for business reasons needs to be released on a regular schedule. An issue has arisen where we want to do development in parallel for the upcoming release, as well as the 'next' release. This is to become standard practice, so it's not as straightforward as cutting a feature branch for the new work. We'll continually have 2+ teams working on different releases of the same product. Is there an SCM best practice for this sort of arrangement?


title: What are the advantages of using a template language?

text: I work on a CakePHP app and the views consist of raw html with embedded php echo statements, which over time has gotten rather messy. Before I go in and rewrite the code, I'm wondering if it makes sense to rewrite the views with a template engine, such as Twig or Smarty, but I don't have experience with template engines. What are all the advantages of using a template engine?


title: Constructing a Finite State Automaton

text: I have an exam question that I am unsure of the answer. The question is: > In organisation X valid user names have the following structure. The user > name can be either the employee’s name followed by a colon and then the > department name or a string of one or more alphanumeric letters consisting > of lower case, upper case letters and digits from 0 to 9. All user names end > with a period ("."). The employee’s name is expressed as ﬁrst name followed > by an underscore and then the surname. The ﬁrst name and the surname must > begin with an uppercase letter and is followed by an arbitrary number of > lower case letters. All department names are an arbitrary number of lower > case letters. Express the language for valid user names as a regular > expression. The answer I have is, > [A-Z][a-z]+"_"[A-Z][a-z]+":"[a-z]+"." | [A-Za-z0-9]+"." The next question is: > Construct a deterministic ﬁnite state automaton for recognising the user > names as described in Question 1. For which I have this:![finite automata](http://i.stack.imgur.com/4ukWq.jpg) I am under the impression this is wrong because [A-Z] is a subgroup of [A-Za-z0-9] and a DFA cannot have the same symbol going from one state. Does anybody have an idea how to solve this / is it correct? Thanks !


title: How is an IDE compiled?

text: I'd like to know the general procedure of how an IDE is built/compiled/created. Additionally, what are some tools/scripts used to create an IDE? I don't mean to say that compiling IDE **needs** an IDE. It was just a general assumption made by me that since IDE is just a piece of software too so it sounds logical to me that they may use the previous version of IDE to build the next one. I want to understand how the IDEs are built.


title: Anybody use the Team Software Process (TSP) and/or Personal Software Process (PSP)?

text: More info on it here: http://en.wikipedia.org/wiki/Team_Software_Process What has your experience been?


title: Concepts: API Level Testing

text: I'm college grad, soon to be graduating. SO i have started my job search. So my question is for New Grad who is interested in QA (API Level testing in particular). What is level of knowledge in **JAVA** required? I'm not that great in Java but can rate myself 5/10. So do companies expect candidate to have extensive coding knowledge in java or just basic java Again if its just basic java, what concepts should i focus more on ? Thanks


title: How to update a file in exe

text: I am converting HTML5 file to .exe using HTML EXECUTABLES converter. After converting to exe, the total size comes around 70 to 80MB. So the problem is when i update a single CSS file I have to convert the whole project again to a exe and give it to my Client and every time i have to upload 80MB file for very small changes. Is there any other alternate option to update a certain file instead of converting again to exe.


title: Python datetime timedelta attributes

text: In the python `datetime` module, `timedelta` objects take weeks, days, hours, minutes, seconds, and microseconds as arguments upon instantiation. However, after the `timedelta` is created, the only two attributes it has of the former listed are days, seconds, and microseconds. Why is this?


title: As a solo developer, how can I use a whiteboard in programming effectively?

text: I have been programming for a while and I often find myself writing my thoughts down because I've found that it helps me to focus on the solution. It feels like I am wasting a lot of paper. On the other hand, I feel insecure about getting a white board installed in my personal cube because it feels like a whiteboard is more specifically used to discuss solutions with other developers. What is your experience with note taking? Is a whiteboard useful outside of collaborative situations?


title: How do you track common, but rarely used code?

text: General OO teaches us to encapsulate and best practices teach us organization. So we end up with re-useable self-documenting code that relieves us of any details regarding implementation. So, if I need to invoke the windows command line I use my command line class.               class CommandLine     {        CommandLine(){}        Invoke(string command) {}        CloseAsync(){}        Close Sync(){}     }      Over time these simple encapsulations turn into libraries. We may even have further classifications via Namespaces. This works very well in the same language. Especially when its a language the developer commonly uses. But, I often run into situations, especially in lesser used languages, where I need to recall a simple common concept that may not actually be a class at all. For example, I don't write a lot of jQuery, but I write enough where I get tired of looking up the proper syntax for `$(document).load`...or is it               $(document).ready()      or...               $(document).read(function(){});...      This kind of boiler plate code, which I understand well the purpose of, but lack the experience and regular usage of the language to remember the syntax is where my problem lies. I have seen some developers write a blog to simply remember the idea. My usual approach is... > Google "document load"   >  GOogle "document load jQuery"   >  ...find some snippet   >  Google "Document Ready jquery"...done   > And this has usually been fine. But, I have also noticed that on SO, some of the top answerers, say Jon Skeet, seem to pull boiler plate answers very quickly...so quickly I wonder if they have built up some sort of reference material to quickly search and slap together this code on the forum, piecemeal or in full. I would like to use this same concept (if it exists...) to store my "document.ready" snippets so that I may use them for my own coding. So, does an effecient storage and lookup exist?   What is the best way to store and organize these irregular, but common useful snippets? Bonus...its even more interesting to note how my coding approach does not lend itself well to white-board interviews (where we have no google, but are expected to write code). How do you handle this issue when facing the "lesser used" languages in your vocubulary?


title: May I keep my program closed source if I link it against a static library of which the source is GNU GPLv2?

text: I'm putting much work in my program and after it's done I want to just setup a small website and sell each copy of the program but I don't want any legal issues. Do I have to look for another library or can I "safely" link to it?


title: Relicense BSD 2/3-clause code to GPL

text: Suppose I release some source code under the new BSD license. Is it allowed for someone else to take this code, make modifications to it and distribute it under the terms of the GPL? From Wikipedia: > _Many of the most common free software licenses, such as the original MIT/X > license, BSD licenses (in the current 2-clause form), and the LGPL, are > "GPL-compatible". That is, their code can be combined with a program under > the GPL without conflict (the new combination would have the GPL applied to > the whole). However, some free/open source software licenses are not GPL- > compatible._ I'm assuming this implies that one can relicense new-BSD licensed code to GPL?


title: Proper Use Of HTML Data Attributes

text: I'm writing several JavaScript plugins that are run automatically when the proper HTML markup is detected on the page. For example, when a `tabs` class is detected, the tabs plugin is loaded dynamically and it automatically applies the tab functionality. Any customization options for the JavaScript plugin are set via HTML5 data attributes, very similar to what Twitter's Bootstrap Framework does. The appeal to the above system is that, once you have it working, you don't have worry about manually instantiating plugins, you just write your HTML markup. This is especially nice if people who don't know JavaScript well (or at all) want to make use of your plugins, which is one of my goals. This setup has been working very well, but for some plugins, I'm finding that I need a more robust set of options. My choices seem to be having an element with many data-attributes or allowing for a single `data-options` attribute with a JSON options object as a value. Having a lot of attributes seems clunky and repetitive, but going the JSON route makes it slightly more complicated for novices and I'd like to avoid full-blown JavaScript in the attributes if I can. I'm not entirely sure which way is best.   1. Is there a third option that I'm not considering?   2. Are there any recommended best practices for this particular use case?


title: What is the advantage of assigning a function to a var?

text: Given this Javascript example I found               var sum = function() {       var i, sum = 0;       for(i = 0; i < arguments.length; i += 1) {         sum += arguments[i];       }       return sum;     };      What advantage is there in assigning a function to a var?


title: What is the best way to diagrammatically represent a system threading architecture?

text: I am yet to find the perfect way to diagrammatically represent the overall threading architecture for a system (using UML or otherwise). I am after a diagramming technique that would show all the threads in a given system and how they interact with each other. There are a few similar questions - Drawing Thread Interaction, UML Diagrams of Multithreaded Applications and Intuitive UML Approach to Depict Threads but they don't fully answer my question. What are some of the techniques that you've found useful to depict the overall threading architecture for a system?


title: Where should I put my utility methods?

text: I am very new to Visual Studio and C# and am wondering how best to create a repository of sorts for utility methods. For instance, we need a method that returns the current fiscal year and other company specific values. Would it be best to create utility class file that is imported into every project? Or, create a new project with the these methods and add it to the current solution? In python, for instance, I created an egg that has all the utility methods that I then install into the site-packages.


title: What research topics can I tackle with only a year of experience?

text: I've been looking to get into research, but I'm not sure I can do when I've only taken two quarters of Computer Science. I go to the University of Washington, if it's relevant. This is a page on research. I find that I'm not able to judge what is possible for a first year looking through the website. Most things look intimidating, but I'm sure I could somewhere on some problem if I actually attacked it.


title: Whats the work flow with 2 people on a project

text: I come to you as a newbie programmer who's been working on his own project (which is progressing nicely). My co-founder has also been learning how to program and has reached a point where he could probably start fixing some things and making some things happen. He asked a very good question, which was "how will this work". Something I could only theorize about as I've never programmed with someone else. Could you advise me on the best work flow. We use git. Should we own specific parts of the system? Checking code in? Code review? How do you work with >1 dev?


title: Learning Groovy vs learning Python, Ruby or Perl to get some insight on dynamic languages programming

text: I would like to explore programming in dynamic languages, and I found that Groovy would be really easy to learn because it is heavily based on Java. won't I miss anything important regarding dynamic languages proggramming if i take Groovy path instead of say Ruby or Python? I don't intend to program in dynamic language too much, it is mostly for learning purposes. thank you for help.


title: Shelving code in Team Foundation Server (TFS)

text: I'm pretty new at using TFS and I'd like to know how you or your team use the "shelve" function of tfs. We have the following guidelines in using TFS: \- perform a "Get Latest" before you check in and try to build/compile \- do not check in code that does not compile \- at the end of the day, if your work is not complete/partially done, you should "shelve" your pending changes The first two make sense but I don't really get the last one. I asked my mgr and he said that its so he knows that you actually did some work for that day, which does kind of makes sense but still, I'm wondering what other teams use the "shelve" function for?


title: How do you think about and architect programs?

text: I'm a QA guy and designer and i'm coming to development. How do most developers architect programs? With design I build up with a vague idea of what I have in mind and adapt my design to keep in moving forward and looking good. With coding, I'm trying the same methodology. I'm constantly testing and debugging my code and I make forward moving tweaks to my code. The problem is, I dont think this is how it's done. When I look at good Javascript for example, everything is broken out into evenly distributed functions. I don't architect my code in this way. Do you normally have to sit out and draw out your classes and functions before you start writing?


title: Best way to handle product and supplier relationship

text: > **Possible Duplicate:**   >  best way to handle a many to many relationship? The relationship between product and supplier is many to many with a new class to be created? Or is it many to 1?


title: Best practice mapping an external id on my system

text: I've done some searches for "id mapping" and "external id mapping" and I can't find anything meaningful on the site or google, so, here's my question/scenario. I'm developing an application which will match some records from our internal system with the "same" records from an external (outside the company) system. The data-exchange (receive the data from external system) is irrelevant (could be TXT, CSV, XML, Excel, etc...). At some point I'll have to match our internal customer id with the external customer id. The thing is: I know **my id is immutable** , but **I don't know id the external id is mutable**. And there's no way to know, because the external system is out of my control and can be changed without my knowledge anytime. So I have 2 scenarios:   * Best case: the external ID is immutable;   * Worst case: the external ID is mutable (within the constraints below); So I'm developing a mapping table with the following attributes:   * Internal System Customer ID;   * External System Customer ID; Pretty standard stuff. The real question is: **What should I add on this table in order to prepare for worst-case scenario ?** Constraints:   * If the ID is mutable, it'll be on a daily basis, so there can't be a 1-to-many internal-to-external ID on the same day (this is a business rule that can be enforced);   * The external ID can be anything from an integer to a GUID or a zip-code. But nothing bigger than a GUID;


title: How should dependencies be managed across a modular application?

text: Let's say that we have a structure like this:               Application         -- Modules             --Module1                 -- Controller                 -- PublicHelper                   --Module2                -- Controller                -- PublicHelper      Whereby a module's Public Helper can provide helper functions. In nearly every module helper, the helper needs to access another module's public helper methods. Let's say for instance, in a PHP application: Module1 provides functionality to create a sale, and as part of the               class Module1PublicHelper extends AbstractModuleHelper {              public function createSale($customerId, $param, $param)         {              $userPublicHelper = // grab an instance of the user public helper              $currentUser = $userPublicHelper->getCurrentUser();         }     }          class Module2PublicHelper extends AbstractModuleHelper {              public function getCurrentUser()         {              //do something              return $user;         }     }      In this situation, the method needs to obtain an instance, either new or whatever of the user public helper. Given that all of Module Public Helper classes are instantiated with a minimum set of constructor params, e.g. EntityManager, what would be the best way to get a copy of it? Obviously, we can't really inject the user public helper class into the class containing `createSale` One solution would be to use a service locator or registry, however, testing the application isn't exactly easy.


title: Should a developer always use version control

text: > **Possible Duplicate:**   >  Version control for independent developers? I've heard statements to the effect of: "Well it's just me working on this project so I don't need to put it under source control" as well as, "There is no need to work version controlled on this project, it's so small". It is my opinion that no matter how small the project is, so long as it's adding value to the client (and they are paying for it too) that we, the developer(s), should version control it; especially since its company policy. Am I insane or does my standpoint make sense. Question: Should development work always be version controlled?


title: how do you backup your code on your local computer?

text: > **Possible Duplicate:**   >  Version control for independent developers? I have a folder containing all my code (working code, experiment code). I'd like to back it up to a zip file on an external hard drive or whatever is best. How do you guys backup your code?   Do you setup your own source control server?   Do you use a script to zip all files?


title: Version control for independent developers?

text: Do you think it's worth it to use version control if you are an independent developer, and if so, why? Do you keep the repository on your own computer, or elsewhere, where it can serve as a backup?


title: Team of 1: Do I need Project Management & Versioning Software?

text: > **Possible Duplicate:**   >  Version control for independent developers? I work as a Junior Programmer in a team of 1. I am looking for suggestions of what open source/free Project Management(I cant remember the correct term?) programs, ie things like Github would be suitable for my & the companies needs. I create websites using just javascript, HTML & CSS, I create cross platform mobile applications using Mosync C++ API & I create Facebook iFrame apps using HTML, javascript, css & their Graph API. The boss is really not willing to purchase a subscription from a "Project Management Program"(BTW whats the correct term?) so I would be looking for a free service. I currently use DropBox because it allows me to work from anywhere & gives a limited ability to go back to an older version of a file but I have found that I have made a change in a project & it broke something else so I needed to go back to the old version of a file & it was not there in dropbox(maybe they only keep the last version before a save). **If you were on a team of one do you think it would be necessary to even use this? And if yes, what service would you use?**


title: What is the best local version control tool for personal use?

text: > **Possible Duplicate:**   >  Version control for independent developers? I was wondering if there is a tool out there which acts as Visual Source Safe but only on local machine. Basically I would like to check in and check out on my local machine when I am codeing on my personal project from home.


title: Version Control for One Man Dev Team?

text: I recently began work at a small company as a lone software developer. Before I came no true documentation/version control/etc. was in place. The best they have is Microsoft Word documents and Excel spreadsheets to keep track of everything the engineering team produces. Personally, among other things, I'd like to institute version control for my own sake, but they're extremely hesitant about it. My question, is version control sane for a lone developer? What are some of the benefits of version control to a lone developer? Also, what are some of the benefits to, say, a 2-3 man team? And, being that it is a private company, would Github or a private Git server be best?


title: Should I use a code repository if I am the only one working on a project?

text: > **Possible Duplicate:**   >  Version control for independent developers? I am not sure if I should use a code repository when I am the only one working on a project.


title: Infix vs Prefix Notation - Which do you prefer?

text: I have been learning Clojure and looking at Scheme and CL which introduced me to the world of prefix notation. At first I didn't like it but it is still starting to grow on me. To be honest though, there are still long calculations that are difficult for me to understand but I think that is an issue of me needing more exposure/practice and I'll get it. But that leads me to the question: Which type of notation do you prefer and why?


title: Is there a name for the not given/null/empty-problem?

text: I work with code, where data is stored/exchanged in Hashtable/Dictionary/Associative-Array-like structures, like this               {        'alpha': None,        'bravo': '',        # 'charlie' is not given     }      there is not much standartization, which field is 'given', and when given, if it may be given as None/Null/Nil or an empty string. As a result, the code is littered with checks like `if hasattr(obj, 'alpha')` and default fallbacks. **Is there a name or slang term for this kind of (imho) anti-pattern?** UPDATE: it seems, currently there is no name, so i'd like to hear suggestions. Currently we have these:   * Incorporeal Horde (credits to psr)


title: Security concern regarding web service

text: I'm currently working on a pet project with two of my buddies. This web service will provide basic functionality such as Login/Password Modification/Registration etc. All of us are comfortable with jQuery and ASP.NET. My friend's idea is to - `Set up a web service on the same domain and send it data for registration, validation and password retrieval through jQuery ajax.` This same process is going to be used for other CRUD ops as well. I'm not sure though, isn't this a huge security risk? Couldn't a normal person write some code that could create thousands of dummy users in our application? Would setting up a secondary web service that handles authorization (OAUTH 2.0 or something like that) and calls the web service that connects directly to the database reduce the security risk?


title: How to structure a program into classes

text: So after a while of working in programming field I still haven't figured it out how exactly should programs be structured, in a large set I mean. Which I think it's also because of working in an enterprise development. Say that I want to write a program, a messenger for a LAN network. How do I really know what classes to make for this program? How to divide the program into smaller pieces and classes in the best and most efficient way? This is just an example. I don't mean specifically for this problem set, it's the general approach that I am wondering about. EDIT: I have asked this question here because it exactly says in the help center: > What topics can I ask about here? > > Programmers Stack Exchange is a Q&A site for professionals and students in > software development and related fields who are interested in getting expert > answers on conceptual questions about software development. > > If you have a question about... > > software requirements > > software architecture and design > > algorithm and data structure concepts My question, according to my understanding, refers to the to the _software architecture and design_. It's not a specific coding question otherwise it would have been asked on Stackoverflow. It is a **conceptual question** which should be fit here. The comments and answers are referring to that there are a lot of books covering this topic. I'd accept even a book name for an answer if the book answers my question. If the answer does not fit into this form of Q&A, at least I could be pointed to the right direction. After all we're all here to learn something.


title: Finding all nearby points in a point cloud

text: What's the best way to store 3D point cloud data, optimising for time it takes to find **all** the points in a sphere of 3D space, and also for time it takes to insert new data points into the data set? Background: I have a cloud of 3D point data (with each point also including some further attached data), and need to be able to query it to quickly find all the points within a user-specified sphere of 3D space, as well as to quickly add points to the data set. My current implementation uses a naive linear array of data points, but unsurprisingly, that's not scaling well as my data set grows. My priority is speed, both for finding points in the cloud and for inserting new points into the cloud (I'd really like to avoid needing to rebalance trees after every insertion, if I can). I never delete points from the data set, so speed for point removal isn't important at all. Memory usage also isn't important -- I'm quite happy to throw memory at this problem, if it'll speed things up!


title: ROI in choosing a CMS solution

text: At the company I work for we need a CMS. We have to choices, first one, work with an existing CMS ( Drupal, Joomla, whatever ) or develop our own. I know for sure that developing our own is the right approach. We need all the flexibility we can get, and developing our own is the best way to accomplish this. But I need to sell this based on ROI to upper management ( my boss ). Basically in terms of time and money. I can convince upper management that developing our own is the best way to go even without mentioning ROI, but I would also like to present this data to him. So I'm trying to investigate on the ROI of using already existing CMS solutions VS developing our own customized CMS ( based on a open source library or not ). After a search on google I found this: Choose between a commercial, open source, or customized CMS, but the link is from 2003, it has some truth's, but the world changed a lot from 2003. And I can't seem to find anything else about it. I've developed my own CMS ( actually I'm still developing it, it's always a work in progress ), so I know it's not the most easy thing to do, and that it takes time. Can someone give me any tips? On the ROI of one solution VS the other?


title: A new language's chances

text: I am creating a new language, with some nice features like OOP, static typing, imperative, etc. The main reason for making a language was to learn more about compiler construction. My question is, what are the chances for my language to be known? What can I do to make my language used by many? I know there are lot of similar projects, and much better than mine, but I want to make this project a success. The project is almost completed. I think it comes with useful tools such as automatic memory allocation, memory manager, pointers, and few others. I would like to know if my project can have a future or shall I just drop it like many others? Thank you.


title: Working with static constructor in Java

text: I didn't get a complete understanding of static constructors in Java. If it is allowed, why it is allowed? In what scenarios would you use it? What purpose would it serve? Can someone give me a simple example please?


title: How to become comfortable with javascript and its libraries(jQuery)?

text: I am a php lover,working with php for last 2+ years also freelancing in different php producus like wordpress,joomla,drupal.I feel comfortable with php, I tried to learn javascript and its other libraries but feeling uncomfortable.Can not become productive also. So would any one give suggestion how i can learn the javascript?


title: Secure Open Source?

text: I want to make a delicate application of mine (an antivirus actually) open source but I want to have a control on who really obtains the source or not. Preferably they should apply and I or administrators approve their applications. Is there any online platform for this? The main reason for the control/security is to possibly prevent malware makers to easily discover how to bypass the stealth checking methods it utilizes for malware detection. Edit: I am looking for advice - possibly to hear from someone who has done something similar. Thanks!


title: License compatibility question

text: I have a question regarding software licenses. I plan to put a license to a framework that I have written. My intention is that the license should be open, in order to maintain a community. To be clear I will explain how I expect things to work. The framework will define some common API for certain functionality as well as a Proxy class that will invoke an implementation of that API. The proxy will be part of the framework, but it will internally call an actual implementation which will be developed mostly by someone else. So, basically I want to be able to:   * Distribute my library as free and open-source   * Allow use of my library in commercial software   * Allow commercial products to depend on my library i.e. provide a derived work as long as it is a result of linking to my framework API (not using the source code directly in (un)modified form), and license their derived work as they choose.   * Provide legal means of respecting the licenses of any third party implementations invoked trough my library. This means a commercial application should be able to use my library an another commercial library designed to work with my library as long as it respects my licensing terms and those of the other commercial license.


title: TDD: Write a separate test for object initialization or relying on other tests exercising it

text: This seems to be the common pattern that's emerging in some of the tests I've worked on lately. We have a class, and quite often this is legacy code whose design can't be easily altered, which has a bunch of member variables. There's some kind of "Initialize" or "Load" function which would put an object into a valid state. Only after it is initialized/loaded, are the members in the proper state so that other methods can be exercised. So when we start writing tests, first test is "TestLoad" and all we put in there is exercising initialization logic. Then we might add one (or few) TestLoadFailureXXX tests and those are definitely valuable. Then we start writing tests to verify other behaviors but all of them require the object to be loaded. So they all start by running exactly the same code as "TestLoad". So my question: Is TestLoad even necessary? Do you take it out and let other tests simply exercise the loading? Or leave it so things are more explicit? I know that each unit test function should have no (or as little as possible) overlap with other test functions, but it seems like in cases of loading, this is unavoidable. And whether we like it or not, if something in the loading code breaks, we will end up with a whole test suite of failures. Is there another approach that I might be missing here? * * * Thank you for the responses. It definitely makes sense that you want to see "InitializationTest" and if that fails you know where to start looking. In case it matters, this question is mostly about C++ and we use CppUnit framework. And now, thanks to sleske, I'll be constantly wishing that CppUnit supported test dependencies. Might have to hack something in one of these days :)


title: Is python a good choice to develop UIs? If so, wxPython or Tkinter?

text: I am looking forward to develop a desktop application using python. I am a beginner and I do not have sufficient expertise in python. I am a java programmer. Although I have some experience in building UIs using swings, I see that apps developed on swings are too damn slow. Well this might be one reason why many of the major implementations are done in C/C++ as in browsers/games etc. Developing a UI in C++ might be a better option but I prefer to chose a high level programming language over C/C++. So I have opted for python presuming that it would perform well over java swings as python itself is natively build on C/C++. So can I go ahead with this assumption that python is better than java swings to develop a UI? Or do you suggest a language that is better than python to develop UIs? If at all I go ahead with python, which toolkit should I use Tkinter or wxPython and why? please help me.


title: What does "abstractions should not depend on details" actually mean?

text: Most readers will be familiar with Bob Martin's famous dependency inversion principle, which states -   1. High-level modules should not depend on low-level modules. Both should depend on abstractions   2. Abstractions should not depend upon details. Details should depend upon abstractions I believe I understand it all pretty well, except for the first sentence in the second line - "Abstractions should not depend upon details". What does this mean exactly? What would be a simple example of an abstraction being dependent upon a detail?


title: How should an undergraduate programmer organize his time learning the maximum possible?

text: I started programming lately(pre-final year of a CS degree) and now feel like there's a sea of uncovered treasure for me out there. So, I decided to cover as much as is possible before I look out for a job after graduation. So, I started to read books (The C++ Programming Language, Introduction to Algorithms, Cracking the Coding Interview, Programming Pearls,etc ) participate in StackExchange sites, solving problems (InterviewStreet and ProjectEuler), coding for open source, chatting to fellow programmers/mentors and try to learn more and more. **Good,then what's the problem??** The problem is I am trying to do many things, but I am doubtful that I am still utilizing my time properly. I am reading many books and sometimes I just leave a book halfway (jumping from one book to another), sometimes I spend way too much time on chatting and also in getting lost somewhere in the huge internet world, and lastly the wasteful burden of attending classes (I don't think my teachers know good enough or I prefer learning on my own) May be some of you had similar situation. How did you organize your time? Or what do you think is the best way to organize it for an undergraduate? Also what mistakes am I making that you can warn me of


title: How do I implement classes in my scripting language?

text: Let's suppose I have a code file that reads (I'll use Java-ish syntax) and it is being interpreted. Kind of like a ruby script.               class A{         int fieldName = 4;         A(){...}              void doSomething(){...}          }          A instanceOfA = new A();     A.fieldName = 7;      This is what I understand to happen when this file is interpreted.   1. File is lexed and parsed   2. AST or Parse tree is generated   3. Parse tree is walked to generate code in the runtime to represent the class.   4. Then what happens? How is the definition turned into an instance? And what kind of internal representation is require to represent the class? Does the interpreter keep the AST for the class around for re-processing each time an instance is created or is some other form created? I've been following the patterns in Terrence Parr's Language Implementations Patterns book. I think understand how to build the symbol table and scope objects. I'm just a little fuzzy on how take a structure like a class and create an instance of it.


title: How to define a natural id in database?

text: There are a lot of manuals. I am trying to create an database to hold information of these documents. But, there is a small problem. How can I give meaningful id to the manuals? Are there any standard or logic behind the giving meaningful id to the documents? If there is no standard, can you tell me how I should do that? example:                table :                   manual id | manual name      EDIT:               Not Meaningful ID                1        or  M1        or   foo          2            C2             bar          3            P123           name         ...           ...            ...          (i)          (ii)            (iii)      (i) Not meaningful for me because if some item deleted, there can be gap. ex 1 33 100. (ii) random character can be confusing when one try to give a name to new manual (iii) Why giving name is not preferred is because finding a name to the manual as ID is hard after 500 manuals. Meaningful : New ID               * Can be easily produced even if after 1000 manuals     * Should not be so complicated


title: Need an open-source license with a small commercial addition

text: I'm working on an open-source project and people can use it and modify it, no problems here. The only thing that I don't want to allow is that people exploit it and earn money using my work (because that's what my plans are!) What kind of license should I use to cover these requirements?


title: How many threads should access the file system at the same time?

text: We have a module in an application which stores data in multiple files and multilevel directories and access them from multiple threads (both reads and writes). The directory structure is based on a splitted hash value, like:               b1/94/6a/92/a.txt     b1/94/6a/ee/a.txt     a1/0e/db/bb/b.txt     ...      If a caller removes a file the module deletes empty directories immediately. How much should be the concurrency level of the module? Is it worth to create and delete folders from multiple threads at the same time? Can filesystems handle these effectively? Is it worth to use a multi-threaded module? (It would be much easier to write a single-threaded one.) (The application is written in Java and mainly runs on Windows, NTFS, non-SSDs but I'm also interested in other operating and filesystems if there are differences.)


title: What would you avoid re-inventing at all costs?

text: We recently had to re-invent a high-availability queueing engine like RabbitMQ (for various reasons). Naturally this turned out to be more time consuming and expensive than expected. What type of things would you avoid rebuilding at all costs? Which types of components should rather be reused?


title: How to describe styles and approaches of C++ programming?

text: How can I say more than just "C++" on my resume, reports or other writings, to convey clearly what kind of C++ programming I've been doing? Are there well-defined styles of C++? ("Styles" might not be quite the right word.) Examples: using C++ as an "improved C" taking advantage of stronger typechecking, syntactic niceties, but little or lightweight use of classes; using heavy OO techniques where almost everything is made into a class (and there could be different styles of that) - but staying away from templates and advanced techniques; and heavy use of metaprogramming and every cutting edge advanced C++ feature. I've seen code where there's such heavy use of computer science terminology and advanced features only a CS PhD would be able to understand it, and code so clean and straightforward that EEs and physicists with modest programming skills can understand it. This isn't about literally coding styles - fussy details about brackets, indentation, commenting and all that - but one's philosophy of what good code is, the approach to organizing it all, and degree of fanaticism or reluctance to use various major techniques, procedural vs OO vs functional and so forth. Can such variations be categorized in a meaningful way? How to name these for someone not expert at software development, with an amount of knowledge to be expected of a good executive or recruiter (never mind the PHBs)? Ideally, there'd be a way anyone can say on their resume "C++ in blah-blah style" or "mumbleific C++" and land jobs or freelance projects in that category/style of C++. An improved-C++ coder could avoid projects full of heavy template-bloated code. (To some extent this question may be more general than C++, but C++ being around for years and being multi-paradigm, leads to the most confusion.)


title: Changing jobs and leaving a project without a leader (aka, me)

text: > **Possible Duplicate:**   >  At what point during a project is it unreasonable to leave? I'm the lead on a project that has been underway for about a year and a half. Two of us have been working on it. One is the database guy. I'm the javascript/ui guy. Which is to say, essentially no overlap in code knowledge. Here's the thing. Someone is about to offer me a sweet job with a nearly 30% bump in pay. Though I am perfectly happy with my current job and love the project, the new one would be better and I can't imagine saying no. The big problem is that my project is supposed to go into production starting in a few weeks. I will consider the new guys to have disqualified the new job by being bad people who would ruin my life if they won't cooperate and let me start after deployment. Since they seem like decent, ethical people, I don't expect that to be a problem. The current project will be brutalized by my absence. I take some comfort in the fact that I have emphatically requested an understudy for at least six months. That puts a little of the responsibility on the boss's head, but still, it's going to be a really bad thing. What do others of you do when you are a critical to a project when it's time to move on? Do I owe any obligation to stick around even though something better shows up? I know my spouse would object if I found someone else. Does that apply to work? I do have an understudy now, though he's fresh out of college. He's not going to replace me anytime soon. It's a small shop and the boss is going to be crushed. I am traumatized in anticipation of telling him and feel guilty about the practical consequences. I'm looking for some solace and some strategy about how to deal with this transition. Thank you for listening. =========================Subsequent notes ========================= @ChaosPandion, Chance: No, I can't stay to finish the project. I will insist on a compromise where I finish the current sprint (about a month from now) but there is at least a half year, probably a year of solid, full-time, work still to be done. I wouldn't expect the new employer to hold the job that long.


title: How you return to a code when you don't remember what you were doing?

text: Well, I have some problems with procrastination and whatnot, but those get infinitely worse, when I cannot remember what I should be doing. I mean, I know my project, I wrote 100% of the code so far, and I knew more or less what I was doing, but I don't remember exactly what, I don't remember what file I was editing and why. How I get back on track? (because right now my technique of opening the source code and staring at it is not working)


title: An example of a beginner-level Algorithm, intermediate level Algorithm and a complex/expert level Algorithm?

text: I'd like to get a sense for the range of complexity that algorithms fall into. I think it would be interesting and helpful for those, like me, trying to better understand how algorithms are formulated and how to deconstruct them. Can you offer a basic algorithm with explanation, an intermediate algorithm with explanation, and maybe an expert level one (with or without) an explanation?


title: What can I do to make sure my code gets maintained in a developer light environment?

text: I am a contract data analyst, so I bounce between jobs every 3-6 months, which I find to be a good fit for me, but it leads to some problems when it comes to coding. I mostly do statistics (I've asked a similar question on cross validated, but the answers there are not relevant here), but I have also found out that the business world loves excel and loves copying and pasting the same thing over and over again even more. This led me to learn how to write VBA scripts and then VB.NET programs to automate as many of these reports as I can. I am certain my programs are not the most elegant, but I put a good bit of effort into making sure they work under as many cases as I can test, I add in exceptions and try to code so the program can handle changes in the files that it processes, but there is a limit, if you remove a huge portion of the data, there is a good chance my program is going to trip up, which I accept will inevitably happen. Usually a pretty minor change in the code fixes the problem and I do try and comment my code and make it readable under the assumption that some other person will have to read it some day. My problem is that I generally get put on teams of folks with essentially no experience with programming (like VBA would be a huge stretch for anyone I work directly with). I am wondering what I should be doing as the person that wrote the code to do my best to keep it maintained. I have two approaches in mind (outlined next), but would be very happy to get any advice. Solution 1: Find the more tech savvy coworkers and run them through the programs and what basic changes can be made. Honestly automating excel is about as easy as it can get when it comes to programming, so I feel like I could teach someone the basics of maintaining it pretty quick. Solution 2: Get in touch with the IT department and show them what is going on and maybe they will be able to help. The problem here is that the IT department is constantly swamped (as I'm sure many of you know) and I feel like kind of a jerk for dumping more things on them. I do leave my personal email address with places and am willing to answer quick questions via email, but I view the need for more exhaustive maintenance as something of an inevitability and would like to make sure I do my due diligence to make sure it gets done. I imagine some combination of the two approaches outlined there, but is there any kind of heads up I should give IT? I feel like I would be annoyed if I started getting requests to fix a program that I had never seen from some random guy that is no longer there.