title: Approach of delivering “Logging API”

text: I faced a question in a .NET interview. As a client i need a LoggingAPI. How you go the approach of design and development and delivering Logging API to the client? I don't care about WPF or a language specific. I want a LoggingAPI which has to log some data? what is your approach in delivering the same. I failed to answer for this question. Please guide how to proceed for answering this type of questions.


title: How can we track how well we're preventing and avoiding security vulnerabilities?

text: It's pretty easy to track when we fix security vulnerabilities in existing code. But to make sure the whole team is staying on their toes about writing secure code, I'd like to also track how well we are preventing and avoiding writing new security vulnerabilities. What is the right way to measure that?


title: Are there any arguments that can make a contractor reconsider working on fixed price?

text: I've been working for a contractor who brings in some good projects, but they are all fixed-price and often fixed-time. As a result he always has me making a quote over loose requirements, which never fails to bring a lot of tension due to feature creep. He claims he'd never get a contract if he couldn't agree on a price with his clients first, but as far as I'm concerned I don't wanna go through another project under these terms. Is there any argument I could make to have him pay me by the hour, or should I just suck less at estimating ?


title: Can applications affect power consumption in a substantial way?

text: Is there anything that can be done for a single general purpose application to affect the power consumption of the device it is running on? I am not familiar with how optimizations to individual applications may affect power consumption in a general way, can someone explain if different approaches to writing applications affect power consumption of the device they are running on? That is, can a single program, that does the exact same thing functionally, written in different ways drastically affect the power consumption of a device in general, not about how different un-related programs might affect the power consumption of a device.


title: RDBMS same type of optional data for multiple tables

text: I have an embedded database (SQLite), it stores information about events and page views, its purpose is to track the user journey inside my application. I need to provide support for optional custom properties on my events and page views. In code this is not a problem, however I am torn between two solutions for storing that information. So I have Events and PageViews tables, my first option for persisting the optional custom properties is to have a EventsCustomProperties table which has only a name and value column and a reference (foreign key) to the event. In this solution I would also have a PageViewCustomProperties with the same structure. The problem I have with this is having two tables which are identical other then their relationships with other tables. In my other solution I would have one CustomProperties table, and in addition to the name, value and relationship key, it would also have a type column, which I should use manually in code to map the relationship id to an event or a page view. In this solution the actual use of foreign keys is redundant. My dilemma is that in the first solution I am respecting one normalisation rule of repeating groups of data, buy in the second solution I am breaking another rule although I cannot get my head to remember the name of the rule. So it seems I will break rules whatever I do. Can anyone suggest a better way or a preference to the first or second solution.


title: Should I split a Python class with many methods into multiple classes?

text: I have a class that will end up having more than ~30 methods. They all make sense to be part of the same class because they require access to the same data. However, does it make any sense to split up a large class into several smaller abstract classes (by functionality, type, use, etc.) and have the main class extend (i.e. multiple inheritance) from all the smaller classes?


I've been considering moving to a new city (getting seduced by those big city lights), and I'm trying to decide if my lack of "computer science"-y skills is going to make me overly uncompetitive. Let me explain my situation a bit more:   * Programming since jr. high school, professionally since 2004. I've worked for a small company that does custom web applications (PHP) since 2006.    * I've studied design patterns on my own, and used them in my work.    * Worked with MVC frameworks (PHP) for a couple years now. I have a strong understanding of how to write good, maintainable MVC code that adheres to the principles of MVC (rather than just cramming code into wherever I can in the framework.)    * Recently done some work with C#, through which I'm learning dependency injection and the MVVM pattern. Grokking these, but still a ways to go.   * Full complement of web development skills (normalized databases, SQL, HTML, CSS, JavaScript), and I'm very confident of my skills in these. Also aware of security issues, and how to write a secure application. My main deficiency is scalability, which I've never had a need to learn, unfortunately. Where I get nervous is with the things you'd learn in a CS degree. My degree is in aerospace engineering, not CS, but I've decided that programming is the thing I really care about. What I know:   * Basic data structures: I took a class in which I implemented basic linked lists, and queues and stacks built on those. I've written a basic binary tree (inserts, various traversals, but not removal (I was really drunk when I wrote the code, and it turned out not to work at all)). I know about hash tables, and understand some of the principles of their implementation.   * I understand big-O notation, but since I'm not really familiar with algorithms, I suspect I might miss interview questions about this topic. (what's the worst-case insertion time into a hash table? I have no idea.)    * I've done a little bit of functional programming by way of JavaScript, python, and dabbling in Haskell. (I realize the first two aren't functional programming languages, but they have functional aspects to them). I understand currying and higher-order functions. What I don't know:   * Don't really know formal algorithms at all. I couldn't sort my way out of a paper bag (well _maybe_ bubble sort, which I know is O(n2)). I guess I know some of their names.   * Never written a parser, or compiler, or any component of an OS. I've never done anything interesting with concurrency (e.g., anything beyond using basic asynchronous calls in .NET to keep my UI from blocking.) I _want_ to learn all these things, purely out of interest, but for now I simply don't have time right now with main job + side job + life outside programming ( _gasp!_ I know). I don't want to put my larger life plans on hold unnecessarily if I don't have to. I'm not aiming for a Google or a Microsoft, but I'd like to at least get a job that's interesting. How much will I be held back by the deficiencies I've listed? I feel relatively confident that in a job I would actually apply for and get, I would be able to perform very well, but what about interviews? I'd like to know:   * How crucial are computer science topics toward getting a job?


title: How do I handle a Controller that's not controlling a specific Model?

text: I've got a nice MVC set up going but my website requires some views that don't map directly to a model. Specifically I've got some generic Reports users need to run, and now I'm creating a utility for comparing some system configurations. Right now the logic is crammed into a Reports Controller and I'm starting a Comparison Controller but this feels like a big abuse of the system. Both controllers use an assortment of different Models to pull data from, and they're only related based on _what the user is doing_. Reports are run from the Reports Controller and their views are all grouped together in the file system/URL structure. Is this an acceptable use of the Controller paradigm? I can't think of a better way to structure my Controllers, and making a Controller for each model I'm using to make reports/ect doesn't seem like a good idea; I'd end up with one Controller/Model/View per report or comparison, vastly complicating the apparent structure of my site.


title: What's the right OO way to create a counter/inventory class that works for both differentiated and undifferentiated countables?

text: You are writing a videogame about trading beans. Red beans, black beans, pinto beans, you name it. As everybody knows all beans are the same. You write the "Inventory" class for a trader in that videogame as follows (skipping all the null checks):                   class BeansInventory{     HashMap<BeanType,Integer> amountsOwned;          public void receive(BeanType typeReceived, int amount)     {amountsOwned.put(typeReceived,amountsOwned.get(typeReceived)+amount)}          public void remove(BeanType typeRemoved, int amount)     {amountsOwned.put(typeRemoved,amountsOwned.get(typeRemoved)-amount)}          public Integer amountOwned(BeanType type)     {amountsOwned.get(type)}     }      It works fine for years. Then suddenly somebody else has the great idea to add to the game trading coffee beans. As everybody knows each single coffee bean is completely different from the other. So you can't just add coffee as another bean type. Each coffee bean is its own instance. The coffee inventory class looks something like this:               class CoffeeInventory{         HashMap<CoffeType,List<CoffeeBeans>> coffeOwned;              public void receive(CoffeType typeReceived, CoffeeBeans... beans)         {coffeOwned.get(typeReceived).addAll(beans)}              public void remove(CoffeType typeRemoved, CoffeeBeans... beans)         {coffeOwned.get(typeRemoved).removeAll(beans)}              public Integer amountOwned(CoffeType type)         {amountsOwned.get(type).size()}         }      But now you have tons of problems. You have two APIs for the same task. All the trading infrastructure now has to check carefully if it is trading pinto beans or coffee beans and call a different inventory and a different method with a different signature for what is after all the same task: "store this". So now I have this code that is getting filled of `if` checks and `instanceof` and all the other signs of code smell. But I can't figure out a way to use a single simple API. I have no idea what's the right oo thing to do.


title: Is dynamic HTML layout good from an SEO perspective?

text: Just wondering whether dynamically built HTML layout is fine from SEO perspectives? So let's assume e-commerce engine and its most popular page - products catalog. So 90% of the page is built using AJAX and MVVM library knockoutjs which builds HTML on the fly on the client side. So how search bots would parse such content? Is it fine indexed and would be such effective as server-side built HTML pages from the SEO perspectives?


title: how to do database updates in each release

text: Our application uses database (mostly Oracle), and database is at the core. Each customer has its own database, with its own copy of application. Now with each new release of our product, we also need to update the database schema. These changes are adding new tables, removing columns, manipulating data etc. How do the people handle this? Are there any standard processes for this? EDIT:- The main issue is the databases are huge with many tables and more of huge amount of data. We provide the scripts and some utilities to manipulate the data. How to handle the failures and false negatives? More of looking for this kind articles. http://thedailywtf.com/Articles/Database-Changes-Done- Right.aspx


title: Is there any value in Open sourcing your for fun projects

text: I have written a bunch of fun for me projects and have shown them to friends and such. Is there any value in doing the work and making these projects open source since the interest and usefulness limited.


title: Copying a competitor's database schema?

