title: What is the job of a language virtual machine, and creating one

text: Recently I have become incredibly interested in language development. The past few weeks I have written many language front ends (lexer, parser) including a calculator language/expression parser and much more. After creating so many things I have realized there MUST be more abstraction between parsing and code execution than what I currently have, which leads to my main question(s). My first question is, this. What exactly is the job of a language virtual machine, like for example the JVM (of course my envisioned system would be much, much much more smaller scale). What does it do? Does it actually sort of emulate hardware and execute low level instructions on the emulated hardware? Or does it simply provide an abstraction and execute lower level managed instructions on the system? (I have read this question but it hasn't really helped me understand) Second question. What exactly is byte code? Is it some sort of machine code for the virtual machine? Or is it the human readable possibly assembly like instructions, and are these instructions directly executed or somehow compiled to native code? Third question. How would I go about implementing this? I consider myself a competent programmer and don't need step by step instructions by no means, just an overview of what exactly I need to be doing, and how low level this is exactly. Thanks so much for any help/suggestions/explanations. Please ask questions if something I stated was confusing or you need more detail on it. Thanks again!


title: What is Development Environment? e.g. Vagrant

text: By luck i landed on this website http://www.vagrantup.com/ It is says, that software is for development environment. My question is what exactly definition for development environment (in this case is vagrant)? I wondering what vagrant can give benefit to me as PHP web developer, my current thoughts for development environment is Web Server. Is that right?


title: Using a public username as a login username

text: It has just dawned on me, that a system I am developing exposes a users username in the URI. This is a problem, since some of the users pages are public. Therefore people will know their username. I thought that this would be a security issue, but then realised that big names like twitter do the same thing. Pretty much every single twitter user has their username on full display. If a big name like twitter see it as safe, should I also assume the same?


title: Prevent developers from using constants

text: I have one one software system which allows developers to specify an ID or name to create `NodeReferences`. Both work fine, but ID's are not guaranteed to be the same across different environments. I've tried in documentation and in conversations to stress that ID's should not be hard coded (since they will break when deployed to a different environments), but some developers are still using them. This works only in dev environment:               var level = LevelReference.ById(20);     var node = NodeReference.ByName(level, _patientGuid.ToString());      This works in all environments:               var app = ApplicationReference.ByName("Reporting");     var area = AreaReference.ByName(app, "Default");     var level = LevelReference.ByName(area, "Patient");     var node = NodeReference.ByName(level, _patientGuid.ToString());      I think the appeal is just that it produces fewer lines of code. The use of ID's is not by itself bad (since there are valid use cases like caching the ID returned from the server and using it later for faster look-up), but hard- coded ID's are bad. Most of the time the first code will throw an exception, but it's possible that it could be a valid ID for a different object than the developer intended, and this could result in very bad problems. What's the best way to discourage the use of such constants in code? Ideally I'd like throw some kind of compiler error when I see code like the first example, or at least throw an exception before the call gets down to the database.


title: Which languages are used today for low-level programming?

text: When I hear low-level programming, such as for drivers, embedded systems, operating systems, etc., I immediately think about C and perhaps C++. But mainly C. But what other languages are also used for these kind of tasks? Today, I mean, not what _has been_ used.


title: Should QA file 5 separate bugs or one bug with multiple parts in it?

text: The question might not be as simple as it sounds, as we have struggled with this a bit. If there are 5 separate bugs, which can be taken care of with a single fix, then it is wasteful to take this approach. One bug might slip through the cracks, and would take away from a complete picture, or just be hidden for some time (we have several years worth of outstanding bugs, and our bug tracker sucks at searching :( ). Now, if you file a bug of 100+ parts (such as help tooltips are missing from all 234 dialogs), then it should be treated as a project and be broken down. However, if it is a bug of 3-4 parts, then the developer would attempt to fix all 3 or 4 at once. This is where it gets interesting. What if the coder only fixes 3 or 3.5 out of 4? Should after testing a new bug be filed and old one closed? If yes, then this invites sloppy programming practices, where close enough is good enough. If the bug is to fail, then all of it has to be re-done and re-tested. Now ... what if part 1 is the size of a breadbox in terms of size and risk, part 2 is more like a car, part 3 is like a house, and so on :) When sizing and prioritizing this bug (I must mention that we use Scrum), the house part was not noticed - who reads anything but a bug title anyway? So, it was deemed a low hanging fruit - low effort, low risk, happy user = high reward. But, we got bitten with one of them recently. What seemed to be logically the same area, was actually code in transitional state, where we are trying to deprecate one method of doing things, or one library for creating widgets with another, new and better. The problem is that we had to release mid-conversion, so we made two very different beasts look alike. Our QA folks did not know that, are not expected to know that, and so in their mind these are all the same issues. We need to be QA-friendly - not to push back too hard or too often, but also try to give a set of heuristics which would help to decide whether to file one bug or many. I suppose the problem might lie with weak tools, where splitting and merging bugs is hard to do. However, how do you deal with this stuff in general? P.S. In Scrum - once you committed to fixing something, it probably should be fixed. Break this rule too many times and discipline will degrade.


title: Tool to manage requirements throughout a software development lifecycle

text: I am looking for a tool to manage requirements or features for a software development project. It will be used by a small geographically diverse team of 5-10 people to raise, discuss and track requirements. Consequently it will need:   * Support for multiple users   * Web-based   * Support a hierarchy between requirements, e.g. parent / child relationship   * Provide a means for discussing individual requirements   * Support file uploads   * Cost effective. Ideally free or  Some of the project management tools available are overkill or focus on tasks or resource scheduling rather than features / requirements. Does anyone have a solution?


title: Is this a poltergeist or is it justified?

text: I've come to a point in re-design of my code where I face an imminent Poltergeist Anti-Pattern threat. A master application object has two "eye" objects. Eye objects have a "RenderHUD" function, which is supposed to use (a) the state of the eye object, and (b) the state of the application object to render the HUD at each frame. I have a function right now that derives the HUD info from the application object, and then passes these as arguments to the "RenderHUD" function of each eye. The problem is that these argument lists are reeaaaaly loooooong. Obvious solution is to put them all into a struct, e.g. HUD_Info. But that would be a new poltergeist that would be created and destroyed with each frame, right? Any easy way to avoid that?


title: Learning YACC nowadays, does it make sense?

text: I have a huge project that is using YACC and I would need to fix a bug in it. I might ask someone else who wrote that to fix it but I'm interested in how compilers work. Does it make sense to learn YACC nowadays? It was told me that it's old and obsolete. I would love to understand how compilers/llvm and other stuff like those work... what about YACC?


title: programming algorithm - bulls and cows game

text: I am working on a Bulls and cows game. And I have the following code that calculated the number of bulls and cows: let User and comp be the lists that have the 3 digits that the user entered and the number randomly generated by the comp               cows = 0          bulls = 0          for x in User:              if x in comp:                  if comp.index(x) == User.index(x):                      bulls += 1                  else:                      cows += 1      This works completely fine, unless the number generated by the computer has repeated digit(like 277) and I enter 447. then what happens is that I get 1 cow and zero bulls. Whereas I should get 1 bull and 0 cows. **Note that there is no issue with the game when there are no repeated digits.** I am unable to get what the problem is and why it is occurring. I would greatly appreciate any kind of help in understanding the root of this problem. **more importantly** I want to get this done with. So I want a clarification on this approach or I want a new way to think about this. I am using Python Tkinter to program this game. **please** help me with this issue.


title: will having an event with subscribers prevent an object from being GC'ed?

text: I have an object, which has an event which in turn has subscribers. I know that the subscribing objects won't get GC'ed since the delegate they stored for the event is connected to them, thus keeping them connected with the object graph, until one explicitly unsubscribes them. This is only logical since otherwise nothing good will happen when the event is fired. **Does this apply to the Event-owner as well?**   I would _think_ it does not, since the subscribing objects do not have a connection to it, to my knowledge. And again using common sense (which I know does not neccessarily relate to IT-reality): Nothing bad can happen if the event-owner is GC'ed, only the event will never fire (again). **Is this assumption correct?**


title: Is MongoDB the right choice in my case?

text: I'm going to build my first real project in Rails that consist in a web app made of 3 main parts:   * The static part where no database is used   * The User registration part which will require a database and I can use MySQL since each user's row will have the same fields   * The "App" where users will be able to create, organize, edit... items in collections and share them with other users There will be several item types and each one will have different options for example I may have "video" items with the following options:   * id   * user_id   * collection_id   * title   * platform (if embedded)   * url (if embedded)   * file name (if hosted on my app)   * file size (id hosted on my app) and "map" items:   * id   * user_id   * collection_id   * title   * platform (google maps, bing maps...)   * location   * url   * map size As you can while for users I may use MySQL for items the flexibility of MongoDB may be useful since each item may need different options then another item Up to now I've always used PHP and MySQL (always on shared hosting for small projects) and scalability is a totally new word for me. I have time to learn but I would like to be able to do something concrete in something like 1 month. I've read a lot about MongoDB and NoSQL vs RDMS and MySQL and after trying it I have to say that I like how MongoDB works: no tables, no rows and its documents JSON like so:   * In my situation what would you raccomend? why?   * About scalability there may be problems with MongoDB? if yes when (in term of DB size) and may these problems slow down my app considerably? **Edit: how the app will work** Since many asked this is how I'd like the app to work:   1. A user sign up   2. He's logged in   3. He create his first collection iside which he can create infinite items   4. Items are of various type and each type need different data to be saved in the database and type of items may be added or modified  Users may create other collections and items inside it. So we have CRUD for collections and items inside of them and each collection/item is referred to a specific user The main problem with MySQL is that it hasn't a flexible schema, there is way to solve this (a workaround?)? Thinking about NoSQL the only doubt I have is about join, for example given a certain colection I want to retrieve datas related to the User with id = user_id field in the collection **EDIT: Idea to keep using MySQL** Create a field in the "items" table with optional settings, each setting divided by a | or another symbol. Then I will save somewhere a structure of each item optional settings, for example the "notes" item type need two optional settings "colour" and "strange_setting", when I get the data from MySQL i will split the field for optional settings into an array knowing that the first item in the array is for "colour" and so on. What do you think? there are problem with that solution? do you have other ideas?


title: which is better of these two architectures and why

text: PhpServer will handle gSoap requests and http requests from clients.   PushServer will push notifications to clients and act a file server. There are many server machines. Every PhpServer will communicate with a specific PushServer when needed. Every PhpServer needs to register itself to a PushServer letting the PushServer to help push notifications to clients. Here are two architectures:   1) Architecure A   This architure will run each PushServer with a PhpServer on the same machine. Each client will register itself to a PhpServer and the PushServer which is running on the same machine with the PhpServer                                     |Database|                           _____|_____                          |           |                          |           |                   (|PhpServer| + |PushServer|)   //a same server machine                           \            /                             |Client|      2) Architecture B   This architure will run each PushServer on a single machine. Each client will register itself to a PhpServer and the PushServer which the PhpServer registers.                                     |Database|                           _____|_____                          |           |                   (|PhpServer|)  （|PushServer|） //two server machines                               \            /                             |Client|      Which architecture is better and why? **[update]**   We are worried about performance, extensibility, and flexbility. Actually the first achitecture is what we currently have and if we choose the second one, we need to modify our software: PhpServer, PushServer and Client. Thus, unless the second network architecture is much better (from load-balancing or network application design perspective), we won't choose the second one.


