title: How to maintain lots of different variations for deployment, using Git for development

text: Although there are many similar questions here regarding using GIT for maintaining different versions, none seem to answer my specific case. I'm OK with how to use GIT to do my development, using different branches to do hot fixes, versioning etc. However, I am making a commercial application that needs to track various modules and configurations for **DIFFERENT** clients. And I do NOT wish the client to have access to a module or code they haven't paid for. Yet I would like to use GIT to deploy on their server, or to be able to deploy directly on the client server using ssh/rsync, or even on my server in a unique directory, then zip up the source files using a standard process. Let me give you an example: Client A:   * Deploy basic application   * Deploy Module A (e.g. forum) only   * Deploy Client A specific theme with Client A specific logo Client B:   * Deploy basic application   * Deploy Module A (e.g. forum)   * Deploy Module B (e.g. faq system)   * Deploy Client B specific theme with Client B specific logo Development Server:   * Contains basic application   * Contains Module A (e.g. forum)   * Contains Module B (e.g. faq system)   * Contains Client A and Client B themes with all logos   * Contains Development Notes which must NOT be visible to client   * Contains build files used with Phing - these must NOT be available to clients It's very important to understand that GIT on the development server contains proprietary data for Client A and Client B. Therefore Client A must never see my development notes, my Phing build files, Module B (faq system) or code/data/images for Client B. I do not need to keep variations of a module or the basic application for individual clients. Everything is standard across the system, and it's only the deployment configuration/variation for each client which is unique. I am happy to use GIT Submodules to keep some parts separate, if that helps. Note that all my code is in PHP and I am happy to deploy solutions using PHP, Perl, Python or scripting, but I don't want to use Java on the destination server. Ideally I would like to avoid Ruby solutions, if possible. I have access to SSH on the client server and can use rsync over SSH as well, but I need to be able to execute a script on the client server to clean caches etc after an update. My development machine is **Windows** \- yes, unfortunate, but true. If I cannot achieve what I need on Windows then I will run CentOS/Fedora in VMWare. This is not a multi-server deployment requiring simultaneous updating across a server farm, although it would be nice to be able push out updates of the application to all the various clients on a schedule or using a single command/procedure rather than having to do it manually for each one. I would also need to be able to push client specific updates to individual clients as and when required (for instance HTML or logo updates). So, can I use GIT for deployment, or at least track the various configurations using branches? Or is it simply going to be too messy? Can I hide Client B from Client A, including in commit history, in a particular branch, to make sure someone proficient with GIT at the client's organization cannot retrieve code they mustn't see (and this is a **contractual** requirement of the project)? If so, how do I do this in GIT? If not, how can I **best** manage a build process that allows me to deploy client specific configurations? Note that initially I will be managing around 20 different clients, and this might grow to 100 or more different configurations as each one will include their own HTML and logos, and a variation based on a potentially unique selection of 15-20 modules. I am happy to maintain a hundred different XML configuration files if that's what it takes. I am aware of Capistrano, but from reading about it, it doesn't seem that suitable for my specific case. If you feel otherwise, please do feel free to state so.


title: How much programming skill should I have as a computer security expert?

text: I have a fairly comprehensive understanding of a program environment (from machine to code), however I have limited experience actually programming anything. Is this something I really need to work on? or is conceptual understanding enough?


title: What are some effective ways of helping someone learn a programming language/framework in a focused way?

text: Here's some background:   * I have someone who is motivated to help me out on a project that already has a good chunk of code written   * The person does not have a CS background, but knows the basics (functions, variables, objects, classes, etc)   * The goal isn't to make this person a rockstar developer overnight - they just need to be able to pull their weight on this specific project.   * The project is a Rails project, but if there are general responses, I'd like to favor them. The current approach that is being taken is to give this person a simple feature (that has a similar feature already written). Then nudging them when they get confused, while trying not to give them full chunks of code. Regardless, they're very confused and frustrated, and moving slowly. Not unexpected, but I'm wondering if there are any tips or tricks to help them learn more effectively, and get to the wonderful "ah-ha!" moments.


title: Computer security expert using pre-made tools or own?

text: As a digital security consultant when is it 'ok' to use tools someone else made (dumb to reinvent the wheel, right?) and when should I make my own?


title: In a specification, should I describe what a product does (ideally) or what it should/must do?

text: I'm writting a German specification (I'm not German). Differences may appear for this process in different cultures, especially in the terminology, but usually here's the idea:   * The **client** writes his **needs and wishes** in a document, called a scope statement or **requirements document**.   * The **supplier** tries to understand the **actual need** of the client (which might be different to what was written _and_ to what the client meant to say _and_ to what the client _thinks_ he needs, etc.)   * The supplier writes a **specification** for the **product** , which should fill the client's need.   * The specification needs to be **precise enough for the product to be made** (ambiguity problems occur).   * The client and the supplier can check whether they have understood each other, and discuss details of the product.   * The client **agrees** with the specification (or at least its current iteration) and the supplier is ready to start the **work**. (it may of course be expected of you to disagree with this process, but this is irrelevant to my problem): I'm now somewhere around the last two steps and I've been criticized because I wrote what the product _must_ do, and not what it _will do_ ideally. Usually along the lines of > The product must be able to perform task A And I was expected to write > The product performs task A This is a simple word play, but I feel saying what the product _does_ , while the product isn't even on the way to be made yet, is wrong. I would tend to consider a specification as a contract of what the product is expected to do (what it must do and how it should do it), and not what it _does_. Said differently, I feel this is the specification and not the manual of the end product…… Should I say what the product _must do_ or what it _does_?


title: How are algorithms developed?

text: I'm impressed with the efficiency of some algorithms and I noticed the way the problem is solved can be and/or appear really unintuitive. It may sound dumb, but I would like to know:   * **How do the authors come up with amazing algorithms? Do they just keep thinking about the problem and end up with the answer? Are they geniuses?**   * Which leads me to my next question: **how long do they take to find the solution? Hours, days, months, years?** I know there isn't a definite answer to these questions. But I would like to know how it usually works regarding the most used/known algorithms.


title: Code review if nobody in team has knowledge in some technology?

text: Sample situation: A team of Java developers starts an iOS project. Only one developer has Objective-C/iOS knowledge, and in the beginning he will work on this project alone. How we can perform code reviews in this situation? What are processes, approaches, tools that this developer will use?


title: Java HTTP Header issue

text: I'm looking to download videos from YouTube. My code works I can save the videos no problem but for some videos an HTTP response code of 403 is returned. For example all Vevo videos return 403 errors. I'm pretty sure it is to do with the headers. I've added headers to the request as per Chromes Live HTTP Headers. This is my code. Can somebody please suggest something I'm missing.               Base url used = "https://www.youtube.com/watch?v=dvgZkm1xWPE";          String url = "http://r5---sn-8vq54voxpx-q0ce.googlevideo.com/videoplayback?mv=m&ratebypass=yes&sver=3&id=o-AG0Zbfjq6nIMbyri8B5-6_-C8Vc4WHeRLHXbmh6CLK2A&source=youtube&sparams=gcr,id,initcwndbps,ip,ipbits,itag,ratebypass,source,upn,expire&mm=31&expire=1408069579&key=yt5&mws=yes&fexp=901466,902408,927622,931983,934024,934030,946023,949402&ms=au&ipbits=0&initcwndbps=1059000&&mt=1408047855&gcr=ie&ip=109.79.21.79&upn=xEwXucfWzTk&type=video/mp4;+codecs=%22avc1.64001F,+mp4a.40.2%22&quality=hd720&itag=22&fallback_host=tc.v8.cache7.googlevideo.com&signature=8287AA736059404B5179505C650D2CE6145F988B2.3AD41A007E3A69ABED73FF1C1A957BE645BDCDBDDB5&";               CloseableHttpClient httpclient = HttpClients.createDefault();     HttpGet httpget = new HttpGet(url);     httpget.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36");     //httpget.addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");     httpget.addHeader("Accept", "/");     httpget.addHeader("Accept-Encoding", "gzip,deflate,sdch");     httpget.addHeader("Accept-Language", "en-US,en;q=0.8");     httpget.addHeader("DNT", "1");     httpget.addHeader("Origin", "https://www.youtube.com");     httpget.addHeader("Referer", "https://www.youtube.com/watch?v=" + videoID);     httpget.addHeader("Connection", "keep-alive");          CloseableHttpResponse response = httpclient2.execute(httpget2);     HttpEntity entity = response2.getEntity();          System.out.println("\nResponse Code: " + response.getStatusLine().getStatusCode());     System.out.println(entity.getContentType());


title: Delegate pattern : Who has the responsability to create return Object?

text: I've a question about the Delegate Pattern : If I want to delegate the parsing of a xml file, for instance, that I want to be converted into a Key-value Dictionary. Let's take this classical example... What's the best practice about the creation of that Dictionary Object?   * Is it the "main" object that creates it and pass a reference to it to the delegate, asking him to fill it up,  or   * Is it the delegate that create this dictionary add pass it back to the "main" object, when he has done his job, trough the return value of the call-back method (or any other way) Is one of this two ways really better than the other ? And why ?


title: Is this a pattern? Should it be?