text: I am going to be releasing some software soon which will require users to run a local database. There is a competitor in the space that is doing the same thing and they have a pretty sophisticated database schema that they use. Their software is commercial but the database schema is completely viewable once installed. What's the legality of basing my product of the same database schema and just potentially renaming columns and tables and maybe removing one or two things?


title: Is it reasonable to use Javascript MVC Frameworks for closed source paid web applications?

text: I am wondering if it is reasonable to write closed source, paid web apps in Javascript (JS MVC Frameworks like AngularJS, Backbone, Knockout, ...)? I'm concerned because in this type of frameworks you use typically a REST backend for CRUD operations and the majority of business and application logic happens in Javascript which can be looked up by anyone using my app. He can see how i do things. When I use for example PHP or Java (Wicket) most of the logic is happening on the server and so a lot less of my source code is exposed. This seems to me a lot safer if I want to have an edge over my competitors, so potentially I earn more money. So is it reasonable to use JavaScript MVC Frameworks for paid applications? Does it depend on something and if yes on what?


title: are programmers more forgiving of buggy software?

text: From your experience are you, or programmers in general, more or less likely to forgive bugs in the software you use? e.g. if you run across a bug in some app (commercial or open source), is your reaction annoyance at incompetence, empathy, or something else (pity)?


title: Is it bad to be the only person supporting software you have developed?

text: My employer has a need for a web-based application to manage and share data within the department, with approximately 50-75 possible users. I feel I have the ability to write it for them. I would likely use Python/Django with a MySQL database, so it would be open source. However, I'm the only IT person in my department (our larger organization has a separate IT support staff with which I often work, but not for web development). I want to develop this application, but if I leave in 1-2 years, and someone else has to come in after me and support it, will this be seen as a bad decision? This is assuming all the obvious points -- I will write documentation, I will comment my code, and I will strive to follow good application design principles. But will that be enough? In principle, is it acceptable for one person to develop and support an entire web application? Is this a "do first, then show and ask" kind of situation, or should I be certain it will be adopted by everyone involved first? With regards to specifics, I work in an academic department of a university that has specific processes for student applicants and for their being admitted. You have to apply to the university, AND my department separately. The department-specific process is very manual and pieced together, which is where my development would come in. We (myself and IT) are already planning on incorporating the additional questions that pertain to my department into the main university application (which IS electronic, and feeds into PeopleSoft), so that solves the front-end piece and everything would be in one place. But for the faculty and staff to acquire and "digest" that information throughout the admissions process will require an application of some sort, which I would prefer to do "my way". The IT staff want to develop it ALL in PeopleSoft, and I fear it will be too inflexible and will not be well received by our department, and may still not completely meet our needs. There are third-party solutions which meet this need perfectly but they are cost-prohibitive. I would query the data from PeopleSoft and present it how I know the faculty and staff need to see it. (Getting access to query PeopleSoft is a different battle altogether.)


title: DB API for shell scripting (any shell)

text: I am faced with some legacy shell scripts that run batch data processing jobs in Oracle using `SQL+`. For the most part, the data tier does not have to communicate back to the script with retrieved data to be passed for shell- level processing but in a few cases it does. The problem is, SQL+ is really meant to be an end user app and not an API that can communicate with other clients programmaticaly. That is why people have invented APIs such as `DBD::DBI` for Perl, `JDBC` for Java, ODBC etc. The way it is done is they invoke SQL+ and then parse the output, which is clearly designed for human eye consumption, using tools like `sed` and `awk`. The whole thing is at best a hack and very prone to bugs. Since this client is rather conservative with their technology, they don't want to scale their scripts up to Perl or Python where there are data access APIs. So I am wondering whether there are similar APIs for shell, e.g. K or bash. What I would like is if an API would return data in a 2-dimensional array or strings (for the lack of type setting) so that I can just read DB data like that. The way they do it now is akin to parsing regular web page HTML to get a single stock quote rather than cleanly calling a web service and be done with it. Anybody know of a product I can use? Thanks


title: Is this a test smell or is it even worse?