title: Verification & Validation books

text: So I need some help with Verification & Validation of software. So I know the definitions of both but ... I can't really find any real entry level books about the process from setting up the requirements of a customer, to making the finished product. And of course, making sure you tested it to what you think it should do, and what the customer actually wants. Can anyone recommend me any good entry level books, blogs, pretty much anything that just gives an overview of V&V? I'm pretty much just looking for concrete methods/examples on how to deal with all. I have looked, and found some good (advanced, if you ask me) texts scratching the surface of V&V, but nothing entry level :( Any help is greatly appreciated.


title: Should I support IE compatibility mode?

text: So I have a client that is running multiple versions of multiple browsers. I currently support IE7, IE8, IE9, Firefox4/5, Safari 5 and Chrome. The site works in all the named browsers. IE has a feature called 'compatibility mode', the current bane of my existence. The problem is that in compatibility mode, form buttons work differently. I won't get into the details but it would be a major effort to make the site support 'compatibility mode'. Is this something that there are frequent requests for? Am I off my rocker to push back on the client and tell them this just isn't an option?


title: Should I rely on Visual Studio in adding HTML and CSS?

text: I am wondering if I should rely on Visual Studio in adding HTML and CSS elments by using the viusal toolbars or should I write them by myself? Is it considered bad practice if I relied on Visual Studio to do that?


title: Would you contribute to open-core software?

text: I recently considered contributing to an open-core software (a product which core is released with an open-source license by the company that developed it, but it retained a paid license for more advanced functionality). But some questions occurred about the nature of working with an open-core project, and I would like the input of the community. My question is would you still be motivated to contribute if:   * most if not all the software was contributed by paid developers.   * you'd be benefiting the finances of one company (opposed to benefiting the community)   * the direction of the software would be determined by the company and not by you (or the community). I would like also for someone to confirm if those are myths or not   * implementing the same features that are sold by the company won't be allowed.   * forking the project won't be allowed (it might depend on the open-source license). Thank you. ps: Could someone create an "open-core" tag?


title: Why doesn't HTTP have POST redirect?

text: HTTP redirects are done via HTTP codes 301, and 302 (maybe other codes also) and a header field known as "Location" which has the address of the new place to go. However, browsers always send a "GET" request to that URL. However, many times you need to redirect your user to another domain via POST (bank payments for example). This is a common scenario, and really a requirement. Does anybody know why such a common requirement has been neglected in HTTP specification? The workaround is to send a form (with parameters in hidden fields) with action set to the target location (the value of the **Location** header field) and use `setTimeout` to submit the form to the target location.


title: distribution of programming languages in embedded systems

text: I am looking for statistics concerning the distribution of programming languages in the embedded sector. Do you know any good websites, articles or books? I found this as a first reference but am still looking for further information: http://www.eetimes.com/electronics-blogs/industrial-control-designline- blog/4027479/Real-men-program-in-C?pageNumber=0 I need this for my bachelor thesis which is about programming the HAL of microcontrollers using OOP.


title: How important is it for programmers to look and behave smart?

text: I know that looking and dressing good is of vast importance in fields like sales, marketing, and human resources. But is it really important for developers, even when they aren't directly contacting clients or third parties? Can a developer get away with dressing shabbily, and still get the raises he deserves on the sole basis of his coding skills?


title: Loading next level after complw=etion of previous

text: i am creating a hangman game in visual studio using C#. how can i load 2nd level after 1st one is completed.


title: Style bits vs. Separate bool's

text: My main platform (WinAPI) still heavily uses bits for control styles etc. (example). When introducing custom controls, I'm permanently wondering whether to follow that style or rather use individual bool's. Let's pit them against each other:               enum EMyCtrlStyles     {        mcsUseFileIcon = 1,        mcsTruncateFileName = 2,        mcsUseShellContextMenu = 4,     };          void SetStyle(DWORD mcsStyle);     void ModifyStyle(DWORD mcsRemove, DWORD mcsAdd);     DWORD GetStyle() const;          ...     ctrl.SetStyle(mcsUseFileIcon | mcsUseShellContextMenu);      vs.               CMyCtrl & SetUseFileIcon(bool enable = true);     bool GetUseFileIcon() const;          CMyCtrl & SetTruncteFileName(bool enable = true);     bool GetTruncteFileName() const;          CMyCtrl & SetUseShellContextMenu(bool enable = true);     bool GetUseShellContextMenu() const;          ctrl.SetUseFileIcon().SetUseShellContextMenu();      As I see it, **Pro Style Bits**   * Consistent with platform   * less library code (without gaining complexity), less places to modify for adding a new style   * less caller code (without losing notable readability)   * easier to use in some scenarios (e.g. remembering / transferring settings)   * Binary API remains stable if new style bits are introduced Now, the first and the last are minor in most cases. **Pro Individual booleans**   * Intellisense and refactoring tools reduce the "less typing" effort   * Single Purpose Entities   * more literate code (as in "flows more like a sentence")   * No change of paradim for non-bool properties  These sound more modern, but also "soft" advantages. I must admit the "platform consistency" is much more enticing than I could justify, the less code without losing much quality is a nice bonus. **1\. What do you prefer? Subjectively, for writing the library, or for writing client code?**   **2\. Any (semi-) objective statements, studies, etc.?**


title: What is some key aspect of C/C++ I need to know?

text: I had some C background back in the university, however, I have been programming in java for 2 years and most of the C stuff were left behind. Now I need to prepare for a test about C/C++, I doubt that I can go right into it with only some remnant of C knowledge. What could they possible cover in the test?


title: Moving a multi-GB SVN repo to Git

text: Currently my company has a Visual Studio solition in an SVN repo that's organized as follows:               SolutionFolder (~3.5 GB)     |-> SolutionName.sln     |-> .. Some source code folders... (~250 MB)     |-> ThirdParty (~3 GB)     |-> Tools         | -> Tool1         | -> Tool2      Tool1 and Tool2 are build independently (have their own solutions), but produce executables that are used in the main build. ThirdParty folder contains all dependencies for the project, including some pre-compiled 100+ MB .lib files and large libraries like boost. It's convenient to have it all in one SVN repo so that (1) developer has to do only one check-out, and (2) we don't need to keep track which versions of dependencies we need for each version of the build. On the flip side, it takes a while to check out this repo. What would be the best way to move this project structure to git? Presumably it's best to exclude ThirdParty and possibly Tools from the main repo, but we'd like to keep ThirdParty easily downloadable in one step, and we like it versioned (and version mismatches between main repo and ThirdParty/Tools would be bad). At this point I'm not interested in preserving history, just in figuring out how to organize such project.


title: Preventing a Javascript object function called twice

text: I am trying to reuse an object but my function is getting called twice. Here is what I have:               var KEYBOARD = {       template: 'keyboard';       getkeyboard: function(){         console.log(this.template);       }     }      now in one file I do this:               $.extend(KEYBOARD, {         template: 'keyboard',      }).getKeyboard();      then in a different file I do:                $.extend(KEYBOARD, {         template: 'keypad',      }).getKeyboard();      Now in the second file the getKeyboard function prints out:               keyboard     keypad      Can someone please tell me what I'm doing wrong? I thought I could change the properties and run them through the function, but for some reason it holds the values of the first object.


title: A new CAPTCHA using sentences?

text: I was just thinking about how recaptcha is getting harder when I thought about another posible solution. Images won't last forever so we will need something else some day - like human logic or emotion. Google and others are trying grouping images by category (find the image that doesn't belong) but that requires a large amount of images and doesn't work for the blind. Anyway, what if a massive collection of text was gathered (public-domain books from each language) and a sentence was shown to the user with 1 (or 2) words that were a select box of choices? Only computers that knew correct English/Spanish/German grammar would be able to tell which of the words belonged in the sentence. Would there be any problems with this approach? I would assume that it would be easy enough for anyone that knew the language that the sentense was displayed in to figure out the answer easier than trying to read the reCAPTCHA text. Plus, storing an insane number of sentences would only take a couple gigabytes of space and wouldn't take anywhere near the CPU time creating images/audio takes. In other words, anyone could host their own captcha system with minimal impact on system performance. **Is there a problem with this approach?** More specifically I'm looking for the main problem with this approach. migrated from stackoverflow