text: The following is more of a statement than a question - it describes something that may be a pattern. The question is: is this a known pattern? Or, if it's not, should it be? I've had a situation where I had to iterate over two dissimilar multi-layer data structures and copy information from one to the other. Depending on particular use case, I had around eight different kinds of layers, combined in about eight different combinations:               A-B-C     B-C     A-C     D-E     A-D-E      and so on After a few unsuccessful attempts to factor out the repetition of per-layer iteration code, I realized that the key difficulty in this refactoring was the fact that the bottom level needed access to data gathered at higher levels. To explicitly accommodate this requirement, I introduced `IterationContext` class with a number of `get()` and `set()` methods for accumulating the necessary information. In the end, I had the following class structure:               class Iterator {       virtual void iterateOver(const Structure &dataStructure1, IterationContext &ctx) const = 0;     };          class RecursingIterator : public Iterator {       RecursingIterator(const Iterator &below);     };               class IterateOverA : public RecursingIterator {       virtual void iterateOver(const Structure &dataStructure1, IterationContext &ctx) const {         // Iterate over members in dataStructure1           // locate corresponding item in dataStructure2 (passed via context)           // and set it in the context           // invoke the sub-iterator     };          class IterateOverB : public RecursingIterator {       virtual void iterateOver(const Structure &dataStructure1, IterationContext &ctx) const {         // iterate over members dataStructure2 (form context)           // set dataStructure2's item in the context           // locate corresponding item in dataStructure2 (passed via context)           // invoke the sub-iterator     };               void main()      {       class FinalCopy : public Iterator {           virtual void iterateOver(const Structure &dataStructure1, IterationContext &ctx) const {               // copy data from structure 1 to structure 2 in the context,               // using some data from higher levels as needed           }        }            IterationContext ctx(dateStructure2);       IterateOverA(IterateOverB(FinalCopy())).iterate(dataStructure1, ctx);     }      It so happens that dataStructure1 is a uniform data structure, similar to XML DOM in that respect, while dataStructure2 is a legacy data structure made of various `struct`s and arrays. This allows me to pass dataStructure1 outside of the context for convenience. In general, either side of the iteration or both sides may be passed via context, as convenient. The key situation points are:   * complicated code that needs to be invoked in "layers", with multiple combinations of layer types possible   * at the bottom layer, the information from top layers needs to be visible. The key implementation points are:   * use of context class to access the data from all levels of iteration   * complicated iteration code encapsulated in implementation of pure virtual function   * two interfaces - one aware of underlying iterator, one not aware of it.   * use of `const &` to simplify the usage syntax.


title: Good resources for language design

text: There are lots of books about good web design, UI design, etc. With the advent of Xtext, it's very simple to write your own language. What are good books and resources about language design? I'm not looking for a book about compiler building (like the dragon book) but something that answers:   * How to create a grammar that is forgiving (like adding optional trailing commas)?   * Which grammar patterns cause problems for users of a language?   * How create a compact grammar without introducing ambiguities. Here, think "clean language", not "parser builder warnings". Maybe "how do I avoid confusing the developer using my language?"


title: Common and frequently used algorithms of Data structures?

text: I have been programming for a while, and the edge that I am missing over other programming is algorithms. I know what is linked-list and binary tree, but I dont know many more of them. I failed on 2 interviews, because of exercises that demanded me to know some data structures algorithms. I am also starting to build a javascript project which has some heavy processing, and I need to know a few good frequently used algorithms?


title: Steps to Learn a Programming Language / Framework

text: I am new to programming. I am eager to learn new programming languages / frameworks. Can any one suggest the best way to master programming languages / frameworks?


title: Is this JS code a good way for defining class with private methods?

text: I was recently browsing a `open source` `JavaScript` project. The project is a straight port from another project in `C language`. It mostly use static methods, packed together in classes. Most classes are implemented using this pattern :               Foo = (function () {         var privateField = "bar";         var publicField = "bar";              function publicMethod()          {             console.log('this is public');         }                 function privateMethod()          {             console.log('this is private');         }              return {               publicMethod : publicMethod,                     publicField : publicField         };     })();      This was the first time I saw private methods implemented that way. I perfectly understand how it works, using a anonymous method. Here is my question : **is this pattern a good practice ?** What are the actual limitations or caveats ? Usually i declare my JavaScript classes like that :               Foo = new function () {         var privateField = "test";         this.publicField = "test";              this.publicMethod = function()         {             console.log('this method is public');             privateMethod();         }                 function privateMethod()         {             console.log('this method is private');         }            };      Other than syntax, is there any difference with the pattern show above ?


title: Where and when to include assets in languages that don't care where they are declared?

text: I come from c++, where one declares all assets to be included at the top of a file. That is what I have been doing with php as well. Lately I have been tempted to stray from this rule: I have a script file where I put functions I use throughout my projects, sort of like a library script. There are some functions included that require assets that no other function uses, and since one can put require_once statements all throughout one's scripts, I have been tempted to include assets at the beginning of those functions, to conserve resources when the script is running. Is this kind of thing frowned upon in OOP, or is that OK? I guess while I am at it, should I not be doing this at all because there is a purerer OOP approach to the kind of library scripts I have been creating?


title: Math library methods in Google's Go Programming Language

text: I have been programming in google Golang and have been enjoying it due to its brevity but I find it surprising that almost all its Math standard library methods are for the floating point type. Is there any particular reason why these methods do not exist for ints?


title: Should I perform encryption in the front end or within the database?

text: I want to store an encrypted string (specifically, email addresses) in a database. I'm currently using Python and MySQL. I was initially going to use MySQL's AES_ENCRYPT/DECRYPT to handle it, but then got to wondering if one was was better than another. It seems that if I tie it to a database function, that could potentially lock me into the database and at this point that selection may change down the road. Otherwise I would look to handling it in the Python code, but part of me thinks that having it all handled on the back end would free you to use whatever front end logic and code you wanted to. Any thoughts or ideas?


title: Ternary operator (condition ? foo : bar) and the XOR (^) operator

text: I have read in a recent code review that both `ternary operator (condition ? foo : bar)` and the `XOR operator ^` are rarely used in Java. Is it true? If yes, is this because they are less readable? or some other reason.


title: How image editing software change image contrast?

text: How Photoshop or other image editing software change an images contrast? What contrast mean when we process image pixel by pixel? Or what image contrast means? Here I created a very basic image to understand image contrast. This is a 10×10 pixels image that get a 100% non-legacy contrast adjustment in Photoshop. The only change I saw was in gray colors that were lighter after applying the contrast. Before and after contrast: ![The images before and after contrasts are similar, except for the gray color which is slightly lighter](http://i.stack.imgur.com/CqZhf.png)


title: How I can hide dependencies from my Services?

text: Here's a service abstraction that I am working on :               public abstract class Service     {     public ILogger Logger{get;set;}          public IQueryManager QueryManager{get;set;}          public ICommandManager  CommandManager{get;set;}     }      Then I have to call them in my class as usual :               Logger.Log("Something");          QueryManager.Query(new QueryObject()).Result;          etc.      But I'd like to have some protected helper methods to make these sentences less verbose :               Log("Something");\\calls Logger.Log("Something")          Query(new QueryObject()); \\ returns QueryManager(new QueryObject()).Result      Is there a way so that I can implement my dependencies so that they will be hidden from children of Service ? Is there an IoC container that allows me to use private properties to inject my dependencies ?


title: How to improve relationships between consultants and staff programmers

text: I have been a consultant for a small software consulting firm for quite some time now. Our normal business model is not staff augmentation, but such that we find clients who need assistance in building a solution of some kind and then send in a team who can build that solution, work with the existing IT staff, train all involved on supportting that solution, then move on to the next job. We, of course, are still around for any needed ongoing support. We have a great reputation in our area and have been very successful in implementing the solutions that we provide. However, I have noticed a common theme for most of our projects. When we get on-site, there is generally a "stressed" relationship between our team and many of the IT staff currently at the client. I understand completely that there may be some anxiety about our arrival and that defenses can come up when we are around. Many of the folks are understanding and easy to work with, but there are usually some who will not work well with us at all, and who can quickly become a project risk in many ways. We try to go in with open minds and good attitudes, and try NOT to be arrogent or condecending. We generally get deployed when there is a mess to clean up - but we understand that there were reasons decisions were made that got them in the bind they are...so we just try to determine the next step forward and move on. My question is this - I'd like to hear from the IT staff and programmers out there who have had consultants in - what are the things that consultants do that fire up negative feelings and attitudes? What can we do better to make the relationship better, not only in the beginning, but as the project moves forward?


title: The importance of Design Patterns with Javascript, NodeJs et al

text: With Javascript appearing to be the ubiquitous programming language of the web over the next few years, new frameworks popping up every five minutes and event driven programming taking a lead both server and client side: Do you as a Javascript developer consider the traditional Design Patterns as important or less important than they have been with other languages / environments?. Please name the top three design patterns you, as a Javascript developer use regularly and give an example of how they have helped in your Javascript development.


title: How do I distribute free copies of a paid iOS app?

text: Can anybody tell me how I can give my paid app a free download option to one of my friend from iTunes Connect. What I mean is that I will give my friend a code by which he can download my app without paying. Can anyone tell me if there is any option in iTunes Connect to do this?


title: Planning poker, individual or whole group in estimates?

text: In planning poker/scrum poker, when an estimate is made, should the estimate be made based on the assumption that only a single developer is assigned to that task, or a group of developers? If the latter, how large is that group? The reason this is relevant is that the time estimates would probably be different if a single person works on the problem compared to having several people. I've read several descriptions of how planning poker is supposed to work, but this basic information seems to be omitted, as if it should be inferred from the procedure in some way. In other words: If I give an estimate, should my estimate be how long I think a single developer in the group needs to spend to solve the problem, or how long the whole group would spend to solve the problem?


title: Is it bad programming practice to check if a class referenced by its interface is an instance of another class?

text: I have a class (`Timer`) with an array list of `Timable` objects. `Timeable` is an interface. There is some specific functionality that I need for the `Trigger` class (implements `Timable`), which has a reference called `target`. A lot of methods need to search through the `Timer` array for `Trigger` objects with a certain `target`. What I did was a function like this:               public Timable[] findObjectsWithTarget(Cue target) {         ArrayList<Timable> result = new ArrayList<Timable>();         for (Timable timed : fireable) { //fireable is the array (actually a HashSet) of Timed objects             if (timed instanceof Trigger && ((Trigger) timed).getTarget() == target)                 result.add(timed);         }         return (Timable[]) result.toArray();     }      This feels like a bad practice. The Timer class is now dependent on the Trigger class (sort of) and are no longer generalized. So, my two questions: **1) Is it actually a bad practice? Why or why not?** **2) What's a better way if it is a bad practice?**


title: Javascript library for Java source code reference

text: Could you suggest any JS lib, that will "recognize" all Java classes in specified text and create reference link to page with this class? (similar to Eclipse Ctrl+click) There are plenty of good JS libraries to highlight code, but none of them have this feature.


title: GCC vs clang/LLVM -- pros and cons of each

text: What are the pros and cons of GCC vs clang/LLVM?


title: How can I keep current with Python coding style?

text: I've been using Python since version 2.2. I do pick up new language constructs like for example `with` statement or dictionary/set comprehensions. However, I've realized that even though I'm being consistent with PEP-8, for existing constructs I'm using old style, rather than new style (for example `except Exception, e` instead of `except Exception as e`). Is there a resource which would have either most current style guide, or even better a list of changes in Python's coding style?


title: Kaizen in DevOps methodology?

text: I was wondering, Does anybody here works in a software development team under the DevOps methodology and applying Kaizen instead Lean for continuous improvement? I read that DevOps is based on Agile methodology and Lean, but I don't know whether it's possible to use Kaizen instead Lean. Thanks.


title: What is the process or term for viewing HTML/CSS using localhost?

text: I have recently used some software, which come as a regular setup file, where you install your software, and then when you run it, opens the browser, uses the localhost with some specific port number to connect to the software, and runs it from there. I find it quite useful and interesting. But I even don't know whether this kind of software and programming methodology have a name or not. Therefore, I would like to learn which programming languages, APIs, and frameworks are specifically designed for this purpose? One example to this is Metasploit. You can download its setup file, and install it casually like any other software, then when everything finishes, and you want to use the software. It will open the browser and connect to,               http://localhost:3790/      where Metasploit will load and start.


title: At what size of data does it become beneficial to move from SQL to NoSQL?

text: As a relational database programmer (most of the time), I read articles about how relational databases don't scale, and NoSQL solutions such as MongoDB do. As most of the databases I have developed so far have been small to mid scale, I have never had a problem that hasn't been solved by some indexing, query optimization or schema redesign. What sort of size would I expect to see MySQL struggling with. How many rows? (I know this is going to depend on the application, and type of data stored. the one that got me thing was basically a genetics database, so would have one main table, with 3 or 4 lookup tables. The main table will contain amongst other things, a chromosome reference, and a position coordinate. It will likely get queried for a number of entries between two potions on a chromosome, to see what is stored there).


title: What are the requirements for attribution in the MIT License?

text: choosealicense.com claims that the MIT license is “A permissive license that is short and to the point. It lets people do anything with your code **with proper attribution** and without warranty” (emphasis mine). Reading the license, though, I don’t see anything claiming that attribution to the original author has to be anywhere, so where are they taking that from?


title: PHP - PSR 0 - Configuration Constants

text: This question is about PSR-0 autoloaded libraries and the way main configuration constants should be declared and used. From your point of view (lib/framework developer), where/how should be declared your library configuration PHP constants (such as `ESCAPE_SOMETHING`, `USE_DOM`, `API_URL`, ...) in such a way that   * your code can easily address them   * client code can easily modify them depending on needs Is there any convention, recommendation, or even something I missed in PSR-0 I should be aware of?


title: Testing: Should I wrap system notifications and send my own?

text: In the current Cocoa app I'm working on, I've got an object, `RecordScheduler`, which responds to two types of notifications, "day did pass" and "quicksaving interval did pass". In both cases, the `RecordScheduler` tells a `Recorder` to do its recording job, among other things. Now I want `RecordScheduler` to issue a recording when the Mac goes to sleep. You subscribe to sleep/wake notifications via `NSWorkspace`:               [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self              selector:@selector(computerWillSleep:)              name:NSWorkspaceWillSleepNotification object:nil];      This is easy enough. Add it to `RecordScheduler`'s `-init` and the notifications would be processed just nicely. Thing is, for the other two cases I wrote helper methods like `fireDayDidPass()` to use in unit tests. I fired my custom notifications and added assertions for `RecordScheduler`'s response. Works well. I don't feel comfortable firing a `NSWorkspaceWillSleepNotification` since (a) it's not my own, and (b) I don't know about any side effects. Instead, I resorted to calling `[scheduler computerWillSleep:nil]` which would receive notifications. Now I don't have an intergration-ish test to verify `RecordScheduler` subscribes to `NSWorkspaceWillSleepNotification`. After I found out there is no additional information to be sent, I abandoned the idea of creating a `HibernationObserver` which subscribes to `NSWorkspace`'s notifications and re-sends my own kind of "Will Sleep" and "Did Wake" notifications. There seemed to be no additional benefit. Now here's the point:   * Is it still a unit test when I fire a notification and assert for both the side effects of notification handling and the receiver's subscription upon initialization?   * How else could I verify an object signs up itself as a notification receiver?   * Should I make it a habit to wrap system notifications in my own?


title: Is it bad practice to allow user defined fields?

text: Generally speaking, is it considered bad practice to allow for user created fields in a database for a webapp? For example, I am making a home inventory webapp for my wife, and she is going to want to define her own fields for different items. I was planning to allow her to create item categories, and add "features" to those categories. Features would just be key/value stored as strings. That way if she had a category called "Audio CDs" for example, she could add features for stuff like "artist", "tracks", etc. But in another category like "furniture", she could add features for stuff like "material" (wood, plastic, etc). Then any item could belong to one (or many) categories, adding those features to the item. I can see issues where searching by these features requires string comparisons, there's no validation of data, etc. Following agile methodology, maybe it would be better to just have her come up with new categories and attributes and I would just have to create new tables as we go. In my example, it's a small userbase (2 of us) and the amount of records created would be small, so not too bad. Generally speaking though, how do people handle something like this in "real life"?


title: Refactoring Switch Statements and is there any real use for Switch Statements at all?

text: I was reading this article and was wondering, do we get rid of all switch statements by replacing them with a Dictionary or a Factory so that there are no switch statements at all in my projects. Something did not quite add up. The question is, do switch statements have any real use or do we go ahead and replace them with either a dictionary or a factory method (in using a factory method, of course, there will be a minimum use of switch statements for creating the objects using the factory...but that is about it).


title: Is it possible to avoid enormously big switch in that case?

text: I'm writing a simple chess-related code with intention to write it clearly (performance doesn't matter at all). And this method I have doesn't look clean to me at all:                public static Piece GetClosestPiece(Square squareFrom, Direction direction)         {             //TODO: rework this mess             switch (direction)             {                 case Direction.Top:                     return                         _pieces.Where(p => p.Square.OnVerticalWith(squareFrom))                                .OrderBy(p => p.Square.Y)                                .First(p => p.Square.Y > squareFrom.Y);                 case Direction.Bottom:                     return                         _pieces.Where(p => p.Square.OnVerticalWith(squareFrom))                                .OrderByDescending(p => p.Square.Y)                                .First(p => p.Square.Y < squareFrom.Y);                 case Direction.Right:                 <...>                 case Direction.TopLeft:                     return                         _pieces.Where(p => p.Square.OnBackslashWith(squareFrom))                                .OrderByDescending(p => p.Square.X)                                .First(p => p.Square.X < squareFrom.X);                 default:                     throw new InvalidEnumArgumentException();             }         }      I store the pieces as list, so, here I'm using LINQ to find the piece closest to a given square on a given direction.   1. Do switch/if statements of this size (8 cases total here) always present a code smell?   2. Is there any way to refactor this part only, or should I consider reviewing the design of the whole solution?


title: Is it worth the time to run static analysis tools (e.g. Findbugs) on test classes?

text: How likely is it for a bug _that can be discovered by a static analysis tool_ (namely Findbugs) in _test classes_ mask a real bug in the actual code? Is this a realistic scenario? Is it really worth the time to run static analysis tools on them to find bugs in the actual code?


title: DDD with a 'School' domain

text: I've been asked to draw out the Bounded Contexts (BC) and the possible aggregate and the roots of a School domain. The domain consists of students who study modules on a course. The submit their assignment for a module which is then marked by an external tutor. The 'Marking' firstly sticks out as a BC, but im unsure about the rest... Also a 'module' would appear on multiple Bounded Contexts so how would i handle this?


title: How to make audio and video streaming servers work?

text: I am PHP MySQL developer and I am interested in the way television and radio are broadcasted over Internet live. I want to know how it works and and what are its requirements (which package of which programming language offers the best). And please clarify me: Websites are stored in servers. From my desktop, if I want to broadcast some video, then I need to connect to webserver (to upstream the video). Is there an application to do that (or do I have to code that or embed in my web application and which programming language would be suitable (does Python support that))? And I also need a script to handle the upstreamed video or audio (can I do that with PHP)?


title: PHP OOP: Should every object contain all the data?

text: I'm trying to learn PHP OOP "properly", and I was wondering, should the constructor grab all the information in the database and store it in the object? To use an example I'm trying to create using PHP OOP, an internet comic website (much like XKCD's), would have two classes:   * Catalogue (list and order of all the episodes)   * Episode (data relating to that particular episode) So, in this situation, should the `Catalogue` object get an array of all the episodeIDs (presumably this would be gotten in the constructor)? And if so, does that mean I have to update both the Object's array and the Database's array? And if so, what's the most common way of implementing this (presumably very common) action?


title: Why do javascript implementations parse numbers this way?

text: According to the ECMAScript spec the integer part of a decimal number should be either zero or start with a non-zero digit. A hexadecimal value should start with 0x. Javascript, in the major browsers, extends EMCAScript to include octal numbers. These are determined by having a sequence of digits (from 0 to 7 inclusive) start with a zero. Given these facts, my naive implementation of a javascript interpreter would probably parse integers a bit like this:               if first_char in [1-9] then         parse_input_as_decimal()     else if first_char is 0 then         if second_char is 'x' then             parse_input_as_hexadecimal()         else if second_char in [1-7] then             parse_input_as_octal()         else             parse_input_as_zero()      However the web browsers seem to act slightly weird in that if a number beginning with zero contains the digits 8 or 9 then it reads it as a valid decimal. This can lead to oddities, especially when using a decimal point or exponent. Some examples:               011 // is octal     0011 // is octal     019 // is decimal     0091 // is decimal     011.0 // throws an error     019.0 // is decimal     011e5 // throws an error     019e5 // is decimal      My question is why do they behave like this? Is it just some quirk of history? Or is there a good reason? Is it written in some spec somewhere? Will this ever change? I know this is a bit arcane and few people use octals in javascript these days, but I'm curious.


title: Functional testing before code checkin

text: I am working on a project with legacy code where it does not have much code coverage. One of the idea to improve that is to enforce a rule that each code check-in must have test, not only test but functional test as well, so that we can verify that the existing code did not break. I would like to get some ideas, both pros and cons on this approach. Sometimes it sounds like it's a huge undertaking as it will need a really good infrastructure so that developers can have their code fully tested before it is committed. How would one go about running automated unit tests as well as functional tests when code is checked in? Is this even a feasible idea?


title: Thoughts on a custom data structure for a node/chain implementation

text: I am designing a simple GUI that will allow a user to create a GPX route by clicking repeatedly on a map panel. I am faced with a design dilemma for how to represent the nodes and route. This construct can be abstracted as follows:   * the user clicks **n** times on the screen in sequence to create a chain of **n** nodes   * after a chain has been completed, a user can add more nodes to it, either by selecting nodes in the middle (inserting between existing nodes) or by simply automatically appending to the end with his next click At first I was determined to use a Java Collections class to represent the chain, but there are unexpected difficulties with that. On the surface, this would appear to be a perfect example of a `LinkedList`, but consider as follows. If the user wishes to insert a node in the middle of the chain, he first chooses some node on screen that he wishes to insert a new node before. If the node belongs to a linked list, it will need to maintain a reference to its encompassing list (a somewhat unusual practice, I'd think), and even then we will still have to locate the node in the list before we can insert. So we have to:   * find the node (linear time)   * insert the new node (constant time) Or if I try the same thing with an `ArrayList`, it also performs at best in linear time.   * find the node (linear time)   * insert the new node (linear time) But neither case really seems desirable. I briefly flirted with the idea of using a `LinkedHashSet`, but it does not allow insertion into the middle of the linked list, nor does it seem fundamentally correct to use a set implementation for something like this. So here is what I came up with:               class Node {         Node previous;         Node next;         Chain chain;     }      A Node maintains only a reference to its previous and next nodes, as well as the chain it belongs to (again, this latter part seems unconventional and possibly even wasteful to me, but I'm convinced it may be necessary here).               class Chain {         Node first;         Node last;     }      The chain knows only what its first and last nodes are. Now, if a user wants to insert a node in the middle of the chain? He selects the node, which simply updates the first/last references of itself and its neighbors. If he wants to add nodes to the end of a chain? He simply selects any node on screen (which is aware of what chain it belongs to, and therefore what the last node in that chain is), and the chain immediately begins updating link references for the last node and each node added after it, as well as keeping its own "last" reference up to date. I really wanted to use a Collections class, but this approach seems better to me. But I'd love to here thoughts/criticisms from more experienced programmers. Thanks.


title: What are the major challenges in creating a platform such as StackOverflow?

text: Let us assume you were to create a platform such as StackOverflow. It needs to be functional, fast and scalable, just like SO, in order to be successful. What are the major challenges you would face in such a task? I'm looking for technical challenges rather than problems such as how to advertise it and stuff like that. (I'm not looking for ways of creating a new site to challenge SO; I'm just interested in how difficult it would be to create it if it didn't already exist.)


title: Where can I learn and understand the complete workings of HTTP headers, so I can implement my own?

text: I am looking to learn how to properly use, and implement, HTTP headers. What is the best resource or set of guidelines that I can use? ( especially ranges to detect download managers, etc) ?


title: Is it legal/ethical to post production code?

text: This may sound silly or obvious but this is my case; I work at a company that recently implemented SAP and I was the responsible to generate/migrate the master data of the company which let me learn a lot from this system. SAP comes with its own language known as ABAP and since the system went live I've been learning and programming with it. Before ABAP I worked as a freelancer in other projects with VB6, VB.Net, C# and ASP.Net building a lot of stuff, here I've made some utilities that are been using daily, so I came with long experience in programming. At first ABAP was difficult but eventually after long analysis, googling and trial and error I became the guy who makes basically all the development in SAP from reports, to user-exits, enhancements, BADIs, tables, dynpros, etc. Daily I learn more and more because of all the requests I receive which makes me investigate and code a lot everyday. It has become challenging and funny at the same time. You could be very productive in ABAP once you get into. Ok, the question is - can I post how I resolved a certain thing in SAP? That implies that I'd publish production code. I feel doubtful about this.


title: Mediator vs Observer?

text: Can someone provide me with a canonical answer on the differences between an `Observer` and a `Mediator`, and a summary of when you should use one pattern over the other? I am unsure of what kind of situation would require an `Observer` and what kind would require a `Mediator`


title: How should I handle multi-tasking in a WPF application?

text: In most of the multi-tasking CRM applications I've seen, MdiWindow is used to allow users to open multiple windows at the same time. But MdiWindow doesn't seem to be commonly used in WPF. Looking through Codeplex, I only found one abandoned MdiWindow project. In some of the WPF-based CRM applications I've seen, they create a dashboard and only let users work on one thing at a time. What's the best way to handle multi-tasking in a WPF application? Is there a better alternative to MdiWindow in WPF?


title: If a dependency is not in the maven repository should I add it to source control?

text: One of the jar files that I use in my code is not in the maven repository(and yes I tried to avoid using it). I have installed it locally so when I build the project it gets picked up by maven. I also put instructions in my `README` so anyone who wants to build my code can see how to add the jar to their local repository. The question is, should I check this jar into my git source control? I know normally you don’t check jars into source when using maven and git but in this case it seems like it might be a better idea than saying, find this jar on the internet. I am the only developer in my group so setting up a company hosted repository for just this single jar is overkill.


title: Binding in web frameworks - to frontend data or backend data?

text: AngularJS and other web frameworks provide data binding abilities (as in WPF). Is the UI bound to JavaScript variables on the frontend (web browser) or is it bound to the data in the server (via AJAX and such)? I assumed that with all the MVC frameworks for the web, the model is the data on the server, the view is the web page on the client, and the controller is either on the server or on the client (browser). Did I get that wrong? I'm sorry if its a stupid question. I am a C#/C++ developer but with little experience in web development.


title: Structuring asynchronous javascript code

text: I am working on an application that heavily depends on asynchronous data operations. I am dealing with those through promises. However, while my code works, I have the feel that it is getting chaotic and hard to maintain in the future. Assume this:               validate().then(          // success     function(promise){         $http.post('stuff.php',data).then(                function(p){                },           function(){                }         )      },          // failure     function(reason){         // Assume another promise-depending operation     },          // notification     function(update){          }     );      As you can see, promise calls are heavily nested. Furthermore, I have to deal with resolve/reject methods in each and every step. What am I missing; how can I improve my technique?


title: Transition from maintenance programming to design

text: What to do people do develop a design for a s/w for a given set of requirements? I like many people joined a Semiconductor MNC and got stuck in maintenance for quite a couple of years. My work was usually changing a lines of code for windows drivers supplied by my company or a couple of small script (style like) C programs for validating h/w. As a result I developed the bad habit of 'programming by coincidence'. I have not developed the ability for designing tools/programs from scratch. I was the only s/w member of the local team and thus some grunt work from the well established other site of the company came to be done by me. Now I have moved to a different company and thus finding developing from scratch very difficult. How do I unlearn my bad habit and develop this ability of designing s/w and then coding it ?


title: What hurts maintainability?

text: For someone who doesn't have much real world experience yet, the notion of maintainable code is a bit vague, even though it follows from typical good practice rules. Intuitively I can tell that code can be well written, but not maintainable if for example it hard-wires information that is subject to constant change, but I still have a hard time looking at code and deciding if it's maintainable or not. So the question is: what hurts maintainability? What should I look for?


title: Mobile: Native vs. web - Input for discussion on top management level

text: I have been given the task of producing a compilation of pros, cons and key points on the issue of mobile native applications versus mobile web applications. It will be input for a discussion on top management level. What are some valid and maybe overlooked topics here?


title: Design Anti-Patterns - C# - Do you call this a God object?

text: I am writing Portfolio module for my web site and it has 3 components. Gallery Category, Gallery, & Gallery Images.   I am doing all the request handling, (creating, reading, updating, other), for the above 3 components in 1 class, Portfolio.   DB handling jobs for Portfolio module is done in another file.   My question is, even just for request handling purpose, can you do all the operations in 1 class? -Reddy


title: Is it misguided to label mobile web applications as cross platform?

text: Yes, you can access the mobile web site from a range different mobile devices, but the platform, I suppose, is still the web server and the client browser (the latter ideally being the "same" on any device). When talking mobile and cross platform I am thinking frameworks such as PhoneGap and Appcelerator Titanium, but still with a reluctance to call it cross platform as the deployed products are not the same. I guess I am hung up on the idea that it has to be directly equivalent to the Java virtual machine to call anything cross platform, but maybe I am the one who is misguided. What is the general opinion?


title: Advice on Switching Careers to Java Programmer

text: > **Possible Duplicate:**   >  Best way for a senior programmer to switch languages/environments in next > job? I have about 15 years of IT experience in IT Security and Networking. I am looking for a career change and I really would like to take a stab at Java programming. I have a CS degree but it's been about 5 years since my last class. I have intermediate experience in Perl (that is still current) and I am also trying to learn Python (although it has taken a back seat to Java). I picked up Sam's Teach Yourself Java in 24 Hours as a refresher to my Java classes I took in school. I am half way through it and luckily it's all coming back to me. I also have HTML and some SQL experience. The reason I chose Java and not Perl is because a.) I liked programming in Java in school and b.) Java seems to be in high demand these days. I wouldn't mind being a Perl programmer but it seems like all of the jobs have Perl listed as "nice to have" experience and not a requirement. I guess my question is what kind of jobs should I be applying for? I am thinking I only have enough knowledge for a beginner/intern type jobs but it's going to be almost impossible for me (personally) to take a job that only makes 1/3 of what I'm making now ($90k). Will I be laughed at if I attempt to apply for "real" programming jobs or is there such a demand for Java programmers now that someone will be willing to give me a chance? Thank you for any advice. I would really like to make this change within the next 6 months.


title: Why is it discouraged to create variables on the fly? PHP gives you a Notice Error

text: Are you guys familiar with those pesky PHP notice errors? You know, the ones that will appear when you do something like this:               if($some_variable == 45)      But if $some_variable wasn't created already, PHP will be like "Hey! Idiot! This variable wasn't defined yet!" and output a Notice Error onto the screen. However, you can simply turn PHP Notice Errors off by using error_reporting(0) and the application works perfectly. What's the point? Who cares if a variable wasn't created yet? Why can't you just create it on the fly inside the if statement? I feel like this is the easy, no-brainer way to do it, but apparently PHP discourages this practice. Why? What I find myself having to do a lot of times is something like this:               if(isset($some_variable) && $some_variable == 45)      If $some_variable is not set, the if statement automatically fails, so the second condition of the if statement is never checked, so the Notice Error never happens. This works great, but I feel like it shouldn't be necessary. Some of the applications I am working on are huge and I fear that the extra added conditions will slow down my poor old server if there are dozens of instances of it, combined with thousands of users. I know that this is just a single extra statement which would be O(1), which isn't a lot of resources, but it's still something I worry about. Should I not worry about O(1) even if I hypothetically were to have thousands of users? Am I caring too much about being efficient? I know PHP Notice errors can easily be turned off by using error_reporting(0). I'm not sure if certain types of errors can be turned on/off as desired because I haven't researched error_reporting() extensively. My question is what's the point? Why is it discouraged to create variables on the fly? I feel like creating variables on the fly may be a little bit lazier but is 10000000x easier to program and should be the no-brainer encouraged way to do it. This is meant to be both a philosophical and a technical question.


title: Is storing stack traces in database recommended?

text: The current system I am working on goes through a set of documents & performs some logic using the metadata of the document. If the metadata of a document is fishy..it throws an exception. The system logs the exception, fail the job & let the developer fix the issue by looking at logs before moving on. I want to improvise this system by making system fault tolerant as I have seen that generally the job fails because of few documents. System continues even if there's an exception raised. The exception information would be stored in the database table along with document information. This information would be sent to developer who can then work on fixing it without having customer waiting. The customer can later process those failed documents separately. My question is how to store the exception information in table. The exception would already be logged in the log file. One idea I was thinking was to store the time stamp of the exception so that developer can later find the time stamp in log file and understand the exception. But this comes with a possibility that the log files might be deleted. Does it make sense to store the entire stack trace in the database?


title: Is it reasonable for programmers to be sprinting the whole year round?

text: It feels like it is not enough for working programmers just to "walk" 5 to 8 hours a day, and "quick walk" is not enough, but they have to "sprint", every day, year after year. For the company, it makes a lot of sense because to get the most out of workers, sprinting all day long, day after day is better than people who merely walk the whole day. Here I am comparing our "sprints" to normal day life of walking vs sprinting. While we can sprint 100 meter a few times or even two dozen time a day, for a total of 15 seconds x 25, can anybody sprint the whole day long for 5 hours, and day after day? What I mean is, doesn't it make more sense to sprint for 3 months, and then get back to normal, when people can just "walk" or "quick walk", being productive, for the rest of the 9 months in a year? Or sprint for 3 months, get back to normal for 3 months, and then sprint for another 3 months and back to normal for another 3 months? It sure make a lot of sense to the company, because if people can sprint the whole year, then the company can get a lot of things done, burn out people, and just later replace the burned out people by other fresher people (possibly replaceable contractors) -- and it is such a nice term to use too -- we have people sprinting the whole year round -- we are getting the "maximum" output -- so the directors now can have reasons to get promoted to be vice presidents. I really wonder, should sprints really be year round? I think in the old days, when companies such as Microsoft made people work 60 hours per week, some people described them as a velvet sweat shop. But if we begin to say, we are just having sprints (and not mentioning that it is sprints for 3 weeks, and then another one immediately following, and it just repeats again and again the whole year round), then it sounds like a very justified thing to do.


title: How to integrate a second programmer to a startup

text: I'm the technical founder of a startup and I'm currently looking to hire a second developer for our product. Since I've been the sole developer, there is no formal organization for the project and I wanted to know what would be the minimum organization required to incorporate this second developer. Right now the code only under source control (a kind of chaotic git repo) but it lacks unit tests and other things that are required for serious development. I was willing to go without those for a while for the sake of speed, but now that the company is growing, we feel that delaying those might be problematic. How to incorporate this second person to work with the code?


title: Autocomplete seeding (with xml format?)

text: **Autocomplete driven development** is the issue. How do I feed autocomplete hints to IDEs, when I'm using scripting languages which provide magic methods? I'm not using an IDE usually. But it's obvious that many developers rely on them, and some percentage of them rely on autocomplete hints from the IDE. Now Eclipse and Netbeans both have support for PHP and Python. But they are of course unable to see class methods and attributes which are provided through `__get/__` or something. Whereas magic methods sometimes provide a nicer and more flexible API (and/or save coding). Anyway it's obviously an issue if you want to make the API visible to autocomplete programmers. So how can it be done? Is there an XML format for this? I know Eclipse is pretty xml-happy, but couldn't google up anything useful about that. How about Netbeans or other IDEs, is there any standardized scheme to signal autocomplete infos to code editors? (Would be nice if you could hobble in class methods and attributes, but also signal type hints for commonly used variable/object names.)


title: Switching between mobile webapp version using Ionic Framework and Desktop web app version?

text: I own a web application that make use of Twitter Bootstrap 3.   This eases the design of the mobile version since it brings some responsive features.   However, I would like a really native-mobile aspect for the mobile version, but not a native for the Desktop one.   I searched..and I found **this really promising framework** : Ionic It seems that this framework is really **only focused on Mobile application** and doesn't fit with any other kind of framework like Bootstrap (not mentioned in the documentation). Therefore, my questions are:   What should be the strategy to keep a desktop version (not using Ionic but bootstrap 3) and a mobile version using Ionic? Making two distinct UI applications? One that would use Bootstrap and the other Ionic? What about duplications??


title: Do preprocessor defines slow down build times?

text: I have a very large c++ project and I'm trying to decrease build times. I've been religious about forward declaring and only including files which are used. However I have many preprocessor defines which are setup in the project files (ie not in cpp or header files) so that I can keep them all in a central location for my different build configurations. Is it possible that this could increase build times? Would moving the preprocessor defines to a header file so they will only be included where needed speedup the build time? It seems like the build time would be faster if the preprocessor didn't need to scan and replace the defines for files that don't use any of them, but I'm not sure if it's worth the effort.


title: Handle complexity in large software projects

text: I am a lead developer in a larger software projects. From time to time its getting hard to handle the complexity within this project. E. g.   * Have the whole big picture in mind all the time   * Keeping track of the teammates work results   * Doing Code Reviews   * Supply management with information etc. Are there best practices/ time management techniques to handle these tasks? Are there any tools to support you having an overview?


title: Refactoring classes with ref to themselves

text: How can I refactor this code?               class Node     {        public Node Parent { get; set; }     }          class AVLNode     {        public AVLNode Parent { get; set; }     }      I tried to use inheritance, but then I have to use type casting:               class AVLNode : Node     {     }          class Program     {        void Main()        {           AVLNode a = new AVLNode();           AVLNode b = a.Parent **as AVLNode**;        }     }


title: Increase the size of a memory mapped file

text: I am maintaning a memory mapped file to store my tree like datastructure. When I'm updating the datastructure ,I got this problem. The file is limited on it's size and can't be too long or too small. I have a methods like                void mapfile_insert_record(RECORD* /* record*/);           void mapfile_modify_record(RECORD* /* record*/);      Both operations could lead to exceed the space which is free on memory file. How do I overcome this? What strategy I should use.   1. calculate whether it requires to exceed the file as a pre-condition on both methods.   2. Dynamically exceed it , for a example manage a timer and constantly polling file for it's free avaliable size and then automatically extend it. Any ideas or patterns to overcome this problem?


title: OO Design, how to model Tonal Harmony?

text: I have started to write a program in C++ 11 that would analyse chords, scales, and harmony. The biggest problem I am having in my design phase, is that the note 'C' is a note, a type of chord (Cmaj, Cmin, C7, etc), and a type of key (the key of Cmajor, Cminor). The same issue arises with intervals (minor 3rd, major 3rd). I am using a base class, Token, that is the base class for all 'symbols' in the program. so for example:               class Token {     public:         typedef shared_ptr<Token> pointer_type;         Token() {}         virtual ~Token() {}     };          class Command : public Token {     public:         Command() {}         pointer_type execute();     }          class Note : public Token;          class Triad : public Token; class MajorTriad : public Triad; // CMajorTriad, etc          class Key : public Token; class MinorKey : public Key; // Natural Minor, Harmonic minor,etc          class Scale : public Token;      As you can see, to create all the derived classes (CMajorTriad, C, CMajorScale, CMajorKey, etc) would quickly become ridiculously complex including all the other notes, as well as enharmonics. multiple inheritance would not work, ie:               class C : public Note, Triad, Key, Scale      class C, cannot be all of these things at the same time. It is contextual, also polymorphing with this will not work (how to determine which super methods to perform? calling every super class constructors should not happen here) Are there any design ideas or suggestions that people have to offer? I have not been able to find anything on google in regards to modelling tonal harmony from an OO perspective. There are just far too many relationships between all the concepts here.


title: How close have we gotten to automating code writing?

text: And I don't mean Autocomplete or automatic code snippets as inserted by modern day editors, or polymorphic code. But what is the state-of-the-art in programs that can go through given inputs and types and information of the desired outputs and output a valid piece of code in a language of choice. I am aware of Genetic Programming, Gene Expression Programming but I don't know of any other efforts. Also googling doesn't turn up much. Is anyone aware of any advancements on this front? Edit: When i say "output a valid piece of code", I mean an AI or something similar working out the logic and the flow of control and implement it in an imperative language. Imperative language only, since that's the tough part. Nevertheless, if you know of any new languages being developed to support this kind of idea, please do mention, as maybe our current set of languages are not suitable for the kind of early AI we may first chance upon.


title: I want to sell my application in Google Play Store, but I want the code to be open-source. Which license should I use?

text: I would like to sell the compiled binary of my android application in the Google Play Store when it reaches production. Which license can I use to prevent people from downloading my source code from the open-source page and selling an exact copy of my work on the play store? I want the code to be free and open for geeks/hackers to download and play with, but I don't want people who check out my source code to have the ability to use it for commercial use.


title: Inspiring People

text: So I work with a few people that I feel are intelligent but don't seem to be working out well. After working with them for a while I have seen the flashes of brilliance but mostly I see a reliance on others. What I mean by this is that most times it seems like at the first moment of trouble they go ask for help. Now personally I am all for helping and spend a significant portion of time helping others with whatever they need, but after helping others for so long I have noticed a disturbing trend. These people seem terrified that they might make a mistake and because of this they don't try. So my question is how can I motivate someone who is afraid of making a mistake? In my career I have always learned the most by making mistakes and learning from them. Personally I feel that if I hadn't learned so much I would never have made it as far as I have. So how can I get them to discover that they have the ability to figure it out themselves and that if they make a mistake and learn from it they will be better off. I feel that if I can discover some way to properly motivate them that we all will be better off.


title: Why is C# ASP.NET generally not regarded as a rapid web development framework?

text: The terms rapid web development gets associated with Python/Django and ROR. Why is this not the case with C# ASP.NET?


title: Is it right to appraise Scrum members according to number of successful user stories completed?

text: When my Manager told to team that " ** _now onwards successful user stories will be considered for appraisal!_** " We sat there for while shocked and that was one of the several jaw dropping moments he gave us :-) We felt that was stupid idea, since this will ruin all concept and goal of agile development methodology. Let me know what you people think? and how can we convince him?


title: Common Qt Producer/Consumer Example: What is the point of multithreading here?

text: While trying to figure out how to implement a Producer/Consumer Queue in Qt, I stumpled upon several SO answers, blogs and sites linking to this site: You're doing it wrong... I got the point of this site, but people are usually referring to the code example which is in the referenced blog: Threading without the headache The blog has a small code example attached, the core of it being posted by KornP in this SO answer: Qt moveToThread() vs calling new thread when do we use each So if you take a closer look we have the following behaviour:   1. Producer P produces an item, while Consumer C waits for events to appear in its event loop.   2. P forwards the produced data through a signal and returns to event loop idling.   3. C receives the signal in its event loop and consumes the data.   4. C emits a signal to the producer thread and returns to event loop idling.   5. Start over from 1. In other words: while P is producing, C does nothing and while C is producing, P does nothing. What is the point of having a producer and consumer **like this** in two different threads?   Wouldn't a single thread accomplish exactly the same?


title: Early attempt to remove Python GIL resulted in bad performance: Why?

text: **This post** from Python creator, Guido Van Rossum, mentions an early attempt to remove the GIL from Python: > This has been tried before, with disappointing results, which is why I'm > reluctant to put much effort into it myself. In 1999 Greg Stein (with Mark > Hammond?) produced a fork of Python (1.5 I believe) that removed the GIL, > replacing it with fine-grained locks on all mutable data structures. He also > submitted patches that removed many of the reliances on global mutable data > structures, which I accepted. However, after benchmarking, it was shown that > even on the platform with the fastest locking primitive (Windows at the > time) it slowed down single-threaded execution nearly two-fold, meaning that > on two CPUs, you could get just a little more work done without the GIL than > on a single CPU with the GIL. This wasn't enough, and Greg's patch > disappeared into oblivion. (See Greg's writeup on the performance.) I can hardly argue with the actual results, but I really wonder why this happened. Presumably, the main reason that removing the GIL from CPython is so difficult is because of the reference counting memory management system. A typical Python program will call **`Py_INCREF`** and **`Py_DECREF`** thousands or millions of times, making it a key contention point if we were to wrap locks around it. But, I don't understand why adding atomic primitives would slow down a _single_ threaded program. Suppose we just modified CPython so that the refcount variable in each Python object was an atomic primitive. And then we just do an atomic increment (fetch-and-add instruction) when we need to increment the reference count. This would make Python reference counting thread-safe, and shouldn't have any performance penalty on a single-threaded application, because there would be no lock contention. But alas, many people who are smarter than me have tried and failed, so obviously I'm missing something here. What is wrong with the way I'm looking at this problem?


title: Coarse grained remote interface vs encapsulating business logic

text: I'm writing a Web Service that will be consumed by a Mobile client. The Mobile client has to make several chained requirements checks to determine whether the user may initiate a request, and if so what type. If any of the checks fail then the user is redirected to a UI explaining why. I can't decide whether I should expose an operation for each check on my Web Service, or expose a single coarse-grained interface that simply returns all the check value results in a single DTO. Is the coarse-grained interface premature optimisation? I can always provide both the fine-grained and coarse-grained interfaces because the coarse-grained interface will use the local fine-grained methods to build its DTO.


title: What is your experience working for IT outsourcing company in the professional sevices and/or managed services?

text: I am from the UK. I have about 4 years experience working for a large European IT outsourcing company. This company was split into two; professional service and managed service. I only worked in the managed services and there was a lot of resources issues concerning reaching customer's expectation and there was a lot of conflict priority. I didn't enjoy may experience as a lot of arguments were involved with all internal parties and conflict of interest with external customers, legal matters etc. I do think now that perhaps, as a employee, I do not want to work in IT outsourcing company and just work for a company that handle its own IT services. I am wondering what has your experience been like? Are you or have you worked in the professional services or managed services? what was your experience like? Have you worked in both services and what is your preference? Look forward to your responses.


title: Running SQL Server Express on Micro/Extra Small VM

text: I'm exploring options for running a small cloud Windows Server (either AWS EC2 Micro or Azure Extra Small). The server won't be hit very hard, but I need to run a simple relational database, which I'm expecting to be moderately sized - probably a few tables with a few hundred thousand records, and running a few thousand queries a day to aggregate the data. I'm most familiar with SQL Server, so I'm looking into using SQL Express. However, the system specs are well below the recommended values for SQL 2012 Express. 2008 is a little better, but still not great. Anyone have experience (good or bad) with running SQL Server Express on one of these servers? I'll definitely do some testing before making a decision, but with the inconsistency that comes with these shared computing solutions, I can't be confident after just one or two testing sessions, so anecdotal evidence would be great. If SQL Server doesn't work well, I'll be looking into other solutions - it seems Postgres works well in a wimpy server, or maybe MySQL or one of its forks, or possibly cloud database hosting like Azure SQL Databases.


title: how to manage new private variables introduced into class?

text: Whenever I want to add a new functionality, I introduce a new private variable into the class. Declare it just above the first method definition. leave a small comment. Set it in a certain method. And then use this set value in another method. Now the possible problems which arise are, I dont cover all the possible cases when to modify the value of this variable and only notice a bug in it when during trying various possible user flows of the software. Is there any possible way to tie this value to some kinds of triggers so that I know all the possible situations when to modify its value? I am using Javascript. For e.g. I create a status message for editing an existing DB record. If the updating is failed over REST HTTP I set the status. Now I forgot to reset the status when I dont hit update button and instead select another record for updating. What is the best way to manage such new private variables? How to mange their state? what is the best software engineering way to prevent such mistakes?


title: Implementing the transport layer for a SIP UAC

text: I have a somewhat simple, but specific, question about implementing the transport layer for a SIP UAC. Do I expect the response to a request on the same socket that I sent the request on, or do I let the UDP or TCP listener pick up the response and then route it to the correct transaction from there? The RFC does not seem to say anything on the matter. It seems that especially using UDP, which is connection-less, that I should just let the listeners pick up the response, but that seems sort of counter intuitive. Particularly, I have seen plenty of UAC implementations which do not depend on having a Listener in the transport layer. Also, most implementations I have looked at do not have the UAS receiving loop responding on the socket at all. This would tend to indicate that the client should not be expecting a reply on the socket that it sent the request on. For clarification: Suppose my transport layer consists of the following elements:               TCPClient (Sends Requests for a UAC via TCP)     UDPClient (Sends Requests for a UAC vid UDP)     TCPSever (Loop receiving Requests and dispatching to transaction layer via TCP)     UDPServer (Loop receiving Requests and dispatching to transaction layer via UDP)      Obviously, the *Client sends my Requests. The question is, what receives the Response? The *Client waiting on a recv or recvfrom call on the socket it used to send the request, or the *Server? Conversely, the *Server receives my requests, What sends the Response? The *Client? doesn't this break the roles of each member a bit? **Update** I did a packet capture on an SIP Invite transaction between Ekiga and a PolyCom server. Ekiga was the client, and the polycom was the server. In the invite request Ekiga used port 5060 in the via header. 5060 is the port that its UAS is listening on, so that would seem to indicate that the UDPServer is receiving the responses to all requests and not the UDPClient that sent the request. Is this valid reasoning?


title: How to Get Myself Up to Speed in Building a Java Web App

text: I'm a new developer at a fairly large company and I'm working on a Java Web Application with a senior developer there. The Web App is built on top of an IBM stack (RAD, DB2, WebSphere) and basically uses JSPs and Servlets. The Web App is an internal tool to be used by employees to manage data coming from Excel files. So, there are lots of database interaction going around like SQL commands. My question is: I don't know much about JavaEE as a whole and only know a little about JSPs and Servlets and I would like to get myself up to speed so I can understand and contribute to the Web App as fast as I could. What resources (tutorials, links, etc) should I be looking at? Am I supposed to get a book about JavaEE or something that focuses just on JSPs and Servlets? EDIT: What I know well that I think is relevant:   * Java SE   * Object Oriented Concepts   * Some JSP & Servlets I just graduated from college so I don't have a really wide knowledge of frameworks and such yet but I spend a lot of time reading blogs and working on some small programs (not necessarily Java, more Python really.)


title: How Add/Create* commands should be handled in CQRS + Event Sourcing architecture

text: I want to implement my first application using CQRS pattern along with Event Sourcing. I am wondering how creation of aggregate roots should be handled properly. Let's say someone sends CreateItem command. How it should be handled? Where the event ItemCreated should be stored? As first event of a new Item? Or should I have some kind of ItemList entity that aggregates all items and its event list consists only of ItemCreated events? Udi Dahan suggests not to create aggregate roots and always use instead some kind of fetch method. But how I can fetch something that is new and certainly does not have any ID assigned. I understand the idea behind and it is pretty reasonable to think that a new object is an object that has its state composed of zero events replied on it. But how should I use it? Should I have a distinct method in my Repository like `getNewItem()` or make my `get(id)` method accepting `Optional<ItemId>` instead? Edit: After some time of digging I found really interesting implementation of the aforementioned patterns using actors. The author instead of creating the aggregate, retrieves it from some kind of repository with newly created UUID. The drawback of this approach is he allows for a temporary inconsistency state. I am also wondering how I can implement `delete` method with such approach. Simply add Deleted event to the event list of the aggregate?


title: How do I know if I'm violating MVVM with WPF?

text: I was recently grabbing an auto generated TreeViewItem from a nested TreeView node in WPF, and I was using ItemContainerGenerator to get it in code behind. Then I thought to myself I'm certainly violating MVVM right now. What are some other signs that someone is violating MVVM ?


title: .NET - refactoring code

text: I have inherited and now further develop a large application consisting of an ASP.NET application, VB6 and VB.NET application. The software was poorly written. I am trying to refactor the code as I go along. The changes I am making are not live (they are contained in a folder on my development machine). This is proving to be time consuming and I am doing this along side other work which is the prioritiy. My question is: is this a practical approach or is there a better methodology for refactoring code? I don't have any experience with version control software or source control software and I am wandering if this is what I am missing. I am a sole developer.


title: Dependently typed language best suited to “real world” programming?

text: Which _dependently typed_ programming languages could be used for real world _application development_? I will mostly be writing toy applications at first, after that maybe web development or a simple DBMS. These are some points, that I think are important:   * documentation   * example programs   * a good/big standard library   * an easy to use foreign function interface   * a community of people using the language for real world tasks   * tool support I am aware that there is currently no language that meets all these requirements. I'd like to know which one comes closest.


title: Building presentation layer directly on data layer

text: My application is currently quite a mess and I'm trying to untangle it all. My current idea is that I should have 3 separate layers:   * data layer that knows how to keep stuff in database (and handle data schema changes, so it's not really that trivial)   * domain layer (is that correct name?) that does all the magic changing the objects and processing events triggered by user requests   * presentation layer that knows how to show to user only what that user is allowed to know (some data is hidden from user just because) My initial idea was that having a data object I can build domain object from it, then build a view object from that one and then serve it to user. However I'm now thinking about building view object directly from data object.   * If the user just queries some information, I fetch the data from database, get the nice presentation of it, then serve it to user. Not touching the domain layer at all.   * If user performs an action, I fetch the data, build models from it, do the magic object interaction, save it all back to data layer, then wrap it into presentation and serve. How bad is such design? Unfortunately I am not well-versed in software architecture/design terminology thus I might be failing to find the answer just because I don't know how to name things. Edit: I don't mean to discard the Model part completely. I just mean that I will have Model sitting on Data and View sitting on Data too.


title: If you got to rebuild Pandora from scratch, what technology stack would you choose?

text: Requirements:   * many different user experiences: website, mobile, etc.   * user management, registration, roles   * large amount of music metadata   * genome search that finds closest music   * public and private RESTful API for all functions   * massive server-side service scale


title: How do you find time to work on Open Source Projects?

text: A bit of background: I've got a small open source project that I've started on, a basic framework which provides an object oriented means of generating HTML code (since I don't really like HTML, and I do like PHP). It has some released source, and a few downloads, but primarily, the project is for me, with the Open Source portion just being a side benefit. The original project which caused me to be able to develop on this project has mostly gone into hibernation for the time being, which means that all the development I get to sink into it at this point is personal time only. Unfortunately, I'm currently working toward my bachelor's degree, studying for certifications, and I have a three month old baby at home. In short, by the time I get around to "me time", I rarely feel like doing work, but rather usually feel like just chilling out. So, if there's anyone else out there who feels like they're in a similar position, what strategies have you used to keep yourself motivated toward working on the project? I would really like to at least be able to work on this until I have 100% spec coverage, but I haven't committed source in months. Anyone out there who can help?


title: What's in a name? Revision vs Timestamp

text: Apparently naming things is one of the hardest things in programming..! I have a synchronisation implementation which uses timestamps (number of seconds since unix epoch) to sync. Currently, the timestamps have simply replaced an older revision field. My question is, does it make sense to name it "Revision" or is "Timestamp" better? Revision makes sense to me since that's what's used to version an entity - to know what's created, updated, deleted. But if I needed to increase the granularity of the revision field in the future (ie. to become a decimal, to include fractions of a second), I wouldn't be sure that a decimal revision would make sense. On the other hand, perhaps I want to move away from timestamps in the future (ie. to sequence numbers) in which case revision would make sense.


title: When to use DAG (Directed Acyclic Graph) in programming?

text: I recently found a framework named ecto. In this framework, a basic component named "plasm", which is the ecto Directed Acyclic Graph.In ecto, plasm can be operated by ecto scheduler. I am wondering what's the advantage of this mechanism, and in what other situations can we exploit the concept of DAG?


title: Should functions be prepared for overlapping buffers?

text: So I have a function in C like this:               void crunch(const char *in, char *out, size_t inLen, size_t outLen)     {         //...     }      If the two buffers overlap, the function may mess up the input buffer as well, while generating output.   * What's the general practice?    * Should I always consider overlapping buffers when implementing functions like this?    * Should I assume that the user won't pass overlapping buffers?    * Should I always document whether the function works well or not with overlapping buffers?


title: Are there guidelines for SOA events and file transfers in a SOA context?

text: We are part of a SOA implementation. We publish events via the enterprise bus for certain changes in our system. The architects here have advised, however, that some bulk changes to data should go via a flat file (generated by our system) and handled (moved between servers) by middleware, because they want to avoid overloading the bus with data. (It would be possible for us to publish a single event containing all the changes as opposed to many single events, which would perform much better, but for some reason they do not want this). More recently, a contention has arisen over a price list that we produce. The original requirement for us was to produce a flat file on a daily basis (which would be a lot simpler than communicating real-time pricing changes). In this scenario, we fought off requirements from the consumer system to tailor the data a specific way. Our argument is that in a SOA context, our output should be consumer-agnostic, so as long as it contains the necessary data, it can be transformed by middleware into the required target format. Now, however, architecture has again intervened, saying that publishing a price list is an event that could/should go via the bus. We are not sure we agree with this, and why, in the case of bulk changes mentioned above, a file transfer is acceptable which effectively bypasses the bus. I guess my question is manifold:   * Are there guidelines around what data should be contained in an event in the SOA context?   * Is there place for file transfers in an event-driven architecture? If so, is my assumption correct that we could be exporting a file containing pricing information in our own format, and leave it to middleware to transform?


title: Understanding algorithms for numeric constraint solving

text: As an educational exercise, I am looking to implement a constraint solver from scratch. However, since the field is entirely new to me, I am at a loss of where to begin with background research. The problems I aim to address are mostly sets of inequalities, such as `a < b && b < c`, where `a`, `b`, `c` are integers. (While it is possibly not relevant to the question at this stage, I do aim to address problems with other numeric types later on). The algorithms I have looked at so far are in the _branch-and-bound_ and _branch-and-cut_ categories mostly. However, if I am looking for a generic, efficient algorithm, is this what I want to be looking at? It would be very helpful to receive some guidelines here.


title: Scrum: Baseline story for point estimation

text: To estimate PBIs you need to choose an average story and assign it a number of points (for example 5). Then you compare all other stories to that story and assign points accordingly. My question is, are you really supposed to compare every single story to that original story from the beginning of the project? If not, then how do you make sure your scale remains more or less consistent throughout the project? Thanks.


title: As a C# developer, how much "advanced" Java do I need for Android development?

text: I'm a professional .NET -C#- developer who's interested in doing development for Android. I'd like to know if it's really necessary for me to first read a book or two on Java (like Java For Programmers 2nd), or if I should just be able to pick up an Android book (like Pro Android 3) and be able to -mostly- work my way around it without much fuzz. **Note 1** : Java is not 100% new to me. For testing purposes, I've previously done a few -very basic- console applications and web applications. **Note 2** : I'm not trying to shift from .NET to Java / Android anytime soon. I just wat to develop applications for myself and this wonderful community. :)


title: Algorithm for detection of overlapping between vectors

text: I am currently developing a math-physics program and I need to calculate if two vectors overlap one another, the one is vertical and the other is horizontral. Is there any fast algorithm to do this because what I came up so far, has a lot of repeats. Eg lets say we have vector V1((0,1),(2,1)) and a V2((1,0),(1,2)) where the first parenthesis is the coordinates starting and the second coordinates that the vector reaches. I want as a result to take that they overlap at (1,1) So far the only idea I came up is to ''expand'' each vector to a list of points and then compare the lists e.g for V1 its list would be (0,1) (1,1) (2,1)


title: Why is Moore's Law seen as an absolute truth?

text: Often times I read things like: "Intel stated that either the next generation or generation after that will likely fail Moore's Law." Why don't they just say Moore's Law will fail instead? I don't know why it's held as some sort of standard that must be upheld? Why not aim for the highest progress instead of limiting yourself with arbitrary expections?


title: Are problem-solving programming questions useful for improving one's general programming ability?

text: For example, like: * * * The inaugural International Olympiad in Frogleaping is being held in Australia in 2013 and you are determined to win. While you want nothing to do with such slimy, jumpy creatures, you plan to enter a frog-like robot that you know will be faster than all the other organic entrants. The IOF takes place in a large pond in which there is a sequence of lily pads arranged in a long line. The rules of the race are simple: your frog will be placed on the first lily pad, then it must jump to the second lily pad, then the third and so forth until it reaches the last lily pad in the course. Note that you can not `skip' lily pads--every lily pad must be jumped on exactly once. The first frog to reach the last lily pad will win the race. Since your robotic frog has super-frog speed, you are confident in your victory. However, your frog has one minor incorrectable flaw--it is only able to jump one fixed distance. Specifically, it can only jump exactly K metres forward from its current location, even if this lands the frog in the water (where it will promptly short-circuit). Since the initial lily pad positions may make it impossible for your frog to reach the last lily pad, you plan to create a distraction and move the lily pads so that they are spaced exactly K metres apart, enabling your frog to jump from the first to the last without falling in the water. Shifting a lily pad by one metre will take you one second, and the longer you spend stealthily moving lily pads, the more likely that the IOF judges will notice and disqualify you from the competition. Given the initial distances between the lily pads in the course, you must write a program to compute the minimum time you will have to spend shifting lily pads such that all pairs of consecutive lily pads are exactly K metres apart. You can assume that the pond is sufficiently long so that the first lily pad can be moved any distance back, and the last lily pad can be moved any distance forward. # Input Your program should read from the file frogin.txt. The first line of this file will consist of two space-separated integers N and K. The following N-1 lines will contain the initial distances between consecutive pairs of lily pads. Specifically, the ith line will contain one integer representing the distance between the ith and (i+1)th lily pad. # Output Your program should write to the file frogout.txt. Your output file should consist of one line containing one integer: the minimum total time spent shifting lily pads so as to ensure your victory. * * * This is a sample problem from the Australian Informatics Olympiad, which I happened to come across searching on the internet. But I do not believe that any programming-related problems which do not directly connect with real-life situations will have any helpful effects upon one's real-world programming ability. Will they?


title: What are and how do (data-) types work?

text: 1. What is a "variable"/data type?   2. How does a compiler / interpreter handle types? My specific concern has to do with the different types in lower and higher level languages. For instance in Python, as `list` is really flexible. You can just define it and put in at runtime whatever you want.   * `int`s   * `float`s   * `str`ings   * `set`s   * even other `list`s Basically objects of any type (if I'm not mistaken). So I imagine `list` to be a class written in C with really a lot of stuff in there, dynamic memory allocation and so on and so forth, to handle all this.   * Is that right?   * ..and does that mean all those e. g. Python types are C classes?   * Then what are types in C?   * Are they "classes"?   * ..or somehow related to assembler code? PS: I'm not looking for some precise illustrative hints and answers rather than for a wide exhaustive explanation. And: This questions are not related to "There are no variables in Python, but identifiers".


title: Password insanity! Recommended approaches to password management on multiple client systems?

text: A software development company I work with has a web based product they are successfully selling to clients. All of these clients have a support agreement with us that generally requires us to access their servers, databases and application data. As the number of clients grows, (and the number of different people supporting those clients grows), we are seeing a need to better manage in particular **passwords** , but more generally all the information one would need to fully support client systems ie. URLs, application login details, IP addresses, any client-specific weird stuff etc etc. This data is changing on an increasingly rapid basis, as systems get moved around to different machines, IP addresses. The worst problem is superuser passwords for the applications. These are constantly changing and occasionally we find ourselves in a situation where nobody seems to know who made the most recent change. This is clearly an unsatisfactory situation. There are **procedures** in place which say that password changes etc need to be documented in a central secure place. But of course, people being humans, sometimes forget to document these things. The danger is that when people get so fed up of password chaos, that you can end up with a situation where everyone's password is " _password123_ " as they can't be bothered any more. Apart from enforcing the procedures, what other approaches could we take? One suggestion I heard was to have a "hidden" application superuser whose password is easily remembered/derived, which only support personnel would know about it. Personally I think that solution is a scary security hole, especially when you have multiple clients using your software. So how would you handle this situation if you were supporting multiple clients? More strict procedure enforcement, or a technical approach to make life easier for everyone?