text: I have recently been looking at some testscripts which looks a bit like               ...     try {       receiveSomething();       // something was received even though it shouldn't       failTest();     } catch (TimeoutException e) {       // nothing should be received       succedTest();     }      The problem I have with these types of tests is   1. They are not deterministic. You don't know if nothing was sent on purpose or if everything has crashed.   2. Its very hard to simultaneously test something else, which might actually, in this case, send something. My thoughts are one the one side, how can this types of tests be designed better, and secondly can this be an indication of a bigger design smell of the software that is being tested? EDIT To clairify, these test scripts are used for black box-testing of event-based, complex software, not unit testing, and my feeling is that the 'doing nothing' event is a very ambiguous one. :)


title: Which layer should order the columns shown to the user when using MVC?

text: Say you want to render a table with five columns, but you want the order of the columns to be different depending on some specific parameter. This would be very easy to accomplish if the model sets the order. The view can then simply use a loop and create the table accordingly. However, unless I have misunderstood things, we want to let the view handle how things are rendered (although I guess there may a gray area involved here in terms of what the view "should decide how to render")? It also feels ugly to let the model set formatting / order, but maybe this is another thing I might have misunderstood? If the view is supposed to deal with the order of the columns, what is a good way to accomplish it (read: having to use a lot of if-statements and other ugly code in the view)?


title: Single product owner for multiple Scrum teams

text: Is that a common practice to have a single product owner for more than one Scrum team, or usually you have a product owner for each team (even if multiple teams work on the same product). Thanks


title: Use a setStatus($arg) function or have separate enable() and disable() functions?

text: I've got two functions at the moment:               suspendGroupsAndUsers($groupId){}     enableGroupsAndUsers($groupId) {}      But the difference between the two is one variable/string. Should I just have:               setStatusGroupsAndUsers($status,$groupID) {}      This feels more DRY... Or have the above two functions actually call the setStatus function? Gut says use setStatus ...


title: Design documents as part of Agile

text: At my workplace, we face a challenge in that "agile" too often has meant "vague requirements, bad acceptance criteria, good luck!" We're trying to address that, as a general improvement effort. So, as part of that, I am proposing that we generate design documents that, above and beyond the user story level, accurately reflect the outcome of preliminary investigations of the effect of a given feature within the system and including answers to questions that we have asked the business. Is there an effective standard for this? We currently face a situation where a new feature may impact multiple areas in our "big ball of mud" system, and estimates are starting to climb due to this technical debt. Hopefully more thoughtful design processes can help.


title: Haskell vs Erlang for web services

text: I am looking to start an experimental project using a functional language and am trying to decide beween Erlang and Haskell, and both have some points that I really like. I like Haskell's strong type system and purity. I have a feeling it will make it easier to write really reliable code. And I think that the power of Haskell will make some of what I want to do much easier. On the minus side I get the feeling that some of the Frameworks for doing web stuff on Haskell such as Yesod are not as advanced as their Erlang counter parts. I rather like the Erlang approach to threads and to fault tolerance. I have a feeling that the scalability of Erlang could be a major plus. Which leads to to my question, what has people's experience been in implementing web application backends in both Haskell and Erlang. Are there packages for Haskell to provide some of the lightweight threads and actors that one has in Erlang?


title: Perl: Negative look behind regex question

text: The Perlre in Perldoc didn't go into much detail on negative look around but I tried testing it, and didn't work as expected. I want to see if I can differentiate a C preprocessor macro definition (e.g. #define MAX(X) ....) from actual usage (y = MAX(x);), but it didn't work as expected.                   my $macroName = 'MAX';         my $macroCall = "y = MAX(X);";         my $macroDef = "# define MAX(X)";              my $boundary = qr{\b$macroName\b};         my $bstr = "  MAX(X)";         if($bstr =~ /$boundary/)         {             print "boundary: $bstr matches: $boundary\n";         }         else         {             print "Error: no match: boundary: $bstr, $boundary\n";         }              my $negLookBehind = qr{(?<!define)\b$macroName\b};         if($macroCall =~ /$negLookBehind/) # "y = MAX(X)" matches "(?<!define)\bMAX\b"         {             print "negative look behind: $macroCall matches: $negLookBehind\n";         }         else         {             print "no match: negative look behind: $macroCall, $negLookBehind\n";         }              if($macroDef =~ /$negLookBehind/) # "#define MAX(X)" should not match "(?<!define)\bMAX\b"         {             print "Error: negative look behind: $macroDef matches: $negLookBehind\n";         }         else         {             print "no match: negative look behind: $macroDef, $negLookBehind\n";         }      It seems that both `$macroDef` and `$macroCall` seem to match regex `/(?<!define)\b$macroName\b/`. I backed off from the original `/(?<\#)\s*(?<!define)\b$macroName\b/` since that didn't work either. So what did I screw up? Also does Perl allow chaining of multiple look around expressions?


title: Multithreaded Programming?

text: Recently I've finished learning about multithreaded programming on single shared objects, but was curious about how different things would be in order to successfully program on multiple shared objects?


title: What do I need to consider when using code under the Apache License in an application submitted to Mac App Store?

text: First off, I am new to licenses and app stores. There is an example app on a framework that has a `Class` file with much of the functionality I'll need for my own app. It's less than 1000 lines of code and distributed under the Apache License 2.0.   1. As far as I know I can use/modify the code and just acknowledge the developer and include the license, but does this mean my _whole_ project will be distributed under the Apache License 2.0 or just does it just apply to that source file?   2. Once my project is done, would I be able to publish my app in the Mac App Store? Would I be able to sell it there?  The file is from an example project that pretty much demonstrates all which is possible in the framework, and using it in my project would save me a ton of time. However, if this is not possible I guess I'll just have to code it myself.


title: Is memory management in programming becoming an irrelevant concern?

text: **Background**   I revisited an old (but great) site I had not been to for ages - the Alioth Language Shootout (http://benchmarksgame.alioth.debian.org/). I started out programming in C/C++ several years ago, but have since then been working almost exclusively in Java due to language constraints in the projects I have been involved in. Not remembering the figures, I wanted to see, approximately, how well Java fared against C/C++ in terms of resource usage. The **execution times** were still relatively good, with Java at worst performing 4x slower than C/C++, but on average around (or below) 2x. Due to the nature of the implementation of Java itself, this was no surprise, and it's performance time was actually _lower_ than what I expected. The real brick was the **memory allocation** \- at worst, Java allocated:   * a whopping 52x more memory than C   * and 25x more than C++.  52x the memory ... Absolutely nasty, right? ... or is it? Memory is comparatively cheap now. **Question:**   If we do not speak in terms of target platforms with strict limits on working memory (i.e. embedded systems and the like), **should memory usage be a concern when picking a general purpose language today?** I am asking in part because I am considering migrating to Scala as my primary language. I very much like the functional aspects of it, but from what I can see it is even more expensive in terms of memory than Java. However, since memory seems to be getting faster, cheaper and more plentiful by the year (it seems to be increasingly hard to find a consumer laptop without at least 4GB of DDR3 RAM), could it not be argued that resource management is becoming increasingly more irrelevant as compared to (possibly implementation-wise expensive) high-level language features which allow for faster construction of more readable solutions?


title: Has programming for a living ruined your ability to enjoy technology?

text: To quote Arthur C. Clarke: > Any sufficiently advanced technology is indistinguishable from magic. Used to be I looked on technology with wonder and amazement. I wanted to take it apart, understand how it worked, figure it all out. Technology was magical. I'm older, I know more and I spend my days creating stuff that, hopefully, fills other people with that kind of wonder. But lately I've found my own awe for technology has been seriously curtailed. More often I'm just annoyed that it isn't as elegant or seamless or as polished or perfectly delivered as it seemed to be in my youth. It all looks broken and awkward, or cobbled together and poorly tested. Has programming ruined your ability to enjoy technology? Have you stopped wondering in awe and just started saying, "They could have done this better" every time you pick up a bit of technology?


title: Is Visual Studio just an IDE?

text: For Windows Development I mean. Looking over other questions there are alternatives to VS, but they seem to be web based ones, which is fine, or you could program an entire .net website in notepad, should the urge drive you to. But is there more to it than just an IDE for Windows Development? I.E. Is it possible for me to create an application in just notepad, is the compiler part of Visual Studio, or is it separate, which could be called via command line or something? I don't want to not use VS, I'm happy with it, does what I need etc etc, just more a facet I'm curious about.


title: SICP - Why use accumulate with cons when filter already passes back a list

text: In SICP 2nd Edition section 2.2.3, the authors have the following code:               (define (even-fibs n)       (accumulate cons                   nil                   (filter even?                           (map fib                                (enumerate-interval 0 n)))))      My question is why did they use _accumulate_ in this case? Couldn't they have got the same answer from _filter_ without using _accumulate_?


title: Is using PhoneGap for your first ever mobile app a good idea?

text: I am a beginner programmer. I've gotten an AS degree in CS which exposed me to the basics of c++, data structures, and algorithms and have light experience with html/css/javascript from just messing around building my own basic websites. I am no where near a proficient professional programmer as of yet. My question is, would using PhoneGap to attempt to develop my first "app" for android/ios/whatever be a good idea or should I start out making native apps first? With all the hype over html5/javascript at the moment, PhoneGap seems too good to be true for a beginner like me. Thoughts? pros/cons?


In many interviews I've been asked this question. What is a Package Diagram? and What is a Sequence Diagram? and difference between Package Diagram and Sequence Diagram. Thanks in Advance. **Edit** Sorry, google give me lot of answer, but i want to practical answer with example.


title: Hash function classification interview question

text: In several places on the Internet there's the interview question > Classify the Hashing Functions based on the various methods by which the key > value is found. with answers like   * Direct method   * Subtraction method   * Modulo-Division method   * Digit-Extraction method   * Mid-Square method   * Folding method   * Pseudo-random method which I find strange. I think I know a lot about hashing, but this is plain gibberish to me, could anybody explain?


title: How to document a dual open source license?

text: If a project is dual-licensed **GPL** & **BSD** , should there be one `LICENSE` file with the text of both licenses? Or two separate files, one for each license? And I think I should put a copyright/license comment at the top of each source file. How should that comment indicate the dual-licensed status of the project?


title: Dealing with proj files in multi-platform apps

text: So I've been doing some cross-platform mobile applications using cocos2d-x. Basically it uses common c++ code, that can easily be compiled to the popular mobile platforms with some small wrapper code that stays constant while working on the common c++ code. Everything works great, but I have a problem keeping all my project files up to date. For example, to compile to windows I have a .csproj file that holds all the c++ code to compile, for iOS I have a .xcodeproj that holds the files, and for android I have a make file that points to the files to compile. This means any time I add a new file to my project, or do anything to alter the file structure I have 3 files I must update in order to continue to build for all platforms, if I add any other platforms the problem continues to get worse. I am wondering, is this a problem that has been solved? I'm sure I'm not the first to have problems like this, keeping up multiple project / make files to update for the different platforms to compile. I was thinking of writing my own wrapper that can easily update these files without having to open an IDE / notepad to manually update any time I add a file. But before I do I thought I'd ask the question if there was a well accepted way to handle this problem, perhaps something that already exists that deals with this exact problem. I was curious about whether to ask this here or stackoverflow, as I'm curious both at the cocos2d-x specific case, but also the general case whenever multiple projects must be updated whenever new code is added. I chose to post it here, but am interested to the answer to both questions (specifically if cocos2d-x has something already widely used to solve the problem, and solving the problem in the general case).


title: Why is it evil to run selects from a prod server?

text: I'm basically looking for arguments to persuade the internal "consultants" at work as the following are not working:   * What happens if you do a Cartesian join and crash the server?   * You don't need to do selects from that server. You have other servers for that.   * It's not for you it's for the clients. We're going to be implementing DB wide triggers to stop casual logging on during work hours but with a fail safe so that devs / DBAs can fix issues if they come up but need some more arguments to forstall the screaming that's probably going to happen. **EDIT** To clarify; there are no actual problems. The database will be locked down better no matter what. I'm not looking for technical reasons to do things or advice on how to manage a DB. I'm hoping that some other technical people on here have some advice on how to explain to non-technical people the, possibly only perceived, importance of this particular issue.


We have a number of clients, whose systems share some functionality, but also have quite a degree of diversity. The number of clients is growing - always a healthy thing! - and the diversity between their businesses is also increasing. At present there is a single ASP.Net (Web Forms) Web Site (as opposed to web project), which has sub-folders for each tenant, with that tenant's non- standard pages. There is a separate model project, which deals with database access and business logic. Which is preferable - and most importantly, why - between having (a) 1 database per client, with only the features associated with that client; or (b) a single database shared by all clients, where only a subset of tables are used by any one client. The main concerns within the business are over:   * maintenance of multiple assets - backups, version control and the like   * promoting re-use as much as possible How would you ensure these concerns are addressed, which solution is preferable, and why? (I have been also compiling responses to similar questions) **Edit** : here's the highlights from my research from other sources: Should I use one database per application or share a single database amongst multiple applications Splitting up a single project into libraries Supporting multitenancy Multi-tenancy - single database vs multiple database http://msdn.microsoft.com/en-us/library/aa479086.aspx http://stackoverflow.com/questions/2213006/how-to-create-a-multi-tenant- database-with-shared-table-structures http://cloudcomputing.sys-con.com/node/1610582 http://blogs.msdn.com/b/cbiyikoglu/archive/2011/03/23/moving-to-multi-tenant- model-made-easy-with-sql-azure-federations.aspx http://ask.sqlservercentral.com/questions/3615/one-database-or-multiple.html http://devlicio.us/blogs/anne_epstein/archive/2009/04/24/the-case-for- multiple-dbs-in-multi-tenancy-situations.aspx http://ayende.com/blog/3497/multi-tenancy-the-physical-data-model http://www.codeproject.com/Articles/51334/Multi-Tenants-Database-Architecture http://discuss.joelonsoftware.com/default.asp?design.4.319460.16 http://stackoverflow.com/questions/3479297/multiple-application-using-one- database http://stackoverflow.com/questions/1676552/single-or-multiple-databases http://mikehadlow.blogspot.co.uk/2008/11/multi-tenancy-part-1-strategy.html http://mikehadlow.blogspot.co.uk/2008/11/multi-tenancy-part-2-components- and.html http://www.sqlservercentral.com/Forums/Topic893107-373-1.aspx#bm1047297


title: Good practice for object instantiation in MVC

text: In MVC the Domain Models(from Model Layer) should instantiate other Domain Models or all the Domain Models should be instantiate in the controllers and passed down using Dependency Injections? How do you implement this in real applications? If you choose this path isn't the controller getting to fat?


title: Thoughts on web development architecture through integrating C++ in the future to a web application

text: I'm looking to build a website (it's actually going to be a commercial startup) I saw this question and it _really_ shed some light on a few things that I was hoping to understand (kudos to the op). After seeing that, it would make sense that, unless the website were required to actually have millions of hits per day, it wouldn't be a viable solution to write a C++ backend on the server side. But this got me thinking. what if it in the (unlikely) events of the future, it _does_ go that route? The problem is that, while I'm thinking of starting this all using .Net (in the beginning) just to get something quick and easy up without a lot of hassle (in terms of learning), and then moving towards something more Open Source (such as Python/Django or RoR) later to save money and to support OSS, I'm wondering IFF the website actually becomes big, will it be a good idea to integrate a C++ backend, and use Python ontop of C++ for a strong foundation, and then mitigate HTML/CSS/AJAX/etc ontop of the backend's foundation? I guess, what I'd like to know is that, given the circumstance, if this _were_ to happen, would it be a proper approach in terms of architecture? I'd definitely be supporting MVC as that seems to be a great way to implement a website. All in all, would one consider this rational, or are there other alternatives? I like .Net, and I'd like to use it in the beginning, because I have _much_ more experience with that than, say, Python or PHP, and I prefer it in general, but I really do want to support OSS in the future. **I suppose the sentence I'm looking for is, "is this pragmatic?"**


title: Sharing programming fees with a fellow software developer

text: My question relates to how I should share the fees paid by clients to me and a fellow programmer, both of whom are freelancers. I've thought of a few options, but I'm in a dilemma as to which one would be the most motivating for both of us. 1) The first option I've thought is a fifty-fifty share. However, more brainwork is going to be done by my colleague, while initially at least, I will be handling the communication with customers. 2) The second option is a 60-40 share, where the colleague exerting more efforts gets a bigger share. This is the option I feel most inclined to adopt, but I'm not sure how it's going to feel in the long run. 3) The third option is calculating each one's contribution in terms of the number of hours spent, and sharing the revenue accordingly. It will be wonderful to hear everybody's thoughts on this!


title: XAML - Like/Dislike?

text: After bashing my head against the brick wall that is XAML, I've decided to come here and ask other people if they are as frustrated as I am. So,   * Do you like XAML? Please justify.   * Is XAML the problem, or the lack of good tools? My issue could be resolved if the binding system gave me a file-line number location of the binding that's failing. This isn't a XAML issue so-much-as a debugger issue. Apart from the issues with tooling, I find that XML does not make a suitable programming language, and that XAML has workarounds to fix things that wouldn't have been a problem in any other "real" programming language. For example, string formatting on a binding. XAML also breaks when you need to step outside the hierarchical structure for things like context menus. Because they are defined within the xaml hierarchy people assume that they are part of the visual hierarchy too, which is not the case. This can lead to subtle binding issues, which are difficult to debug etc. As a comparison, HTML-CSS-Javascript works well because each part handles a specific part of displaying a web page. HTML for data and layout, CSS for style, and Javascript for execution. In contrast, XAML is trying to do everything and fails. Please note, I love WPF, so don't take this as a critisism of WPF, Silverlight or any particular WPF/Silverlight control. I'm only interested in a discussion about the XAML language.


title: Case convention- Why the variation between languages?

text: Coming from a Java background, I'm very used to camelCase. When writing C, using the underscore wasn't a big adjustment, since it was only used sparingly when writing simple Unix apps. In the meantime, I stuck with camelCase as my style, as did most of the class. However, now that I'm teaching myself C# in preparation for my upcoming Usability Design class in the fall, the PascalCase convention of the language is really tripping me up and I'm having to rely on intellisense a great deal in order to make sure the correct API method is being used. To be honest, switching to the PascalCase layout hasn't quite sunk in the muscle memory just yet, and that is frustrating from my point of view. Since C# and Java are considered to be brother languages, as both are descended from C++, why the variation in the language conventions? Was it a personal decision by the creators based on their comfort level, or was it just to play mindgames with new introductees to the language?


title: How to model optional use cases in UML

text: Let's say, I want to model an application which allows users to model class diagrams. The high level use case can be modelled as UC1:Model Class Diagram, which refines itself into UC11: Model Class, UC12: Model Connection, UC13: Model Composition, etc. Since UC11, 12, 13 are part of UC 1, I used the include-Association. Unfortunately, the UML specification says that included use cases are essential parts and if you would leave one of them out the high level behavior could not be achieved any more. But in this example a valid class diagram can be created without modelling a connection or a composition, so these use cases are optional. To boil it down to an essence: How can optional use cases be modelled in UML while providing a mechanism for reuse (like the include association)?


title: PHP Open Source Tools for Agile Development

text: Hello Everyone, There are so many Questions on Stackoverflow about Agile tools, but I haven't seen a tool which can be installed on a PHP Server. I'm just looking for an _**Open Source Scrum Tool**_ or just an _**Open Source Scrum Dashboard**_ for my Team, which can be installed on my webspace( **php** ). Thank you for Help!


title: What is occurring in the world of server-side technologies in regards to the mobile app boom?

text: With mobile technologies becoming increasingly popular what is happening on the server-side with most of these apps when they need to communicate with a back end? I'm used to the world of technology from 10 years ago when most resources were accessed by requesting a dynamic web page that behind the seen used a server- side language to get the information it needed from a relational database. Is this still the case, and if not, what are the big changes?


title: On linux, how to get "incompatible" i386 f77 libraries to work with current Fortran compilers, like gfortran?

text: I would like to run the elf32-i386 library libkernlib.a with a Fortran 77 program on my latest Ubuntu linux machine. From what I've read, `gfortran` is backwards compatible with Fortran 77, but I'm having trouble to get it to work with the library. I've tried -ff2c, -fbackflash, etc. but everything is still giving me               $ gfortran -ff2c -O -o output f77fortran.f -lkernlib          /usr/bin/ld: skipping incompatible //usr/local/lib/libkernlib.a when searching for -lkernlib     /usr/bin/ld: canot find -lkernlib      I have also tried using `fort77`. I cannot find a `f77` that works. **If anyone knows how to run f77 programs and its libraries, whether using`gfortran` or something else, that would be great.** Btw, the libkernlib.a library has older versions from "libraries" links on this page, but the ones I've tried all give the same error and are all i386 (I figured out that by `objdump -f libkernlib.a`). Context: This is part of a Mathematica project that uses old code.


title: Domain Model vs View Model

text: I'm in the early stages of my programming career and I've been working with MVC for just about a year now. I've spent much time learning about the pattern and the concepts behind it, but as the projects I'm working with get larger I'm starting to think that maybe I don't have the best understanding of how the model layer is supposed to work. I hear a lot about always having a View Model to protect your Domain Model but how does this work in practice? What does the relationship between the two look like? What if a model doesn't need any extra "view" logic, should I just create a copy of it? Why?


title: Java for a perfect Media Player?

text: I am looking forward to build a media player with java, and basically what I found was JMF. But, then again, this API is not upto date and doesn't support latest formats such as `MKV`. On more research, I stumbled upon http://stackoverflow.com/questions/10440152/any-simple-and-up-to-date-java- frameworks-for-embedding-movies-within-a-swing Got all excited, but then digging some more, left me with this http://stackoverflow.com/questions/8153227/adding-other-video-codecs-dvd- support-to-javafx-2-2 Now, I am disappointed and in a fix that how all the good media players (VLC, KMPlayer etc) been able to support all video and audio formats. They must be build using a programming language, IMHO ! So, my question would be, in-order to build a `complete media player` which supports `all kind of media files`:   1. Is `JAVA` incompetent ?   2. Has one ever build a good media player using `JAVA` ?   3. If Java can't, how are their so many media players on `android`, with all video support ?   4. Is it just Java or no modern language can do it ?   5. Do I have rely and choose C, C++ to do this ?


title: Using a single table for identity and metadata

text: I'm in the early design phase of a project to provide an e-commerce platform that will require several entities to be modelled, products, customers, orders, CMS pages, etc. They will all have a few things in common (ID, creation timestamp, last modified timestamp, etc). My first thought was the usual one of giving the various tables an ID column that will use the database's mechanism for assigning uniqueness (autoincrement in MySQL, sequences in Postgres, etc) but given they have a few things in common I was considering a design where all that data is kept in a base BusinessObject table and the tables for the other entities use a primary foreign key that references the BusinessObject table. For example (in pseudocode)               CREATE TABLE BusinessObject (         id,         date_created,          date_updated,          is_deleted,         // etc         PRIMARY KEY id AUTOINCREMENT     );          CREATE TABLE Customer (         id,         forename,         surname,         // etc         PRIMARY KEY id         FOREIGN KEY id REFERENCES BusinessObject.id     );          CREATE TABLE Product (         id,         name,         price,         description,         // etc         PRIMARY KEY id         FOREIGN KEY id REFERENCES BusinessObject.id     );      and so on. I can think of a number of advantages to this approach. First, a particular ID always only maps onto one particular object. For example, the id 3 in a system where each table generates its own IDs could refer to a customer, an order or anything else, whereas in the above design, ID 3 will always be an order, because there could never be a customer or product with ID 3. This would make stuff like extrapolating the referenced business object from the URL a lot easier, allowing for simpler routing in the application layer. However, it also means that every table in the system must join against the BusinessObject table, and I'm worried that this would result in some significant drawbacks. For example the fact that one particular table is going to be involved in nearly all queries may result in degraded performance for that table, or that it might be possible for a row in Customer to reference the same row in BusinessObject as a row in Product, resulting in loss of data integrity unless some additional steps are taken to prevent that. So basically, what are the pros and cons of a design where a single table provides the identity data for most of the rest of the database? Are such designs fairly common or is it better to just have each table have its own identity source and rely on cleverer application logic to determine the object being referenced?


title: Data structure: sort and search effectively

text: I need to have a data structure with say 4 keys . I can sort on any of these keys. What data structure can I opt for? Sorting time should be very little. I thought of a tree, but it will be only help searching on one key. For other keys I'll have to remake the tree on that particular key and then find it. Is there any data structure that can take care of all 4 keys at the same time? these 4 fields [source ip, destination ip, source port, destination] are of total 12 bytes and total size for each record - 40 bytes.. have memory constraints too... around one lac records operations are : insertion, deletion, sorting on different keys. For printing , sorting the records on any of one keys should not take more than 5 seconds.


title: Is "3 or more use a for" a good rule of thumb?

text: When do repetitive operations become a code smell? I read this article by Charles Petzold where he suggested this and was wondering what people thought.


title: Refactoring the shipping application code to use DDD factories

text: I was trying to find examples for using DDD factories and I came across the shipping application from Eric Evans' book. However when I checked the BookingService the code to create a `Cargo` had this comment at line **37** :               34    public TrackingId bookNewCargo(final UnLocode originUnLocode,     35                                   final UnLocode destinationUnLocode,     36                                   final Date arrivalDeadline) {     37      // TODO modeling this as a cargo factory might be suitable     38      final TrackingId trackingId = cargoRepository.nextTrackingId();     39      final Location origin = locationRepository.find(originUnLocode);     40      final Location destination = locationRepository.find(destinationUnLocode);     41      final RouteSpecification routeSpecification = new RouteSpecification(origin, destination, arrivalDeadline);     42       43      final Cargo cargo = new Cargo(trackingId, routeSpecification);     44       45      cargoRepository.store(cargo);     46      logger.info("Booked new cargo with tracking id " + cargo.trackingId().idString());     47       48      return cargo.trackingId();     49    }      How should the DDD factory be used here? Which parts exactly should be refactored to use the factory in these piece of code?


**The debate:** Should all development, including refactoring work, be accompanied by a tracking issue? (in our case, Jira) **The common ground:** Our primary goal is quality. A working product, every release, is more important than anything else. Our codebase is old and automated tests are lacking; we are working on this but it's a long-term project, we need interim processes. **Position 1:** Refactoring work must be tracked in Jira. If it is not obviously related to the change you are making then you must raise another issue. If you don't then the work bypasses review and testing and there is a risk to our primary goal. The argument has been made that PCI compliance (a near-future goal of the business) requires this level of tracking; I'm not in a position to say that is true or false with any level of certainty. **Position 2:** Code quality is vastly important. The better it gets (to a point; a point we are nowhere near), the more likely we are to keep releasing a working product. Anything which puts a barrier, no matter how small, in the way of refactoring is a risk to our primary goal. Often, the IDE does the work for you, so it isn't likely to go wrong anyway. **The following cases have been made:** Would it satisfy both positions if a developer writes "Refactor" and the relevant revision numbers on a card? Honestly, this feels like it's going to make everyone equally unhappy. It still puts a level of resistance on doing the refactoring, but doesn't offer sufficient tracking. What about having all-encompassing Jira issues that cover the refactoring work for an iteration? Yes, this removes the developer resistance layer, but I fear it also removes the tracking benefits of having a Jira issue. How do QA get a clear idea what to test? This seems to be a political solution, keeping everyone calm by adding in a light-weight but ultimately pointless process. It seems to me that, given that both sides of the debate ultimately want the same thing, there should be a solution that makes everyone genuinely happy. We can't have been the first people to ask this question, so what experiences have others had in similar situations?


title: What are the main practices and design patterns every .NET guy should know?

text: In my brief time as a professional programmer I've seen lots of applications written by programmers who's entire education appears to have been reading the first couple of chapters in a .NET 2.0 book. Heck when I started I wrote most of those applications! What are the biggest design patterns crucial for writing AWESOME .NET applications? By awesome I mean on the inside too!


title: Which applications have driven the mass spread of floating point units?

text: Floating point units are standard on CPUs today, and even desktops might use them today (3D effects). However, I wonder which applications have initially driven the development and mass adoption of floating point units in history. Ten years ago, I think most uses of floating point arithmetics constituted in either   1. Engineering and Science applications   2. 3D graphics in computer games I think for any application where decimal numbers might have appeared at those times, fixed point arithmetic has been sufficient (2D graphics) or even desirable (finance). Usage of integers would have been sufficient then. I think these two applications have been the major motivation to establish floating point arithmetic in hardware as a standard. Can you name others, or is there a compelling reason to disagree?


title: Main class passes dbConn obj to all its services, I need to change the dbConn for one of its services. - suggestion for design pattern

text: There is this main class and there are several services ( which uses db connection to retrieve data ) These services are initialized in the main class db properties are obtained from the property file and then dbconnection is opened by calling a method dbOpen() written in the main class and the resultant connection object is set to the service objects by iterating through the list of services and by calling setConnection method on the service `note: that the services are instantiated in the main class and the main class is not a superclass for services.` I also need to mention that there is this `recycle db connection` scenario only main class is aware of.               /** connects to DB, optionally recycling existing connection),           * throws RuntimeException if unable to connect */          private void connectDb(boolean recycle) {             try {                 if (recycle) {                     log.status( log.getSB().append("Recycling DB Connection") );                     closeDb();                 }                 openDb();                        for ( int i = 0 ; i < service.length ; i++ )                 {                     service[i].setConnection(db);                 }             }      One of the service needs to use a different database, what is the best design pattern to use?


title: In WPF, should I base my converters on types or use-cases?

text: I'm looking for some advice on how to write my WPF value converters. The way I'm currently writing them, they are very specific, like (bool?,bool) => Brush, i.e. I'm writing each converter for a specific use case, in this case, the Brush is bound to an indicator showing equality information between the bool? and the bool. This obviously makes re-use very hard and I end up with a quite large list of converters. Should I strive to write my converters in a more general way? Can I?


title: Technique for multiple users on same datasets

text: This is more a learning question than coding, but I'm certain it's a common issue for anyone developing administration systems or applications in php/mysql/js etc. I've developed quite a complex application that lets users upload images, and define hotspots in them with associated actions. The images are stored in a table, and the actions in another, with json data for every action in a text field. However, like I say, the problem is generic. Basically, my fear is that if someone is editing the same image and set of actions at the same time, and they both submit changes, or if it was edited by someone else then there's a whole series of structures that potentially will fail on submission. I don't want to implement a locking system, as the system is very wide ranging (links to other images, etc), and I think it's a bit ugly. I saw this link (MSDN Multi-tenant architecture article) in another question, but it seems a little overwhelming and specialised for sql server. So - what are the terms for data and system architecture here that I can investigate, or are there some good articles to do with this topic that people can recommend? Specifically for php/web world would be great!


title: using trademarked/copyrighted images in my public web application

text: Consider a public web application that wants to 'look' better by including the use of corporate images. The imagery would be used to give the website visitor a choice: Coke or Pepsi, Starbucks or Dunkin, Yankees or Red Sox, etc. It's a service that wants to enhancing the user experience by having those logos in place in the relevant spots. The web application would not be selling those images, or anything with the images. The site would be generating revenue via ads or paid services. Is there a general accepted practice on the web regarding trademarked images or logos? Has this been legally tested in any jurisdiction?


title: When can I say I know how to program in C?

text: Let's see. I've seen in several places, including Advice for Computer Science College Students, by Joel Spolsky, that a graduated Computer Science student must know C. **How do I know if I know C or not?** I have developed a few projects in C (an implementation of the _ext2_ filesystem with FUSE, and a few others), but I suppose it means more than just knowing pointers, free, etc.


title: Scaling yourself up against a better programmer/role model?

text: After having watched this video I have to ask how a programmer can go about measuring themselves against other, better programmers much as a chess player would. How would you decide who is a role model to start with? I mean James Gosling is known by every Java programmer but he invented the language and there is almost certainly an expert out there who could show him a few tricks. Now say you have you found that role model. This could be, say, StackOverflow's own superstar Jon Skeet. It's possible to read his answers on StackExchange, visit his blog and read his books but what about actual programming skill? How could you go about fixing challenges and determining where you are in the programming skill spectrum?


title: Review my class hierarchy

text: I have created a class hierarchy for an inventory system for a book/magazine. Here's the picture: ![enter image description here](http://i.stack.imgur.com/3WGKd.jpg) Will it do? I know there's no magazine class yet but I was wondering if anyone could suggest a better idea.


title: Selling an open source project: some issues

text: I am the creator / main developer of a small sized open source (PHP) project (GPL3). Currently there is a development team of 3 people (me included). This team has been quite active for some time, but since almost 2 years not much has happened. I myself have decided I want to stop working on the project, but I can't just leave the project because I care about it and I know if I abandon it, it will just be a matter of time before the project completely dies. At this moment, there are still some users and the project is only slightly out- of-date. So I'm thinking about selling the whole project. Of course I'd need to get consent of the other developers, but for now I'm assuming that's not a big problem. So at this moment I have 2 questions: 1) If the project would be sold to a commercial party, would it be possible for them to convert the project to closed source? I would prefer to sell the project to a company/organization that would continue the development under an open source license. 2) Does anyone have any tips to find interested parties? I don't know if I just want to put up a "For Sale" sign on the website of the project. Maybe someone has experience with a comparable situation. Ok guys, thanks in advance!


title: Where is the M in MVC?

text: I'm trying to refactor my application into MVC, but I'm stuck on the M part. In a database-backed app, the model is implemented in the app code, right? But then, **what is in the database -- is that not also the model?** _(I'm not using the database as a simple object store -- the data in the DB is an enterprise asset)._


title: How to support multiple firmware versions?

text: I'm working on an app which talks to a bluetooth low energy (BLE) device and exchanges customized data with it. Our team has defined the data models and there's a method that will parse the data payload and assign values to the corresponding characteristics. It works all fine until we have introduced a new firmware. In this new firmware some values in the data payload have been re-defined or the offset of a specific value has been changed. So the parsing method will need to be updated/re-written according to the new payload definition. Then here comes the problem: both two versions of the firmware need to be supported! Of course I could write a lot of if/else in the parsing method right now, but what happend if 3 other firmware updates arrive one after other? I can imagine the code will become hard to read and lose it's simplicity. I'm wondering if there's an elegant way to manage the co-existence of firmware versions. Maybe a design pattern that can be adopted here? **To make it more specific:** In my model class `Temperature` I've the following properties:               @property (nonatomic, readonly) float temp_outside;     @property (nonatomic, readonly) float temp_inside;      The library has to support 3 different firmware versions:   * **V1** does only support `temp_outside`   * **V2** does support `temp_outside` and `temp_inside`   * **V3** does support `temp_outside` and `temp_inside`, but `temp_inside` has to be obtained differently compared to **V1 & V2** Assuming the firmware provides their information within the `manufacturer data` of the advertisings as raw data:   * **V1 firmware:** 00 42 0a      * (byte 1: sw id, byte 2: protocol id, byte 3: temp_outside)   * **V2 firmware:** 00 43 0a 10      * (byte 1: sw id, byte 2: protocol id, byte 3: temp_outside, byte 4: temp_inside)   * **V3 firmware:** 00 44 10 0a      * (byte 1: sw id, byte 2: protocol id, byte 3: temp_inside, byte 4: temp_outside) What is the best way to implement this? There are several things to consider:   1. The model has values which might not be filled by a specific firmware; should I have separate models per firmware or how can I make sure that only supported properties will be accessed?   2. The method responsible for parsing the bytes into the model has to support all firmwares. Should there be one method / parser with several conditions based on the protocol id or several parser classes?   3. The usage of the library within view controllers should be as convenient as possible.


title: What sort of information can I extract out of a dll file?

text: I was dealing with a virus earlier today which was a .dll file disguised as RUNDLL.dll which is regularly seen in the task manager and launches on startup. I would like to know how much information I could have extracted from that dll before deleting it. I used .NET reflector, and the file was unrecognized (meaning it was not c# code from what I understand.) I used visual studio and attempted to reference it but was greeted by another error. Visual studio handles all of the .net languages so I was surprised to say the least. I expected to find atleast the function names in the object browser if not anything else. Decompiling it was probably a waste of time if it was c++/c since that would just be assembly code. In what ways could a .dll file like this one prevent revealing information (function names, number of functions, etc.)? Are c++/c .dll files basically impossible to investigate for further information? Thanks.


title: How can a manager ensure developers are pushing up to the origin every day?

text: Our team has been using Git for a couple of years. I love it, after previously using Visual Source Safe, SVN and TFS. However, my manager has been getting increasingly agitated about it and is threatening to go back to SVN or TFS. The problem is human nature: Developers forgetting to push up to the origin every day, then going sick or taking a holiday, and someone else having to pick up the project, and not knowing whether the latest code is in the origin, or whether it is sitting on the absent developer's machine. There is no visibility of which developer was the last to work on which file, as there is with a centralized source control system. I really want to avoid going back to SVN of TFS. So my question is: How can a team use Git successfully in a way that takes into account human nature (forgetfulness, laziness, etc)? How can I ensure that at the end of every day the latest code has been pushed to the origin so that someone else can step in and take over the next day, if need be? Is the answer continuous integration? I've read about workflows that include having to push to a CI branch on the origin to build the project.


title: Use Google Analytics to track visitor/download stats for a Google Code Project?

text: Can you use Google Analytics to track visitors/downloaders for a Google Code project? I've searched google for an answer but I get results about Google Analytics as a Google Code project itself and not for applying it to a Google Code project for visitor/download data.


title: Morse Code - Binary Tree

text: How is the Morse Code representation of a letter determined? "E" = "." "T" = "-" Why is it not alphabetic? As in let "A" = ".", "B" = "-", "C" =".-", etc. I'm trying to develop an algorithm for a traversing Binary Tree filled with these letter. My main aim is to search for a letter, like "A", but I don't know what conditions to use that determines when to branch to the right or left node.


title: Amazon Cloud (EC2) w/SQL Server. Pay for SQL instance, or use an AMI w/SQL Server Express?

text: I have been considering using the Amazon cloud (EC2) for a small workflow application. In terms of power and storage, a SQL Server Express database will more than meet my needs. I have been cautioned against paying for just a Windows server instance and installing SQL Server Express due to mainly security issues. Is it reasonable to think that there is an Amazon Machine Image (preconfigured images that you can load onto your instance) with SQL Server Express installed where most of the server "hardening" has been taken care of? The wise course may be to just pay for the Windows + SQL Server instance so it is already configured for me, but it is quite a cost difference.


title: SQL problems and answers book for a functioning SQL programmer

text: It was pointed out to me yesterday that I need to get a book on SQL and learn about it properly. That is probably a fair assessment; I'm a functioning SQL programmer who can in general extract from the database the information that is needed, but as soon as extracting the data needs more than a couple of `joins` and a `where` clause the query that I come up with is probably not as good as it could be. Previously I was working at an Oracle shop where there were a few very good SQL programmers who would generally design the more complex queries and would be on hand to answer questions, but now I'm at a SQL Server shop where no one really has much of a clue about SQL and so I feel like I need to get my skills up. What I'm looking for is a book that is fairly short and very practical that I can work through in the evenings with a series of difficult SQL problems and then well explained solutions along with a few pieces of sage advice that is aimed at a programmer who can "do SQL" who wants to become more of a "SQL programmer". I appreciate that many things about SQL are platform dependent, so since I'm currently in a SQL Server shop then my preference would be for a book aimed at TSQL. Any suggestions?


title: How advanced are author-recognition methods?

text: From a written text by an author if a computer program analyses the text, how much can a computer program tell today about the author of some (long enough to be statistically significant) texts? Can the computer program even tell with "certainty" whether a man or a woman wrote this text based solely on the contents of the text and not an investigation such as ip numbers etc? I'm interested to know if there are algorithms in use for instance to automatically know whether an author was male or female or similar characteristics of an author that a computer program can decide based on analyses of the written text by an author. It could be useful to know before you read a message what a computer analyses says about the author, do you agree? If I for instance get a longer message from my wife that she has had an accident in Nigeria and the computer program says that with 99 % probability the message was written by a male author in his sixties of non-caucasian origin or likewise, or by somebody who is not my wife, then the computer program could help me investigate why a certain message differs in characteristics. There can also be other uses for instance just detecting outliers in a geographically or demographically bounded larger data set. Scam detection is the obvious use I'm thinking of but there could also be other uses. Are there already such programs that analyse a written text to tell something about the author based on word choice, use of pronouns, unusual language usage, or likewise?


title: Algorithms for Data Redundancy and Failover for distributed storage system?

text: I'm building a distributed storage system that works with different storage sizes. For instance, my storage devices have sizes of 50GB, 70GB, 150GB, 250GB, 1000GB, 5 storage systems in one system. My application will store any files to the storage system. Question: How can I build a distributed storage with the idea of data redundancy and fail-over to store documents, videos, any type of files at the same time ensuring that should one of any storage devices fail, there would be another copy of these files on another storage device. However, the concern is, 50GB of storage can only store this maximum number of files as compared to 70GB, 150GB etc. With one storage in mind, bringing 5 storage systems like a cloud storage, is there any logical way to distribute or store the files through my application? How do I ensure data redundancy through different storage sizes? Is there any algorithm to collate multiple blob files into a single file archive? What is the best solution for one cloud storage with multiple different storage sizes? I open this topic with the objective of discussing the best way to implement this idea, assuming simplicity, what are the issues of this implementation, performance measurements and discussion of the limitations.


title: Uses of persistent data structures in non-functional languages

text: Languages that are purely functional or near-purely functional benefit from persistent data structures because they are immutable and fit well with the stateless style of functional programming. But from time to time we see libraries of persistent data structures for (state-based, OOP) languages like Java. A claim often heard in favor of persistent data structures is that because they are immutable, they are _thread-safe_. However, the reason that persistent data structures are thread-safe is that if one thread were to "add" an element to a persistent collection, the operation returns a _new_ collection like the original but with the element added. Other threads therefore see the original collection. The two collections share a lot of internal state, of course -- that's why these persistent structures are efficient. But since different threads see different states of data, it would seem that persistent data structures are _not_ in themselves sufficient to handle scenarios where one thread makes a change that is visible to other threads. For this, it seems we must use devices such as atoms, references, software transactional memory, or even classic locks and synchronization mechanisms. Why then, is the immutability of PDSs touted as something beneficial for "thread safety"? Are there any real examples where PDSs help in synchronization, or solving concurrency problems? Or are PDSs simply a way to provide a stateless interface to an object in support of a functional programming style?


title: Security Risks of Unsigned ClickOnce Manifests

text: Using signed manifests in ClickOnce deployments, it is not possible to modify files after the deployment package has been published - installation will fail as hash information in the manifest won't match up with the modified files. I recently stumbled upon a situation where this was problematic - customers need to be able to set things like connection strings in app.config before deploying the software to their users. I got round the problem by un-checking the option to "Sign the ClickOnce manifests" in VS2010 and explicitly excluding the app.config file from the list of files to have hashes generated during the publish process. From a related page on MSDN > "Unsigned manifests can simplify development and testing of your > application. However, unsigned manifests introduce substantial security > risks in a production environment. Only consider using unsigned manifests if > your ClickOnce application runs on computers within an intranet that is > completely isolated from the internet or other sources of malicious code." In my situation, this isn't an immediate problem - the deployment won't be internet-facing. However, I'm curious to learn what the "substantial security risks" of what I've done would be if it was internet-facing (or if things changed and it needed to be in the future). Thanks in advance! * * * **Edit / follow-up:** Does _not signing_ the ClickOnce manifest constitute an unsigned manifest (as per MSDN's definition)? The application manifest contains a hash of the files in the deployment package. Any changes to the files within it results in a validation failure during installation. Does this negate the above security risks, at all?


title: Solutions for floating point rounding errors

text: In building an application that deals with a lot of mathematical calculations, I have encountered the problem that certain numbers cause rounding errors. While I understand that floating point is not exact, the problem is _how_ do I deal with exact numbers to make sure that when calculations are preformed on them floating point rounding doesn't cause any issues?


title: Automatically create or update object in database

text: I have a database class with the following interface:               public Database {         //returns false if p (its ID) is already available         //otherwise adds p the the list and returns true         public boolean create(Person p);              //returns false if p (its ID) was not found in the list         //replaces the available Person q (q.ID == p.ID) with p and returns true         public boolean update(Person p);              //returns false if p (its ID) was not found in the list         //marks the available Person q (q.ID == p.ID) as inactive returns true         public boolean remove(Person p);     }      The `Person` is immutable and can be identified by a unique id. I have a `EditDialog` which looks like this: ![Editing a Person and the available Save/Chancel/Remove functionalities](http://i.stack.imgur.com/H7l0E.png) I wanted to reuse my code and so the `EditDialog` is used for create a `Person` or update it. So this dialog is initialized either by a available `Person` instance (Edit-Operation) or by a new one (Create-Operation). Because I learned that there is always an evil user I wanted to avoid the following scenario:   * Click "Create Person" button      * New `Person` is created in Database     * `EditDialog` for new `Person` is displayed   * Click "Chancel" button      * `Person` has to be removed (= marked inactive) from `Database`     * `EditDialog` is disposed   * repeat Which would lead to many inactive `Person`s in the `Database`. So I decided to only create the `Person` in the `Database`, if the user clicks the "Save" button. Which leads to two possible scenarios for the `Listener` of the "Save" button:   1. New `Person` should be created in `Database`   2. `Person` should be updaated in `Database` So the code of the Listener looks like the following:               if(!database.create(p) {         database.update(p);     }      Which is not so pretty in my opinion. The Long and the short of it is, **should the Database automatically**   * **update a`Person` if it's availabe at invokation of `create(Person)`?**   * **create a`Person` if it's not yet available at invokation of `update(Person)`?** **Or is there another solution/practice I didn't think about?**


title: How to Model a simple file-system by UML class diagram

text: I want to model a file system which contains both files and directories, and directories can contain either files or other directories. This is what I have reached so far: ![My simple file system class diagram](http://i.stack.imgur.com/6URV9.png) In OOSE book, however, a similar model is presented: ![class diagram for file system presented](http://i.stack.imgur.com/GonyF.png) Now I have two questions:   1. I wonder why the author did not use an _Interface_ to represent the abstract type **FileSystemElement**? Isn't using an interface for this type correct?   2. As we know, files and directories must have names with similar constraint (e.g. maximum length of 256 characters). Therefore, it would be nice if I model this in the **FileSystemElement**. But an **interface** cannot have a _abstract attribute_ , so I have to repeat **name** attribute in both **Directory** and **File** classes. Is there any better workaround for this problem?


title: What an architect should do?

text: It seems that the role of architect varies in between software companies. What does the role of a standard architect include? E.g...   1. Draw high level diagrams and explain to the team why this is a reasonable architecture.   2. Write documents for managers or customers.   3. Write the infrastructure of a software upon to which others add more features.   4. Write various prototypes and run performance tests.   5. Conceive additional features and improvement to existing features and guide the team towards them.   6. Other responsibilities.


title: What is the difference between requirements and acceptance criteria?

text: I am trying to understand the difference a little better as it seem like they are the same thing. I have work in projects with no use of the requirements and everything is an acceptance criteria, and on projects that have both.


title: New and old technologies coexist in legacy system

text: New technologies can accomplish existing tasks in more efficient and powerful way. But sometimes old technologies cannot be discarded unfortunately, so more numbers of technologies in one system make maintain difficult. Is it worth to introduce new technologies? For instance, a legacy system uses SOAP internally and JSON is new technology to replace the SOAP. The problem is JSON can only replace **some** of SOAP, because the rest of SOAP is too complex to replace. As a result, the system will use both SOAP and JSON at same time. The maintain is even more difficult than before. Is it reasonable to introduce new technologies to replace **part** of old ones?


title: Web app design: Local caching vs demanding

text: I'm writing a web application in javascript that will be served to the clients' browser. The intent is for the app to appear to the client as a monolithic application, not a series of interlinked refreshing web pages. My question deals with common architecture. In order to relate the question I'll mention a specific feature of the web app is a "tour"; when the client clicks a button labeled "tour" the web app will load a div with a bit about the app itself, and what it can do for the user. There are two ways this could be handled, the client browser could fetch the tour markup from the server when the user clicks the button, or the server could download it (and all other such features) when the app is initially downloaded. If I fetch the tour on demand, then I possibly save network bandwidth as not everyone will take the tour, the app will be smaller too. But this means that in order for someone to fully use the app there will be more network congestion as there will be another hit on the network for loading the tour. If I just serve all the features initially, the app is larger, but there is less congestion on the network because, once downloaded, there is less need to access the network (unless a fresh copy of the app is required (ie if- modified-since). This 'tour' feature isn't really the issue itself, it's just an example to explain my question. How to balance caching vs demanding in web app design?


title: Should one Consider Periods in "Year of Experience" while actually not Coding on regular basis

text: Sorry if the title sounds a bit clumsy. The scenario I am trying to describe is during my academic years I have mostly coded in C/C++. Few small projects were done but no large scale work was done. From there on, after entering industry, I rarely code in C++ but whenever I do, I use its features as deep as my understanding. Now, should I even consider myself a C++ programmer and count every year since I first started coding as my number of years in C++.


title: Is the following example a strategy pattern?

text: In my problem I had lots of objects with slightly different behaviour, but identical attributes and methodes with identical interfaces. The objects variants were quite big in number, and I didn't want to create a class for each of them, with lots of repeting code. I circumvented creating a lot of derived classed by the following construct (pseudocode for abbrevation)               #aTP = all the parameters     def _function_version_1(aTP):         ...          ...          def _function_version_BIG(aTP):         ...          class BaseClass(object):         _typesOfImplementation = {'ONE' : _function_version_1,                                    ...                                   'BIG' : _function_version_BIG,                                  }              def __init__(self, type, ...)             ...             if type not in _typesOfImplementation:                 raise Exception('Unknown type')             # respective function for this object             self.function = lambda aTP:BaseClass._typesOfImplementation[type](self, aTP)      Is this still an implementation of the strategy pattern, although I didn't use classes for the respective function version (which would have been an awful bunch of classes again)?


title: What is the most effective work rhythm for a programmer?

text: I was wondering what is the best work rhythm for the job a programmer does? I am coding all day long and sometimes I get stuck in a problem and it keeps me occupied a few hours before I realize that maybe I need a break. Some say frequent and short brakes help you but sometimes when I am focused on a problem I feel like a break would not help, but rather loose my focus. So how often should a break be taken, and how long? The more basic question regarding this issue is comes from the fact that, you can get tons of "good ideas" ('promodo' for instance) on the net, that promise you will be more effective in whatever you do. Are these principles good or, this is something everybody should decide for himself? I wonder if any of them can accomplish what it promises! I mean what they promise is that (if the conditions are met) it works for **everybody**. Are there really such principles? And if there are, what are these and how can we find them?


title: Why do most sites require email activation

text: Most popular applications nowadays require account activation by email. I've never done it with apps that I've developed so am I missing some crucial security feature? By email activation I mean when you register to a site they send you an email that contains a link that you have to click before your account gets activated.


title: programming an expert system

text: I need to program an expert system that, according to a series of complex possibilities, returns a well defined result, together with some kind of diagnostic of what that results means. What is the general process to define the behavior of an expert system, from the initial assessment of the conditions to the actual code ?


title: How to POST CSV with XMLHttpRequest

text: I would like to send a CSV file via POST in a XMLHttpRequest, but I am unsure of two things. First is there anything to distinguish a CSV file from a string split up by comma's? And what sort of Content-Type am I supposed to put in to the `setRequestHeader`?


title: Calculating combinations from categories

text: I'm trying to calculate every possible selection from different categories. 1 choice must be made from every category and the categories are always in the same order. I save a string where each character is the number of that choice from that category. I have solved this with recursion and it works well when there are thousands of possibilities but is too slow when there are millions. I'd like to change it to looping to hopefully speed it up. Here is my recursive function (C#):               private void GetPartNumberPermutations(IList<int> choices, string partNumber)     {         for (int i = 0; i < choices[0]; i++)         {             if (choices.Count > 1)                 GetPartNumberPermutations(choices.Skip(1).ToList(), partNumber + i.ToString());             else             {                 //add partNumber to the list             }         }     }      Choices is a list of the number of choices for each category and might look like { 2, 4, 5, 8, 2, 4 }. Let's ignore the problem when one of the entries is > 9. My final list of partNumbers comes out to: 000000   000001   000002   000003   000010   000011   000012   000013   000100   000101   etc


title: How to tackle massive Linux/makefile projects effectively?

text: I have been developing Windows applications in C++ for like 10 years now. And recently I've started digging into some Linux projects, and I can't stand how unproductive I am... I'm a fast learner, and I've been using Linux as a primary platform for some time now. And I do feel very comfortable with shell, OS principles and GUI. But when it comes to development, it feels like I'm back to school. As soon as I open some larger project, I'm stuck. Most of them are makefile based, so basically when I try to navigate them with QT or CodeBlocks, at best, I can use intellisense on a per-file basis. And most of the time variables leak from scope. Then there is a go-to-definition stuff, which seems nonexistent, try to join some larger project from sourceforge, and you're stuck for days, because navigating to definitions is so hard... `grep -r "this_def" . --include "*.cpp" --include "*.h"` seems so slow and clumsy. And then, the debugging, gdb does work, but no matter what I do, it seems like it's light years behind WinDbg or VisualStudio debugger. And these things are making me desperate, I want to write code, but it just goes so slow... I'm starting to think that Linux developers learn function definitions by heart and analyze code by eyes, but I can't believe it's so. Has anyone gone through this? Is there something that I'm missing that could make me more productive?


title: Alias variable vs multiple use of getter

text: Would you rather:               $this->getDoctrine()->getManager()->persist($currency);     $this->getDoctrine()->getManager()->persist($user);     $this->getDoctrine()->getManager()->flush();      or               $em = $this->getDoctrine()->getManager();     $em->persist($currency);     $em->persist($user);     $em->flush();      Is using a aliasing variable for faster coding a smart choice, or should the programmer rather use variables only if they are really variables.


title: What is the reason behind methods with return values and methods with void?

text: I want to uderstand why there is a method in C# that could reurn a value, for example:               public int Accelerate()     {        Speed++;        return Speed;     }      and a method that does not reurn a value (void)? What is the difference in the following example of the above one:               public void Accelerate()     {       Speed++;       Console.WriteLine(Speed);     }      I see that last one will save us a time rather than defining a variable to hold this field in when creating a new object! I'm beginner, so could anyone explain?


title: Reading input all together or in steps?

text: For many programming quizzes we are given a bunch of input lines and we have to process each input , do some computation and output the result. My question is what is the best way to optimize the runtime of the solution ?   1. Read all input, store it (in array or something) ,compute result for all of them, finally output it all together. or 2\. Read one input, compute the result, output the result and so on for each input given. UPDATE Since no answer was specific I would ask which approach is the best for problems like this: > ### Quadrant Queries (30 points) > > There are N points in the plane. The ith point has coordinates (xi, yi). > Perform the following queries: > > 1) Reflect all points between point i and j both including along the X axis. > This query is represented as "X i j"   >  2) Reflect all points between point i and j both including along the Y > axis. This query is represented as "Y i j"   >  3) Count how many points between point i and j both including lie in each > of the 4 quadrants. This query is represented as "C i j" > > ### Input: > > The first line contains N, the number of points. N lines follow.   >  The `i`th line contains xi and yi separated by a space.   >  The next line contains Q the number of queries. The next Q lines contain > one query each, of one of the above forms.   >  All indices are 1 indexed. > > ### Output: > > Output one line for each query of the type "C i j". The corresponding line > contains 4 integers; the number of points having indices in the range [i..j] > in the 1st,2nd,3rd and 4th quadrants respectively. > > ### Constraints: >   >   >     1 <= N <= 100000 >     1 <= Q <= 1000000 >   > > You may assume that no point lies on the X or the Y axis.   >  All (xi,yi) will fit in a 32-bit signed integer   >  ...


title: New senior developer tasks

text: I've got a senior developer with eight years of .NET experience starting tomorrow to work on a 11,000-lines-of-code application. In the team there's myself and another programmer. We've both got about three years experience each. It's my first project as a manager (I'm also a developer on the project) and this is the first time I've ever had to introduce someone to an already established code base. Obviously I'll be going over each module, the deployment process, etc., and handing them the location of the source control repository, documentation (which isn't the best), etc. How long should I give them before they're ready to start writing new features and fixing bugs?


title: Why store a function inside a python dictionary?

text: I'm a python beginner, and I just learned a technique involving dictionaries and functions. The syntax is easy and it seems like a trivial thing, but my python senses are tingling. Something tells me this is a deep and very pythonic concept and I'm not quite grasping its importance. **Can someone put a name to this technique and explain how/why it's useful?** * * * The technique is when you have a python dictionary and a function that you intend to use on it. You insert an extra element into the dict, whose value is the name of the function. When you're ready to call the function you issue the call _indirectly_ by referring to the dict element, not the function by name. The example I'm working from is from Learn Python the Hard Way, 2nd Ed. (This is the version available when you sign up through Udemy.com; sadly the live free HTML version is currently Ed 3, and no longer includes this example). To paraphrase:               # make a dictionary of US states and major cities     cities = {'CA':'San Diego', 'NY':'New York', 'MI':'Detroit'}          # define a function to use on such a dictionary     def find_city (map, city):         # does something, returns some value         if city in map:             return map[city]         else:             return "Not found"          # then add a final dict element that refers to the function     cities['_found'] = find_city      Then the following expressions are equivalent. You can call the function directly, or by referencing the dict element whose value is the function.               >>> find_city (cities, 'New York')     NY          >>> cities['_found'](cities, 'New York')     NY      Can someone explain what language feature this is, and maybe where it comes to play in "real" programming? This toy exercise was enough to teach me the syntax, but didn't take me all the way there.


title: How should I represent an enumerated type in a relational database?

text: I am working on developing a relational database that tracks transactions that occur on a device I'm working on for my company. There are different types of transactions that could occur on the device, so we have a "trans_type" field in one of our main record tables. My group has decided to make the type of this field an integer and treating it as an enumerated type. My intuition tells me that it would be a better idea to make this field a string so that our database data would be more readable and usable. My co-workers seem to be worried that this would cause more trouble than it is worth. That string comparisons are too costly and the possibility of typos is too great of a barrier. So, in your opinion, when dealing with a field in a relational database that is essentially an enumerated value, is it a better design decision to make this field an integer or a string? Or is there some other alternative I've overlooked? Note: explicit enumerated types are not supported by the database we are using. And the software we are developing that will interface with this database is written in C++.


title: When programmers talk about "data structures", what are they referring to?

text: When programmers talk about "data structures", are they only talking about abstract data types like lists, trees, hashes, graphs, etc.? Or does that term include any structure that holds data, such as composite types (class objects, structs, enums, etc.) and primitive types (boolean, int, char, etc.)? I've only ever heard programmers use the term to reference complex data structures or abstract data types, however the Wikipedia article that provides a list of data structures includes both composite types and primitive types in the definition, which is not what I expected (even though it does make sense). When looking around online I see other places that refer to the term "data structure" in the programming sense as only referring to abstract data types, such as this lecture from Stony Brook University's Department of Computer Science which states > A data structure is an actual implementation of a particular abstract data > type. or this wikibook on data structures, which uses the term in sentences like this: > Because data structures are higher-level abstractions, they present to us > operations on groups of data, such as adding an item to a list, or looking > up the highest-priority item in a queue So why do I only ever hear programmers referring to complex data structures or abstract data types when they use the term "data structure"? Do programmers have a different definition for the term than the dictionary definition?


title: How does database connection pooling improve application performance?

text: I can't understand why connection pooling improves application performance. I suppose connection establishment would cause latency. But reusing an established connection requires more complex error handling. Application server need track state of every connection to set connection to initial state before reusing (such as discarding all transactions, switching to the default isolation level), which also costs time.


title: Why doesn't Git daemon start in the background?

text: Just as in the title, why doesn't `git daemon` start the service in the background, since it's a "daemon", being a background process? I know that I can start it in the background using `git daemon &`, but I'm just wondering about the philosophical reason for this decision.


title: Is recursive code slower than non-recursive code?

text: Now I'm only a novice programmer, but what my friends that are studying programming tell me is that recursive code is a good thing, it leads to less code duplication and it looks more elegant. Now it may be so, but everytime I've tried my hand with recursive code I've always found it to be significantly slower than non-recursive code, I'm not sure if it's something about the ways I've used it but I highly doubt it, I've used it for fairly simply thing's like Collatz Conjecture and Fibonacci number generation but whenever I've compared it against normal iterative code the recursive approach will consistently clock at around twice the time of the iterative solutions.