title: Django web app with websockets

text: I want to make a web service using Django, but that also has websocket functionality. Having done a bit of reading, this is the tech stack that I'm looking at:                  ---------------------------------       | Django (handling sync requests) |        ---------------------------------                       |                       | (wsgi)                       |      -------------------------------------     | Tornado (handling websockets, wsgi) |      -------------------------------------                       |                       |                       |      -------------------------------------     | Gunicorn (spawning tornado workers) |      -------------------------------------                       |                       |                       |      --------------------------------------     | nginx (reverse proxying to gunicorn) |      --------------------------------------      So the sync requests (website, most API calls) would go all the way through the stack to Django, but the websocket requests would be serviced by Tornado directly (websocket calls would be distinguishable by the URL). Am I overcomplicating this? I've added the Gunicorn layer because a single tornado worker would block while servicing a WSGI request, but perhaps there's a way around this? I only ask the question because it seems like a lot of layers to me. Does this look like a reasonable way to do Django with websockets?


title: Numerous Sync/Async calls to webservice from hybrid app

text: I have a requirement where I have to make numerous calls to webservice to update the local database. Since I have to support lower-end Android phones also, I'm not yet sure as to how this would be possible without actually exhausting the device memory and eventually crashing the app? Possible issue: Consider I have to sync 100 records to webservice and each of them have particular set of results returned and local database operations linked with it. The problem I am facing right now is, if I use synchronous calls the memory issue become major one and app crashes and if I use asynchronous calls, the app takes too much time and also recognising data returned will be a huge difficulty. **Platform** : iOS + Android **Technology** : AngularJS + Phonegap **Webservice** : RESTful **Note** : Please note that I am using purely front-end technologies and this would be a hybrid app.


title: How do you deal with the details when reading code?

text: After reading some projects, I find that it is not the architecture of the software that is really hard to know. It is not hard to figure out the architecture immediately if the project is clearly designed and implemented, if it's hard and never seen before, some day later I can find out some pattern similar to the one I read in the same domain. The difficulty is that the concepts and mechanism defined by the author are really hard to guess, and these concepts may spread in the whole project which makes it hard to grasp. The situation is normal and universal and you can ask questions to your colleague when in a company. However, it gets worse if nobody around you knows these details. How do you handle these details which block your reading?


title: Share data layer for outsourcing project

text: We are a small team of programmers, and we are now facing a situation where we have to outsource some of the work in order to complete it in time. Project is about website that was previously build with asp.net webforms, EF and SQL server. We have previously build a data layer and optimized SQL, but we need to complete front end of the project. Clients wants asp.net MVC and HTML5. The problem for us is how to open data layer to outsourcing team without compromising or disclosing any data?


title: Should one define an interface and code an adapter for it whenever a dependency is found?

text: Given a particular third-party class/library you want to make use of, the simplest thing to do would be to just hardcode API calls to it through your application. On the other hand you have the possibility of defining a interface that generically dictates what you want -not _how_ -, and then follow the Adapter pattern to bind your interface to the third-party class. I currently feel inclined to the second option because:   * It creates a single point of change if you ever want to replace the functionality provider   * In a similar way, it allows you to add more providers without changing your application code   * It permits following your own naming conventions, simpler method signatures, etc The thing is, I'm not experienced with this approach and I don't know how complicated or inconvenient it can get. I'd also like to know if are there any common errors when following this pattern. In my particular case I don't want to wrap either a giantic library -e.g. a GUI- or a small function. Also there are actual possiblities I'll change my provider in the future, so this is not a YAGNI. Thank you


title: Could it be more efficient for systems in general to do away with Stacks and just use Heap for memory management?

text: It seems to me that everything that can be done with a stack can be done with the heap, but not everything that can be done with the heap can be done with the stack. Is that correct? Then for simplicity's sake, and even if we do lose a little amount of performance with certain workloads, couldn't it be better to just go with one standard (ie, the heap)? Think of the trade-off between modularity and performance. I know that isn't the best way to describe this scenario, but in general it seems that simplicity of understanding and design could be a better option even if there is a potential for better performance.


title: What Java client+server stack to allow async client info popups and responses?

text: Being new to Java I'd like to use the following scenario to steer my learning and could use some advice! First I want to build a Java server app that handles login and client settings, and based on client info pulls up random database entries and sends these random entries to the client on a timer. This must work for many clients, each on their own private timers against the main database, and just keeps looping on timers so it's not a one-shot lookup. Second I want the client to stay logged in all day, and to notify and maybe popup locally with the info from the server. This popup will be a small input form which is then sent back to the server. I can't do this as a web page because I want it to run any time the client wants to start the local app. This could possibly be used as a calendar, meeting planner or schedule notifier for clients which are my user stories. Suggestions on appropriate design patterns and techniques appreciated!


title: Is there value in having new developers (graduates) start as testers / bug-fixers?

text: Hi **Programmers** Community. What are your thoughts on the following:   _Is there value in having new developers (graduates) start as testers / bug- fixers?_ There are two schools of thought here that I have come across.   1. Having new developers (graduates) start as testers / bug-fixers / doing SLA (Service Level Agreement) work, get's them familiar with the code base. It also allows them the opportunity to learn how to read [other people's] code. Further more, by fixing bugs, they will learn certain bad and good practices, which could hopefully help them in the future.   2. The other way of thinking though, is that if you immediately start new developers on something like testing / bug-fixing / SLA work, their appetite for the development world might go away, and/or they might leave the company and you potentially loose out on a great future resource. Is there a balance that should be kept between these two? Currently where I work there is no clear-cut definition of what new starters do. Some go directly on to client work, while some fall in to the SLA world. Should companies have such a policy? Or should it be handled on a case-by-case or opportunity-based basis? Hope to hear from some of you that have experience in this field. Thanks!


title: What is the best way to do development with git?

text: I have been searching the web for best practices, but don't see anything that is consistent. If you have an excellent development process that includes successful releases of your product as well as hotfixes/patches and maintenance releases and you use git. I would love to hear how you use git to accomplish this. Do you use branches, tags, etc? How do you use them? I am looking for details, please.


title: Question about API and Web application code sharing

text: This is a design question. I have a multi part application with several user types. There is a user client for the patient that interacts with a web service. There is an API evolving behind the web service that will be exposed to institutional "users" and an interface for clinicians, researchers and admin types. The patient UI is Flex. The clinician/admin portion of the application is RoR. The API is RoR/rack based. The web service component is Java WS. All components access the same data source. These components are deployed as separate components to their own subdomains. This decision was made to allow for scaling the components individually as needed. Initially, the decision was made to split the code for the RoR Web application from the RoR API. This decision was made in the interests of security and keeping the components focused on specific tasks. Over the course of time, there is necessarily going to be overlap and I am second guessing my decision to keep the code totally separate. I am noticing code being lifted from the admin side being lifted, modified and used in the API. This being the case, I have been considering merging the Ruby based repositories. I am interested in ideas and insight on this situation along with the reasoning behind your thoughts. Thanks.


title: General thought process for "How would you build this website/app" interview questions

text: I've collected a bunch of interview questions like "Describe how you would design a photo album application", "Describe how you would design this particular feature of this particular website" (e.g. likes on Facebook, recommendation on Amazon, shopping cart, game of black jack). Then, what if there are millions of this thing? What would you change? It looks like this is either expecting a database schema or a bunch of class definitions (or both?). I have learned about databases in school but I've never actually architected an application before and am having trouble knowing where to start, whether the designs I come up with are "good" and what I can change to make it scalable. Is there a general approach or thought process when designing these systems? And general issues/problems that seem to come up a lot in the design that I should try to avoid? Could someone maybe walk me through one (or preferably all, while comparing the needs of each) of these and explain: 1) How do you come up with what entities are needed? 2) How do you decide on what relationships everything will have? 3) How do you incorporate performance optimization into your design? 4) Do I do this using classes or databases? Does it make a difference (i.e. would I have a class that can't really be translated to a database table, for example?) The main reason I'm asking is because I was going through "Cracking the Coding Interview" and my answers were completely different from the author's - I had very different ideas of what classes were important. **MY ATTEMPT:** With the photo sharing app, I would have the classes/tables: Photo and User for sure. Then, I think if we're trying to create a schema, there would be a table linking photo and user if we assume each person in the photo is linked to the photo (is this table necessary? If not, is it still common practice to have a separate table for many-to-many relationships or not?). But if we're trying to take an object oriented approach, maybe instead we'd have a class called album which does all the work and has all the info from the two other tables/classes. This is one thing I noticed in the book- there are a bunch of classes and then one class which basically has all the info and connects the other classes- is this common? For example, in my examples above, does this seem like it would apply? I'm just hoping for some general rules/guidelines to follow because right now I have no idea how to tell what a good architecture for a large system looks like.


title: Are functional languages a kind of program derivation?

text: Program derivation is defined as the derivation of a program from it's specifications. Usually this specification language is some form of propositional logic, but from what I understand, it need not be. For the sake of specificity, I'm only dealing with purely functional languages like Haskell here. When you write a program in Haskell, you aren't describing _how_ the computation is done, but what things _are_. For example, in this function that produces Fibonacci numbers, all this is given is a specification for Fibonacci numbers, not how the function should be implemented.               fib :: int -> int     fib n = (fib n-1) + (fib n-2)     fib 1 = 1     fib 0 = 1      To make this code run, the Haskell compiler must convert this declarative specification of the function to imperative machine code. Isn't this by definition a kind program derivation?


title: What is the importance of XML in the world of JSON?

text: How important is it to learn XML when JSON is able to do almost all that I need? Having said that, I use JSON mainly for AJAX requests and obtaining data from various APIs. I am a total newbie to web development and the reason I am asking this is that I want to know whether I should go ahead and buy a book on XML or whether I can just give it a pass.


title: Will official 'Mango' release allow sideloading of apps on WP7 devices?

text: Any news whether the official Mango release will allow sideloading of apps? I mean ability to deploy apps without going through the MarketPlace? I would like to see the ability to deploy my own apps on my own device without using third party services and paying extra fees. I don't plan to publish apps publicly. (I tried ChevronWP7 and it couldn't work as intended. Probably obsoleted by MS.)


title: Builder pattern inside interface. Bad design decision?

text: I am having trouble evaluating an implementation of the builder pattern I just came up with. The context is an API library, so I am trying not to expose any implementations in order to have a stable interface while being able to change implementations later. My thinking is that even though there is a reference to the implementation in the interface's _file_ , the interface and the implementation are not actually coupled because > In effect, a static nested class is behaviorally a top-level class... The benefit of this design is that clients can call `Person person = new Person.Builder().age(20).firstName("John") .lastName("Doe").build();` without the need for a dedicated Factory type class. Am I missing something or is this a valid design decision? **Person.java**               package net.mhi.rd;          public interface Person {              int getAge();         String getFirstName();         String getLastName();              public static class Builder {             int age;             String firstName;             String lastName;                  public Builder age(int age) {                 this.age = age;                 return this;             }                  public Builder firstName(String firstName) {                 this.firstName = firstName;                 return this;             }                  public Builder lastName(String lastName) {                 this.lastName = lastName;                 return this;             }                  public Person build() {                 return new PersonImpl(this);             }         }         }      **PersonImpl.java**               package net.mhi.rd;          class PersonImpl implements Person {              private final int age;         private final String firstName;         private final String lastName;              PersonImpl(Person.Builder builder) {             this.age = builder.age;             this.firstName = builder.firstName;             this.lastName = builder.lastName;         }              @Override         public int getAge() {             return age;         }              @Override         public String getFirstName() {             return firstName;         }              @Override         public String getLastName() {             return lastName;         }     }


title: Is Perl outdated for CGI and FCGI?

text: When we did web development in 1996 it was CGI, FCGI and Perl on the backend. Now why is Perl not that popular anymore and instead we use Java, Python, Go, PHP, C# and everything but Perl? To me it seems that Perl should be good since it has had long time to mature. What happened that causes Perl to lose its applicability as server language?


title: In MVC software, who should load the models?

text: I'm working in a REST JavaScript client, and I'm trying to follow the MVC pattern, but a very basic question came to my mind: who should make the http request and load the data into the model? My intuition tells me that the controller should do it, but in lots of examples (the ember.js documentation, by example) it's done by the model, with a find() method. But other frameworks, like Django, do it in the controller. What do you think it's the better way to do this?


title: Subversion permissions and Visual Studio projects

text: I have a quite specific question regarding Subversion structure, different permission levels and Visual Studio projects and solutions: We develop a framework with external partners with functionality the partner is not allowed to see. Consider following structure of a VS solution: example.sln   |_ /unit1/unit1.csproj (incl. cs files)   |_ /unit2/unit2.csproj (incl. cs files)   |_ /unit3/unit3.csproj (incl. cs files) unit1 and unit2 belongs to the framework, unit3 is specific (secret) functionality. Framework is functionally without unit3 (which will be shipped as dll). My question now is: How can this project be structured if the two parties should have a functional development environment, example.sln references unit3, but our external partner won't have this part because of the SVN permission. We, of course, have full access to the repository. I hope my request has become clear... Am I one a wrong track with my question? **EDIT:** Thanks to this answer I see clearer. Last question: How to implement different solutions for different groups so that each group can only check out their solution:   * two sln files in one directory with different permissions   * two directory trees for each solution with links to the shared projects?


title: Ways to present testing results

text: I'm doing a school project which requires us to create a computer application and then write documentation; therefore I have to write testing documentation, I already have a of test plan (Validate all input and test all features) but how do I present the testing results in my project (e.g. table etc.)?


title: TFS merging - how to track what changes go into MAIN?

text: I'm new to TFS branches, and have opted to set up a \Dev and \Main branch (ultimately there will be release branches too). I'm using TFS2012. My understanding is that I will work on the \Dev branch on a day to day basis. When a bug is fixed or a user story is completed, I will merge \Dev to \Main, build, and give that to the tester. In \Dev I have a policy to ensure that check-ins are associated with a work item. However when I merge from \Dev to \Main, and check-in that merge, what would I associate that check-in with, if anything? The reason I ask is because I'm wondering how someone could find out what changes went into a particular \Main build? It's obvious in \Dev, as you'll see the associated work items in the build output. But there will be no such history in \Main, unless I associate the merge check-in with some sort of work item. The tester needs to know what's gone into a particular \Main build, but how? Is it a manual process, where the developer simply gives him a list of changes that have been merged into \Main? I've read the MS branching/merging guidance, but it doesn't really shed light on this kind of thing.


title: How are undocumented functions discovered?

text: I've always wondered how do you find **undocumented / private** API ? Example the _Apple_ undocumented / private API, _Play Station_ , _Windows Phone 7_ , _Win32 Kernel_ , _Windows API_ , _hidden callback_ , etc... What tools do hackers use to find out about private and undocumented functions? Where can I read about peoples' experiences delving into private APIs and reverse engineering techniques which reveal the secrets which are normally explained in API documentation? thanks,   A


title: How do Data Scientists Use Python?

text: Do you know how Data Scientists use Python and if it requires data, where I can get sample data to practice with? I'm currently learning the language and plan on applying for Data Scientists jobs, so it would be helpful if I knew if there were specific types of tasks where I'd use python. If it's relevant, I use C# regularly.


title: What are the most known arbitrary precision arithmetic implementation approaches?

text: I'm going to write a class library for .NET which provide an implementation of arbitrary precision arithmetic for integer, rational and maybe complex numbers. What best known approaches should I become familiar with? I tried to start with Knuth's TAOCP Vol.2 (Seminumerical Algorithms, Chapter 4 – Arithmetic) but it's too complicated. At least I couldn't get the ideas in a relatively short period of time.


title: Why is Java boolean primitive type name not 'bool'?

text: Java has   * `int` and `Integer`   * `boolean` and `Boolean` This seems a bit inconsistent, why not either   * `bool` vs `Boolean` to use an established shorter name for primitive type? or   * `integer` vs `Integer` to keep type names consistent? I _think_ C++ had decided to use `bool` quite a bit earlier than Java decided to use `boolean`, and maybe also some (non-standard at the time?) C extensions too, so there would have been historical precedence for `bool`. I've noticed I often instinctively try to use `bool` at first (good thing modern editors immediately spot this without extra compilation round), so it'd be nice to know the rationale behind current state of affairs. If someone remembers (a part of) the story, or can even find and link to relevant historical discussion in the net, that would be great.


title: Objected oriented application exit

text: We are writing a program that does a standard "auto update software on startup". If the software finds an update ready, it will start the update process and then exit (and not run the program). We have two different designs on how to write the logic of the update. Design 1: Let our AutoUpdate class handle everything, including exiting the program if required. Design 2: AutoUpdate does most of the logic, and if it wants the program to exit, it returns a value indicating this, and the Main() takes care of exiting. code wise, the main function would look like: Design 1 (AutoUpdate exits internally if required)               Main()     {         AutoUpdate.DoAutoUpdate();         RunMainProgram();     }      Design 2 (AutoUpdate returns true if it needs to exit, Main handles the exit)               Main()     {         if (AutoUpdate.DoAutoUpdate() == false)         {             RunMainProgram();         }     }


title: Cost of design based on the cost of programming

text: What is your methodology when you need to determine the cost of UI design if you know the cost (work hours) of programming in some project? Let's say, programming of logic in some project cost X dollars. Is there some general percentage (like 30% of programming costs) which can help determine the cost of design? The area of interest is mobile phones development (mainly business tools and 2D games, not 3D at all). There is less design work here comparing to a web design or a PC game design.


title: What are the IEEE and ACM good for?

text: Membership in the IEEE and ACM is sometimes portrayed as a sign of professionalism. But all that is involved, as far as I can tell, is sending them your money. In return, besides the potential resume line, these organizations sponsor conferences and journals. I can always attend a conference or subscribe to or submit a paper to a journal, whether I am a member or not. If being a member makes some of that cheaper, or is a prerequisite for admission then OK, but I still don't see the purpose of these organizations. * * * The answer, as far as I can gather, is that their most important value is to provide some reading material. I'd suggest that this is not worth the money given the wide availability of other valuable reading materials.


title: OOP, domain models, and the user

text: When developing domain models, I can see two major ways of thinking about the user:   * The first one assumes that a program is a kind of "simulation" of what happens in the real world, and the user is an spectator. With that approach you would have a Customer class -for example- with perhaps methods that correspond to the actions a Customer can perform. Whenever the customer wants to do something, the corresponding method is called.    * The other approach would be to design the classes as if they were exposed to the user and s/he then has the ability to create and play with the objects “directly”, thinking of the program as a kind of extension of the user’s reality. With this approach, a Customer class would probably make no sense as the customer is already “involved”.  I've read some articles talking about adding security at the method level, which seems to be consistent with the second approach, but I believe the first approach is far more popular. What's the best way to deal with this? Thanks.


title: what is the concept behind sstatic.net?

text: Question is pretty simple. whenever i login to stackoverflow or some sites i get lots of http://sstatic.net/ type like request. What is the whole concept of this? How does it help to speed up a website?


title: How to limit time period to another period?

text: For a project planning I have an initial period, lets call it `PPStart-PPEnd`.   The planning is associated with a project. This also has a period `PrjStart- PrjEnd`. PrjStart and PrjEnd are fixed, and can be unbound, i.e. the project start time or end time are not defined. `PPStart-PPEnd` should be adjusted so that people can only plan tasks in the valid project period. If that changes the duration, fine.   How do I efficiently limit `PPStart-PPEnd` to `PrjStart-PrjEnd` without having to go over all the possible combinations?   Maybe first detecting overlapping periods is a good start? 4 examples on a time axis ([-- = bound, <\-- = unbound):               Project planning period:                                   [---PPStart-PPEnd---]     Project periods relative to ppp:                                                                       [---PrjStart-PrjEnd---]   PPStart should be set to PrjStart, PPEnd unchanged                          [---PrjStart-PrjEnd---]                  PPEnd should be set to PrjEnd, PPStart unchanged                          [---PrjStart-PrjEnd------------------->  No adjustments         [---PrjStart-PrjEnd---]                                   PPStart should be set to PrjStart and PPEnd to PrjEnd.      Cases like that last one make it complex.


title: What is the main job of a team leader?

text: * In a project following agile programming model what is the main job of a team leader?   * What are the job differences between team leader and project manager?


When is Java a good choice for web development? Please do not say "When you have a development team that knows only Java."


title: JavaScript Class Module: How to avoid an antipattern

text: I've seen a number of different methodologies when it comes to applying class- based inheritance to JS/ECMA-based projects. Over the past several months, I've been applying IIFE Namespaces to my class models when I need classes. This results in a little extra boilerplate code that is easily abstracted for highly dynamic classes. _(Make note that I only employ classes when they indeed fit the task.)_ In general, I see classes employed in one of the following 4 ways: **Constructor:**               function MyClass(arglist) {         this.property = value;         this.method = function(){};     }      **Prototype:**               function MyClass(arglist) {         this.property = value;     }     MyClass.prototype.method = function(){};      **Object.create**               Object.create(MyClassPrototype, {prop-list});      **IIFE Class**               MyClass = (function(){         function MyClass(arglist) {             this.property = value;         }         MyClass.prototype.method = function(){};              return MyClass;     }());      Obviously, there tend to be some support functions to reduce keystrokes, such as `extend()` and/or `inherit()` helpers. Let me be upfront that I don't generally like the most accepted class libraries _(for various reasons)_ , so I've been experimenting with my own methodology. What I've come up with is the following: **Class Module**               (function(Class){         //Private Static Property         var staticProperty = value;              //Public Static Function         Class.staticMethod = function(){}              //Potentially allows for static construction         Class.create = function(config){             //Public Object Member             this.property = value;         }              //So the constructor actually works.         Class.prototype.class = Class;         //Public Object Method         Class.prototype.method = function(){};              //Allows it to be assigned to a var or Namespace.         return MyClass;     }(function MyClass(){this.class.create.apply(this, arguments)}));      What I'd like to know is, what are some potential pitfalls to this pattern? Here are some of the advantages that I think this pattern has:   * The use of private statically scoped functions. In my own experience, this can dramatically improve performance by taking functions out of the constructor that don't need to either a) be there, or b) don't make sense as closures.   * The ability to use new(), static create(), Object.create() as desired.    * Doesn't break any standards-required functionality for classes (i.e. `new`, `instanceof`, `typeof`, prototype chain, `constructor`, etc.)   * Give every object a reference to their current "class". Not necessary for many things, but I always seem to want it when it doesn't exist.   * Can utilize the class as a facade for multiple classes without breaking logic or flow. While I haven't used this a lot, it's extremely useful when I do.   * Hoisting different methods at different times can adjust the benchmarks according to the need for the specific class. For instance, if I need it to construct objects faster, I can hoist a constructor method to the private static level. In contrast, if I need a particular method to perform faster, I can hoist a prototype method to the private static level.    * Nesting classes is simple   * Since scoping is so important to JS security, usability and performance metrics, I find this to be the most flexible.   * I personally find it to be very readable (in general). At a glance, I know whether a method is public or private, static or object.   * Finally, though very rare, sometimes I need the "class" to have different behaviors when not actually interacting with an object. This pattern allows me to do this with one simple check. My question here is, since I am quite biased toward this pattern when implementing Class-like behavior, what pitfalls should I be aware of to avoid this becoming an antipattern? Are there any clear reasons to avoid this pattern entirely, aside from bias or convention?


title: Should I learn Javascript before Coffeescript?

text: I'm a reasonably experienced programmer trying to learn web developement. I'm trying to develop a client-side web application which uses svg or canvas for graphics. I've decided I'd like to write the application code in Coffeescript. I don't know either Javascript or Coffeescript. How necessary knowing Javascript to Coffeescript web development? Am I likely to hit some gnarly problem which requires me to understand Javascript? Can I work happily with Javascript APIs from Coffeescript? **Edit** : I could easily learn the basics of Javascript in a week. I'm more concerned that Javascript seems to have a lot of hidden sharp edges. In the strangest language feature question on StackOverflow Javascript is one of the most common languages. It has an unusual object and class model. It has non- obvious name scoping rules. I find it takes more than a week for me to really know a language. I'm going to work on a small simple project to learn web development. Would I be better off to use Javascript or Coffeescript? I think in the long run I'll prefer Coffeescript but I'm willing to start with Javascript if that I'm going to need a thorough understanding of Javascript to use Coffeescript.


title: ASP.NET Webforms developers and web designers: how to interact?

text: I'm an ASP.NET Webforms developer, and I face some problems when I deal with designers. Designers always complain about the `asp.net server controls`. They'd rather just have an html file and create `css` files along with the required images to go with those. Sometimes, if the design phase is done in advance, I get html files with related css files, but then we face many problems integrating the design with the `aspx` files (sever controls an telerik controls ... etc). What I want to ask about is:   * How do I overcome these problems? The designers prefer php- and mvc developers because of the problems with .net server controls. I need to know how to interact with the designers in the correct way.   * Are there any tools or applications to provide the designers with the rendered (html page) of the .aspx pages? By that I mean the page in runtime rather than the aspx in Visual Studio. They do use Web Expression but they want the rendered page in html as well.


title: What does "flatten" mean?

text: If I had a tree, would "flatten" intuitively imply > get a list of all items in the tree, traversing from left to right? If i have a linked list, would "flatten" intuitively imply > get a list of all items, starting with this one For example, a linked list would be made up of an exception that aggregates its inner exception. Would it be fair to name a method on exception "flattenInnerExceptions" with expectation that it would return a sequence of exceptions, outermost exception first, and inner-most exception -- last?


title: Importance of having technical architecture knowledge as a developer

text: I am a junior developer (half a year out of university) currently working in a small project. The project team size about 30. I am wondering how important it is for us developers to know about the technical architecture (hardware, network, etc.) of solutions. I don't think that I can do side-projects for small firms without a strong TA background. Are there books where I could learn more on software TA and the like?


title: Looking for web languages performance comparison

text: Not to long ago I was here on stack overflow and saw this great diagram of programming languages performance comparison, and now I can't find it...   Does anyone have a similar comparison? The two I'm most interested in are PHP vs Python.


title: What could be used to get data from server to android as fast as it reaches server?

text: What is the best way to get data from server as fast as it gets to it? (Like instant message, or simple broadcast for example). I first thought about using miniature web server in android and get post requests to it with data. However with this approach I soon understood that I will get many problems with NAT and similar issues. Later I thought about manually pooling the server from android, but it seems somewhat flaky approach to problem, because data is got in irregular intervals (like image with some text). I was thinking about using something like webrtc or rtp to have connection between server, but these approaches are somewhat complex and half baked. I found very little info on those about data operation. Thought I managed to get in my „experiments“ video and sound transfer, I found very little info how to get data transfers. What should I do? Now I am thinking about having some connection to server and getting some events in android, which when I got update in server could download everything from server. Update: My data is encode64 processed html5 canvas png image. Probably I will add to it some text data to blob. It is generated on webpage it should reach phone as fast as it can through server. The problem is part where image data goes from server to phone. Data size per request is ~50KB.


title: Are programming languages pretty much "stable" for now?

text: Recently i have looked at the " **timeline** " of Programming Languages and while a lot has changed in the past 5-10 years, there are a lot of languages that have pretty much "stayed" the same in their niche/use. For example, let's take C language. We don't really ever see much languages being developed (correct me if i'm wrong) to try to Unseat C. However, there are a lot of languages that try to do similar things (look at all the SQL/No- SQL languages) Scripting Languages, etc... Is there a reason for this trend? Or is it just because C was designed very well ? and there isn't really any need for new once?


title: How often should a Scrum team meet its Sprint commitment?

text: Commitment is a promise, and we all have been taught that you need to keep your promises. But is it realistic to keep the commitment for each Sprint? Sometimes people get sick, sometimes the technical approach is proven wrong and you have to rethink everything, sometimes during further discussions with the product owner or the users you understand that the feature should be very different from what was originally thought. I know that the official Scrum Guide now uses the word "forecast" rather than commitment, probably to address these problems. So my question is how often do teams in your organizations keep their commitment and whether you like this approach or you want to change it. Thank you.


title: Representation of data in application versus database

text: I'm going to make an application that will be given data to put in a database. The data will for the most part be the same, but the way it is formatted will vary a lot (could be in anything from text files to .xls to .doc).   I'm not a very experienced developer, but I can see some potential issues and I want to minimize them.   First off I have decided to use the DAO pattern, so that I can easily support new file formats or file suddenly formatted in different ways.   What I really wonder about though, is how I should manage the data itself within my application. I'm thinking that the database DAO should have models representing each table of the database with the same relations between them, to make the uploading process easy. But should the filesystem DAO's have to use the same models? I can imaging that when the database changes, the change will suddenly propagate throughout the entire system, all DAOs and models alike. And that is obviously a bad thing. I'm a little bit tired and out of time. Will update with what ever questions you have. Thanks!


title: Does a vm implemented in garbage collected language need a garbage collector?

text: This is more of a theoretical question. If jvm is implemented in go which itself is a garbage collected language, then does that jvm need a separate garbage collector to be implemented for its own operation?


title: in doubt of using code generators

text: I am now entering the world of java ee 6. And I am supposed to used different technologies like jsf, jpa, different kinds of beans and all that stuff. I am learning using the netbeans IDE, which is, I should say, very efficient when it comes to getting the work done. It is just that, I came from the old school servlet programming environment using scriptlets on them jsp pages where you get to write every line and every request parameter/attribute you have to set manually. which is somehow good because you get to understand you program THAT WELL. but with this java ee 6, with the code generators from NETBEANS, I get to create controllers, jsf pages and entities without writing any code (taken aside the DB part though). I do understand the flow of the application but not to the degree that I can understand what the line does, how does it reached, what are the use of the variables and what does it do after. all the nitty gritty stuff. to make it short, I am using generators without REALLY understanding the code that well (mostly on the new tags by jsf). I just want to ask if this is a bad path/practice or is it ok because we want PRODUCTIVITY?


title: Could I GPL this code?

text: I'm working on reviving a C++ codebase that hasn't been touched since '97. It's academic software for text analysis, and originally it was non- functional, it wouldn't even compile. I fixed the code so that it works, and added some new functionality of my own. I'm doing this privately for someone else, and they will pay me over a student contract. I signed nothing with them, so ultimately, my work belongs to me. Given that they agree (I don't want to be rude), would I be able to relicense this code under GPL, and post it on a site like GitHub? The current license is as follows: > Copyright (C) 1997, Carnegie Mellon University. All rights reserved. This > software is made available for research purposes only. It may be > redistributed freely for this purpose, in full or in part, provided that > this entire copyright notice is included on any copies of this software and > applications and derivations thereof. > > This software is provided on an "as is" basis, without warranty of any kind, > either expressed or implied, as to any matter including, but not limited to > warranty of fitness of purpose, or merchantability, or results obtained from > use of this software. Seems like I would have to include that notice as well.


title: Would copyrights drop if I re-write open source project into another language?

text: I have re-written an open source project from java to haxe, then from haxe compiled to javascript, with totally different UI So, the question is, is the code considered to be mine after rewriting it to another language in a closed source project? can I use it freely with no worries about original copyrights?


title: Is procedural programming the root of all object oriented evil?

text: If you read Working Effectively with Legacy Code, Clean Code, Refactoring: Improving the Design of Existing Code and Design Patterns you will get what I mean. Many of the examples and topics discussed in these books aim at improved the quality and design of the code. It is my observation that most of the problems mentioned in these books revolve around turning a procedural or semi procedural code to a well structured object oriented code. Think God objects, long switch cases, hard coded dependencies,..etc. What actually drove me to ask such question is that I often hear people talking about functional programming and that it good to learn such languages even if you are doing object oriented programming as it affects your mindset and perspective of the code. So to keep the topic constructive, focused and objective as much as possible:   1. Is there any studies or evidence that learning procedural programming before object oriented programming leads to the infamous object oriented anti patterns?   2. Does the same problem occur when learning OOP after FP?   3. Is there a proper/proven way to approach OOP in general to avoid most of its pitfalls?


title: Architectural problem for Activity communication in an Android app

text: I maintain an open source Flickr app Glimmr for Android. There is currently an architectural issue around pagination that I've been trying to solve for quite a while, and would appreciate ideas. Here are the components involved:   1. Tasks - various subclasses of AsyncTask that fetch photos from sources such as a users photostream (LoadPhotoStreamTask), photoset (LoadPhotoSetTask), etc.   2. PhotoGridFragment - a fragment that displays photos fetched by the Tasks in a grid. Subclasses of this exist matching each task, e.g. PhotoStreamGridFragment, PhotoSetGridFragment, etc. The grid is paginated, so that when the user scrolls to the end of the photos, the task is triggered to go and fetch the next page of photos.   3. PhotoViewerActivity - responsible for displaying a list of photos from the grid in fullscreen. This is started from the PhotoGridFragments with two pieces of info, a) the list of photos currently in the grid, and b) an index at which to start viewing at. The issue arises when the user reaches the end of the list _from within the PhotoViewerActivity_. This activity does not have the info required to start the correct task and update the list of photo's it has been passed. I want to figure out a way of doing this while keeping the coupling between the PhotoGridFragment and PhotoViewerActivity as low as possible. People who are familiar with Android will know that because we're dealing with two separate Activities, all communication between them must take place via Intents with data having to be persisted or serialised. Afaik the PhotoViewerActivity can not easily call back to the Grid and ask for more photos. Things are complicated by the fact that each task requires different pieces of state and info to do it's work. e.g. a LoadPhotosetTask requires the set id, LoadPhotoStreamTask requires a specific user but doesn't care about sets, etc. So just passing the task name required to fetch more photos to the viewer activity isn't enough. Another solution could be to abstract the common pieces of functionality from the PhotoViewer into an abstract class, and then create specific photo viewers for each source, similar to the way we have specific PhotoGridFragments for each source. This feels overkill, but is probably the solution at the front of my mind right now. How would you solve this?


title: How do login systems work?

text: I assume that when a user registers at a site, the password and username are stored inside of a database. I've read that the password is often encrypted using a salt. So, is it safe to encrypt the passwords with a salt and to save it in the same schema with the username? Secondly, how does authentication work? Companies like Google have giant databases of username/password pairs. How does validation work so quickly, and how is it implemented?


title: PHP OOP - Getters / setters vs. database storing

text: ### Problem I am trying to optimize the architecture of my web-application developed in PHP using the Symfony framework. I have an object "pool" that contains "swimmers". I need to display the number of swimmers in my pool, but only those with a pink bath-suit. In order to do this, I see many possible approaches : ### Approaches   1. Create a custom getter method in my Pool class, and filters the swimmers by bath suits color :              public function getSwimmersInPinkSuit() {         for each($this->getSwimmers() as $swimmer) {             if($swimmer->getBathSuitColor() == "pink") {                  $pinkSwimmers[] += $swimmer;             }         return $pinkSwimmers;     }      > {{ pool.getSwimmersInPinkSuit | length }}   2. Create a custom SQL query in my controller, define the number there before sending it to my template.   3. Add a "$pinkSwimmers" property to my Pool class, and increment/decrement it with an eventListener every time I persist in database the event "a pinkSwimmer joins/leaves the pool". I then can access the value where i want : > {{ pool.pinkSuits }}   4. Use a denser twig request to filter out the pink swimmers directly in my template > {{ pool.swimmers.suitColor("pink") | lenght }} // If that's even possible o0 ### Question In the four propositions above, I see pros and cons to each of them, so :   * What is the best practice in this situation ? Am I overseeing a better logic in addition to the ones mentioned above ? I try to find an implementation that would be lightweight in term of performance (memory, bandwidth), but also easy to reconfigure (change from pink to green suits, or from suit color to swimming style).


title: Event Driven Programming?

text: I have been looking into event driven programming in C and the language doesn't seem to have support for it. This has led me to wonder about the nature of event driven programming. Is it correct to say that an event handler basically spawns a thread that waits for a response from I/O and sets a variable? Or is there something more complicated to the process.


title: A startup as a web-application then later extended as mobile application. How to do it properly?

text: I have this idea that I want to build. I want to start the idea as a web-app, then move into mobile-app and possible desktop application. The project should have databases (mostly strings). Also users would have accounts and access to these databases. So the project provides access to the user-resources through the Internet. I want the database easily accessible through different platforms. The project is also to sharpen my IT, so I don't want the easy road, but the better one.   * What are my best options of frameworks/skills?   * Good tools to manage the project?   * Is starting as a web-app a good choice, or should I build it as a mobile-app first? I have some knowledge (but not a lot of experience) in: C, C++, Java, PHP, Javascript, MySQL, HTML/CSS. Edit: I know that my question is too general, all I wanted is some ideas and guiding to have a good start. @Nathan Taylor, regarding the web-app, I don't mind any option (should I learn Python, or stick with php in this regard)? I'll probably implement the project in Android, and possibly iPhone.


title: What is the appropriate Data URI to use for 0-byte content?

text: I have a method that generates a data URI from a byte array. In the event the input byte array is empty, what is the appropriate thing for the method to do? Here are the options I see:   1. return `data:,`   2. return an empty String   3. throw an Exception By my read, RFC 2397 doesn't explicitly address the notion of empty data.


title: Tail-recursive implementation of take-while

text: I am trying to write a tail-recursive implementation of the function `take- while` in Scheme (but this exercise can be done in another language as well). My first attempt was               (define (take-while p xs)       (if (or (null? xs)               (not (p (car xs))))           '()           (cons (car xs) (take-while p (cdr xs)))))      which works correctly but is not tail-recursive. My next attempt was               (define (take-while-tr p xs)       (let loop ((acc '())                  (ys xs))         (if (or (null? ys)                 (not (p (car ys))))             (reverse acc)             (loop (cons (car ys) acc) (cdr ys)))))      which is tail recursive but needs a call to `reverse` as a last step in order to return the result list in the proper order. I cannot come up with a solution that   1. is tail-recursive,   2. does not use `reverse`,   3. only uses lists as data structure (using a functional data structure like a Haskell's sequence which allows to append elements is not an option),   4. has complexity linear in the size of the prefix, or at least does not have quadratic complexity (thanks to delnan for pointing this out).  Is there an alternative solution satisfying all the properties above? My intuition tells me that it is impossible to accumulate the prefix of a list in a tail-recursive fashion while maintaining the original order between the elements (i.e. without the need of using reverse to adjust the result) but I am not able to prove this. **Note** The solution using `reverse` satisfies conditions 1, 3, 4.


title: When would dynamic scoping be useful?

text: With dynamic scoping, a callee can access the variables of its caller. Pseudo C code:               void foo()     {         print(x);     }          void bar()     {         int x = 42;         foo();     }      Since I have never programmed in a language that supports dynamic scoping, I wonder what some real world use cases for dynamic scoping would be.


title: Abstraction concept in OOP

text: I hear that Abstraction is a technique that helps us identify which specific information should be visible, and which information should be hidden. Encapsulation is then the technique for packaging the information in such a way as to hide what should be hidden, and make visible what is intended to be visible. I understand Encapsulation well... A simple example would be a Method that calculates calories based on the parameters we provide. CalculateCalories(x,y,z) Here I don't know how this method calculates calories but I can call it to calculate the calories. Abstraction is what I am confused about. What are those techniques that Abstraction uses to help identify which specific information should be visible, and which information should be hidden? Or am I misunderstanding the concept? Could anyone give an intuitive example?


title: PHP coding practice

text:
I'm a self taught PHP programmer. Because I have no formal training in PHP, I often find my coding style to be considerably different than example code I find on the Internet. I've slowly started adapting some of the more common practices I find. However, before changing my habits, I try to find a good reason to use the new style. I just don't see much reason to change my habit if it isn't actually advantageous. I see a lot of people write PHP code such as :
<?php echo $cTitle; ?>

<?php print $cContent; ?>
      Whereas I generally write :               <?php         echo "
", $cTitle, "
";         print("
" . $cContent . "
");      What I'm seeing is that people are commonly going in-and-out of PHP, while I'll just use PHP to print/echo the html content along with the PHP variables. Is there a measurable difference between these two methods? Is there a good reason for me to change my ways?


title: How is Nothing a subtype of every other type in Scala

text: I am taking Martin Odersky's coursera course on functional programming with scala, and for now I have learned two things that together don't make sense:   1. Scala doesn't support multiple inheritance   2. `Nothing` is a subtype of every other type These two statements cannot live together, so how exactly is this done? and what exactly is the meaning of "subtype of every other type" **Edit 1** In the Scala API, `Nothing` is defined as `abstract final class Nothing extends Any`... so how can it extend other classes?


title: Why big companies use Perforce?

text: I heard about some big companies e.g. Google, Facebook use Perforce Are there any reason why SVN/Git cannot replace Perforce?


title: Promoting scalability in small business applications

text: I am part of a small software company that specializes in small to medium- sized business applications and my experience with distributed architectures/SOA is limited. Please let me know if I'm going about this all wrong. We often start development on small business applications, where a distributed architecture seems like overkill and will not be implemented as such. However, in some cases, the project expands way beyond the original scope, and the preferred solution may later become a distributed one. How do we ensure from the very beginning that this transition becomes as smooth as possible, with a minimum cost of performance and (primarily) time? Specifically, I'm looking for advice in regard to the architecture of the solution in order to achieve this. Take this simple example:   * At first a windows application is running on several computers, invoking all business logic locally in an assembly that is distributed along with the application.   * Later, the business logic is moved to a central server, and the windows application must now communicate with the business layer through a WCF service. The obvious answer here would be to just create the WCF service from the very beginning and have it run locally on each machine, but my initial thought was that this could cause undesirable time consumption on projects with strict deadlines, due to increased overhead in development (having to maintain the intermediate layer(s) etc.). One of the concrete problems with the initial architecture is that instances of objects are passed from the windows application to the business layer, thereby creating a dependency that could break code when moving to a distributed solution. By 'simulating' a distributed solution, we could ensure that our developers aren't unintentionally introducing these sorts of issues.   * What is the best way to achieve this scalability?   * Am I wrong in my assumptions regarding time consumption and performance?


title: How do you go about checking your open source libraries for keystroke loggers?

text: A random person on the internet told me that a technology was secure(1), safe to use and didn't contain keyloggers because it is open source. While I can trivially detect the key stroke logger in this open source application, what can _developers_ (2) do to protect themselves against rouge committers to open source projects? Doing a back of the envelope threat analysis, if I were a rogue developer, I'd fork a branch on git and promote it's download since it would have twitter support (and a secret key stroke logger). If it was an SVN repo, I'd create just create a new project. Even better would be to put the malicious code in the automatic update routines. (1) I won't mention which because I can only deal with one kind of zealot at a time. (2) Ordinary users are at the mercy of their virus and malware detection software-- it's absurd to expect grandma to read the source of code of their open source word processor's source code to find the keystroke logger.


title: Understanding how variable assignment works

text: When I started learning C programming a few years ago, my tutor taught me similar to most of the tutors around the world. She said me the very basic things like any int datatype is of 2 bytes memory. If the following is my code,               #include"stdio.h"     #include"conio.h"     void main()     {         clrscr();         int i,n;         n = 0;         for(i=0;i<3;i++)             n = n + i;         printf("%d",n); //obviously it prints 3         getch();     }      she will explain like what I have written below. Here my teacher starts off her class yet again. . . > Listen students. Here we have two integer values. So let us draw two boxes > each of 2 bytes memory.The first box be the memory space of **i** and the > second box be that of **n**. At `n = 0;` 0 gets stored into the box n. As > the control gets into the loop, 0 gets stored into the box i intially. > > `0` `0` > > Now the condition is checked. i < 3\. Condition gets true. So now the value > of n changes from 0 to n+i i.e., 0+0=0. The first iteration then ends after > the increment statement. Now i gets incremented to 1. So our picture becomes > like this. > > `1` `0` > > And now i < 3 again. Condtion gets true. n changes from 0 to n + i i.e., > 0+1=1. Don't forget the increment my dears. Only then our iteration gets > completed. i++ makes our i to 2 now. And the picture will now look like > > `2` `1` She will go on similarly step by step and will complete when both the boxes get 3, 3 values. > So thats it kids. After we get our boxes like this > > `3` `3` > > the value of n gets printed on the screen. > > **3** By that time, I was merely like a kid nodding its head when a teacher claims earth as a circular mass. I never asked her any questions. I felt logically she was perfect. But now I am plentiful of queries. If there is a statement like `n = n + i;`, won't there be a conflict as both the destination space and the operation space is the same n box? Will the operations be done with the help of any default temporary space for calculations? What will happen if I use a recursive code like the following snippet.               int factorial(int n)     {         if(n < 2)         {             return n;         }         else         {             n = n * factorial(n - 1);             return n;         }     }      How could it be possible to use a single n box as my tutor taught? Won't a new n box be created whenever `factorial(n - 1)` is called? If I am right, how could the computer know which n box value to be returned? Somebody help me please. I am pulling of hairs from ma head!


title: Where does the term 'serialization' come from?

text: In order to convert e.g. a python object to json you would use a serializer. As far as I understand it, serialization leaves the possibility to change the converted object back to the original. Where does the term `serialization` come from/why is the process called `serialization`?


title: Using configuration to determine whether to handle exception or bubble it up

text: On a side project I'm working on I came up with a way of handling exceptions that's adjustable by configuration. So a try/catch block might look like this:               try     {         fileHelper.MoveFile(file, destFolder);     }     catch (IOException ex)     {         if (exceptionHandler.HandleException(ex))         {             return ResultCode.Fail;         }         throw;     }      The granularity of exception handling is controlled through an `enum` that's set in the app.config file:               public enum SystemFailureMode     {         AlwaysThrow = -1,         Aggressive = 0,         Standard = 1,         Lenient = 2     }      This determines whether an exception is "handled" and returned as an error, or if it bubbles up and crashes the system. At first I thought I'd uncovered a new design pattern but now it seems like it's probably an anti-pattern. What do you guys think? * * * After reviewing the comments and thinking about it myself, I've decided this is definitely an anti-pattern. The fact that this has the potential to turn writing unit tests into a nightmare is enough to turn me off of it.


title: Is there a way to find out what API's to use for developing a third party app

text: My company uses an application called TotalHRWorks for time keeping and what not. They have an Android and iOS application; however, there is no Windows Phone application. Since there is an Android and iOS app, I figure that I should be able to create a Windows Phone app; but I don't know where to start with trying to discover maybe their web service or whatever APIs that I could use to make it. I don't know whether this can be done or if it's "legal" to do such things - but it would be really handy to have.


title: Is Test Driven Development in Javascript helpful for front-end developers?

text: I really need your advice. I'm reading a few articles about TDD in JavaScript but I'm really struggling to understand how to use it in my daily work. For instance I'm currently working on a page that has an accordion and each item of the accordion has dynamic contents populated through a JSON object. The JSON object is provided by a third party. I'm using jQuery. My way of testing so far is called console.log :)   * What kind of tests should I write?    * Does TDD make sense for this kind of application of is meant for something else?  Sorry for the noob question but I'd really appreciate your opinion


title: Web application to a multiplatform phone app

text: I'm really lost here so I hope some can help me. I have to develop a phone application on every platform so i tough of using phonegap. Seems pretty nice. I have a web application coded in classic Asp and it's this webApplication that i need to strip down to be a phone app. At first at thought it will be simple, my classic Asp render some html so phonegap is able to put it as an app. But it's not that simple, because in my asp I have some code that is rendered server side, I've talked to some who tell me that some html could call the asp pages and this html could be used in phonegap. Don't think it's possible ... Well if someone could help me here, maybe i've said wrong thing in my little text dont hesitate to correct me :) My solution (i think) : code some webServices in asp.net that will use the same database as my asp classic web application. And some html and jquery will call the webservices and those html and jquery will go trough phoneGap Well thanks for the help and saying what you think about it ! :) **Simple question : What is the best way to transfer an asp classic web app to a multiplatform phone app ?**


title: maintaining a growing, diverse codebase with continuous integration

text: I am in need of some help with philosophy and design of a continuous integration setup. Our current CI setup uses buildbot. When I started out designing it, I inherited (well, not strictly, as I was involved in its design a year earlier) a bespoke CI builder that was tailored to run the entire build at once, overnight. After a while, we decided that this was insufficient, and started exploring different CI frameworks, eventually choosing buildbot. One of my goals in transitioning to buildbot (besides getting to enjoy all the whiz-bang extras) was to overcome some of the inadequacies of our bespoke nightly builder. Humor me for a moment, and let me explain what I have inherited. The codebase for my company is almost 150 unique c++ Windows applications, each of which has dependencies on one or more of a dozen internal libraries (and many on 3rd party libraries as well). Some of these libraries are interdependent, and have depending applications that (while they have nothing to do with each other) have to be built with the same build of that library. Half of these applications and libraries are considered "legacy" and unportable, and must be built with several distinct configurations of the IBM compiler (for which I have written unique subclasses of `Compile`), and the other half are built with visual studio. The code for each compiler is stored in two separate Visual SourceSafe repositories (which I am simply handling using a bunch of `ShellCommand`s, as there is no support for VSS). Our original nightly builder simply took down the source for everything, and built stuff in a certain order. There was no way to build only a single application, or pick a revision, or to group things. It would launched virtual machines to build a number of the applications. It wasn't very robust, it wasn't distributable. It wasn't terribly extensible. I wanted to be able to overcame all of these limitations in buildbot. The way I did this originally was to create entries for each of the applications we wanted to build (all 150ish of them), then create triggered schedulers that could build various applications as groups, and then subsume those groups under an overall nightly build scheduler. These could run on dedicated slaves (no more virtual machine chicanery), and if I wanted I could simply add new slaves. Now, if we want to do a full build out of schedule, it's one click, but we can also build just one application should we so desire. There are four weaknesses of this approach, however. One is our source tree's complex web of dependencies. In order to simplify config maintenace, all builders are generated from a large dictionary. The dependencies are retrieved and built in a not-terribly robust fashion (namely, keying off of certain things in my build-target dictionary). The second is that each build has between 15 and 21 build steps, which is hard to browse and look at in the web interface, and since there are around 150 columns, takes forever to load (think from 30 seconds to multiple minutes). Thirdly, we no longer have autodiscovery of build targets (although, as much as one of my coworkers harps on me about this, I don't see what it got us in the first place). Finally, aformentioned coworker likes to constantly bring up the fact that we can no longer perform a full build on our local machine (though I never saw what that got us, either, considering that it took three times as long as the distributed build; I think he is just paranoically phobic of ever breaking the build). Now, moving to new development, we are starting to use g++ and subversion (not porting the old repository, mind you - just for the new stuff). Also, we are starting to do more unit testing ("more" might give the wrong picture... it's more like **any** ), and integration testing (using python). I'm having a hard time figuring out how to fit these into my existing configuration. So, where have I gone wrong philosophically here? How can I best proceed forward (with buildbot - it's the only piece of the puzzle I have license to work on) so that my configuration is actually maintainable? How do I address some of my design's weaknesses? What really works in terms of CI strategies for large, (possibly over-)complex codebases? **EDIT:** I thought I explained my problem, but obviously I wasn't clear enough. I am _not_ looking for suggestions for changing CI platforms. It is **not** going to happen, and answers suggesting that will not get accepted. What I _want_ to know is how other people manage complicated codebases using CI. I have a **dozen squared** different products, and I have dependencies scattered to the wind, and they're all different. THIS is what I want to know how to deal with.


title: Which tool to use for creating application releases?

text: I'm wondering what others use as a tool for creating the final package to hand over to the customer. For now, these are the tasks it should perform for our company:   * build a set of VS projects (C#,C++); which set depends on configuration on commandline of preferrably in a file   * copy some of the outputs (dll,exe) and header files; should again be configurable: not all customers get the same functionality)   * make a zip file for each configuration Additional features that are not yet needed now, but might be in the future:   * upload it to a website of some kind (we're still not sure what we're going to use.. might be ftp or vesrionsing system). Well, actually, it would be awesome if the tool could create an entry on a Confluence page.   * instead of zip files we might switch to installers, though that shouldn't change too much I guess Right now I have the first steps covered in a batch file that takes some arguments, and a master batch file that calls it for each configuration. It works, but I can't get used to the batch syntax and I'm now building by invoking devenv.exe which seems slow and is error-prone as it takes the .suo file into account. I was thinking about doing everything again in msbuild, but first I'd like to hear more opinions on this. I'd also want to know what kind of tools big companies use for large products.


title: Books on custom iPhone interface development?

text: I have been looking around for a book on designing and developing custom interfaces for iOS but I don't seem to be able to find any books on this topic and I was wondering if anyone here knew of any books on the design and development of custom iOS interfaces and applications. Also, I am not aware of any other questions asked on this site, so if there is, please do let me know and I'll vote to delete :) Thanks in advance!


title: Where to keep track of batch editing scripts?

text: It is sometime useful to write a script to perform a batch editing on several files in a source tree. Such a script is usually very specific and used only once. Such scripts can be used to rework some identifiers in code, modify file header comments, edit the path of a resource or the like. I want to stress that I am concerned by the case where the script addresses an exceptional problem, so that it does not fit in the usual workflow of the project. I think it is important to keep record of these scripts and reference the usage of the script in the RCS logbook. Where is the appropriate place to keep this record? Should they be added to the commit description in the RCS logbook? Should they be added to the ticket description of the item being processed when they are used? Should they be saved as regular files in the project and added to the RCS, despite the fact their usage is deemed to be unique? Is there another way?