Making a decentralized system utilizing JavaScript/HTML5?

I am interested in decentralized systems, and am currently considering building one myself. I am considering using JavaScript and HTML5, simply because it makes it very easy to use the system (they just have to go to a website). Some thoughts:   * I may or may not use another decentralized network for storage, and even if I do, I probably want to cache stuff on the client. If I do not, I **need** to store stuff on the client, since the information will then be distributed on **my** network. Is any of the HTML5 storage models good for this? I've read somewhere that they have a size limit.   * When using JavaScript in the browser, my understanding is that I have to use WebSockets instead of regular sockets. Doesn't this force me to use WebSocket in my "protocol spec"?


Can a method that must be overridden be considered private?

Suppose I have a class `C` with a method `f()` which is meant to be used only within `C`'s implementation, but which should be overridden by `C`'s subclasses. Is it reasonable, or "pythonic", to consider it private, i.e. to name it `_f()` rather than `f()`? In other words would you distinguish the interface provided to subclasses from the interface provided to code outside the inheritance hierarchy?


Why shouldn't a new software product try to compete on price?

I know about how the economies of scale work, and how a bigger competitor could beat you in price, if they wanted. But there doesn't seem to be anything better to compete at when entering a market in software (without being dishonest); a new product often won't be as good as an established one as far as features go. Plus, older popular products are usually priced higher just "because they can," and it's not likely they'll change just to crush a smaller company, so it seems tempting just to set a low price.


Best practice for handling variable values outside of source code?

I am trying to get my head wrapped around OOP after programming in more procedural languages for a number of years. My question: What is the best practice for handling variable values outside of source code? For example, I have file directory values and regex patterns that may need to be manually changed from time to time. I would like to avoid changing these values directly in the source code. I am thinking of creating a text file that will hold key/value pairs. I would then create an object to set these values so that they can be referenced by any methods in my code. Is this the right approach or am I violating any OOP principles? Thanks


Pre-Interview Screening Questions

I need to hire a senior software developer. I've switched to a new recruiter and he's asked for about 3 questions to ask each candidate on the phone that he'll send the answers to when I see the CV to help me screen out the obvious bad ones. I quite like the idea of not having to phone screen people who just cannot code but I'm struggling to be honest. The notion of quickfire hire/no hire questions intrigues and worries me in equal measure. I reckon it's possible to come up with some useful ones but most of the questions I ask in an interview are open ended, language agnostic and based on cultural fit. Now, the recruiter has told me that the candidate wont be able to google the answers since they'll be asked immediately before he sends the CV but I clearly don't want to ask questions that are 'googleable',..I don't care if they routinely google those sorts of questions. In fact, I'd rather they did! So, if you were in my position what questions would you ask? For what it's worth, the primary platform is .Net, C#, Sql Server et al along with the normal slew of legacy technologies. **Edit** Just to be super clear... knowing whether the candidate knows what the volatile keyword does in C# or how they would create a regex that validates UK postcodes would be pointless information. That's classic google fodder. I want something that demonstrates a deeper understanding than that. I considered simple 'what is polymorhism' type questions or 'explain the difference between an 'HTTP PUT vs POST' but these seem pretty straight forward for a senior. I'm looking for something to help support the decision to interview a senior.


Two factor authentication using time base key generator on smartphones

I recently enabled two factor authentication for my Google account. One of the ways of getting the second factor (the key that I have) is to install an Android app on my phone that displays a key for a short duration of time. What does it take to create a web server solution paired with a smartphone solution? I am using Windows and .NET on the server side and would be interested in both Android and iPhone apps. Are there existing libraries out there or do I need to start from scratch? Where is some starting documentation and explanations of the techniques used?


Do exceptions basically exist to prevent a system from crashing?

Second of all, I was wondering if anyone knew what the difference was between exceptions (in the realm of exception control flow) and Exceptions (such as used in Java). But are they there to basically protect the system from crashing by terminating the user program?


What are the disadvantages of using/writting a .Net Custom Membership Provider?

Recently, I posted the following question on SO: http://stackoverflow.com/questions/7197337/using-asp-net-membership-provider- with-an-existing-user-database As you may notice, I ended up answering my own question stating that it looked like writting/implementing a "Custom Membership Provider" was the way to go. Literally, a few minutes later, I stumble across this question: http://stackoverflow.com/questions/7222306/simple-login-attempt-counter-using- mvc-3-and-ajax/7222407#7222407 I try to answer and get a comment back that .Net Membership provider is "terrible on many levels". I'll admit, this is the first time I'm using Membership provider but it sure looked slick to me. I haven't seen anything that backs up the "terrible" claim so before I implement something "terrible", I was hoping to get some feedback from the community.


practical way to learn C?

I want to dig into C and normally when I want to learn a new language I think of a simple/attainable project goal that has some practical purpose (make use of an api, automate a task, etc...) I'm having a harder time coming up with one for C mainly because everything I read points to the fact that C's primary use currently is in embedded systems and more complex software projects like operating systems. Does this point me to the fact that I don't need to learn it or that I just need to be a bit more convoluted in my learning strategy? References to practical learning resources? (tutorial/how to that produces an end result that has some purpose/benifit)


Best Way to Handle Meta Information in a SQL Database

I've got a database where I want to store `user` information and `user_meta` information. The reason behind setting it up in this way was because the `user_meta` side may change over time and I would like to do this without disrupting the master `user` table. If possible, I would like some advice on how to best set up this meta data table. I can either set it as below:               +----+---------+----------+--------------------+     | id | user_id | key      | value              |     +----+---------+----------+--------------------+     | 1  | 1       | email    | test@testemail.com |     | 2  | 1       | name     | user name          |     | 3  | 1       | address  | test address       |     ...      Or, I can set it as below:               +----+---------+--------------------+--------------------+--------------+     | id | user_id | email              | name               | address      |     +----+---------+--------------------+--------------------+--------------+     | 1  | 1       | test@testemail.com | user name          | test address |      Obviously, the top verison is more flexible, but the bottom version is space saving and perhaps more efficient, returning all the data as a single record. Which is the best way to go about this?   Or, am I going about this completely wrong and there's another way I've not thought of?


How to organize unit/integration test in BDD

So finally after reading a lot, I have understood that the difference between BDD and TDD is between T & B. But coming from basic TDD background, what I used to was,   1. first write unittest for database models   2. write test for views (at this point start with integration test as well, along with unittests)   3. write more integration tests for testing UI stuff.  What would be a correct way to approach BDD. Say I have a simple blog application.               Given : When a user logs in.      He should be shown list of all his posts.       But for this, I need a model with a row user, another row blog posts.   So how do we go about writing tests?   when do we create fixtures? When do we write integration (selenium) tests?


When you create an open source project, how to know who's participating and if his version is good?

my friend has developed a CAD program in C, here it is http://web2coders.jrcw3.com/ i have convinced him to go open source, but we have some concerns:   * if you upload a project to sourceforge or github would you be able to know who's participating and if his version is good?    * if you have many versions being developed by other programmers, how to know which is the best version, which has too many bugs and so on, do you have to read every version or is there a faster way? I really hope that this question will not be closed, because i have asked it in other places and no one answered, so stackoverflow is my last chance to get an answer


Legality/Ethics of crawling a site to basically copy its database?

A potential freelance client wants a copy of all the phone numbers in an entire country of several million people in CSV format for their telemarketing system. They have sent me a link to an online phone number lookup service. There are also ways to list the phone numbers of a given region, 30 numbers at a time, with a next link at the bottom of the page to go to the next 30. I could write a spider to crawl the site and basically copy their database, but is this kosher, legal or ethical? Someone else I asked said it depends on the terms of service, but the site doesn't have a terms of service. What do you guys think?


Basics of ERP for dummies

A situation has arisen where (if I don't scream and run away) I will be involved in an ERP system. This project will be using OpenERP specifically. My background is entirely science/engineering/music/games/art/whatever. I've never set foot in the realm of business systems or anything describable with the word "enterprise". What is a good introduction to the whole ERP concept, OpenERP and business systems in general suitable for those with flat zero experience in that world? The ideal intro would explain, from no assumptions, what the main ideas are, terminology, they style of work and thinking of people in that world, and maybe some concrete suggestions how one can tinker around with a copy of OpenERP to gain basic familiarity.


What can slow a developer down?

What things tend to slow a developer down? Please try to refrain from posting answers that:   * are slow now but useful in the feature. (TDD, Refactoring, ...)   * list a distraction.


Concept of Address Space

I have searched the idea of address space that is `The set of all legal addresses in memory for a given application. The address space represents the amount of memory available to a program.` I am unable to find that how this concept is implemented? And how it works with operating system? Any help would be appreciated.


State machines vs threads

Alan Cox once said "A Computer is a state machine. Threads are for people who can't program state machines".   Since asking Alan directly is not an option for humble me, I'd rather ask here: how does one achieve multi-threading functionality in high-level language, such as Java, using only one thread and state machine? For example, what if there are 2 activities to perform (doing calculations and doing I/O) and one activity can block?   Is using "state-machine only" way viable alternative to multi-threading in high-level languages?


Timeline of a programmer in terms of languages?

> **Alan Perlis once said: "A language that doesn't affect the way you think > about programming, is not worth knowing".** I am not proud of the fact that I started programming with scripting languages first( _php_ ,then _javascript_ and now learning _python_ ). I dont have any experience in _c,c++,java,.net,c#,objective-c_. Programming is such a vast field,it would take an eternity to get down to all aspect of it. I cant go back in time.But there are lot of people who would benefit from this question. **MyQuestion** :-If anybody had the option of going back in time,Which programming languages chronologically should that programmer shoot for? The obvious answers might be opinion and purpose/requirement based,But keeping in mind the limited time we have,which languages we shouldnt miss out for to get thorough understanding of programming. **Difference in opinion is OK,just looking for the approximate chronology.** Hope I am clear and not misunderstood.


What types of specification documents exist in app lifecycle?

Developers in large companies usually have multiple specification documents that they write at each phase of the software in question. I've heard of some of them and would like someone to tell me of all specs documents that exist. For example, I've heard of estimation doc (written before project starts), high-level specs, low-level specs and implementation specs. Are there more of them? Can you sort them as they appear in the lifecycle of some application? Note: the reason for this question is that I have to delegate some project to another person and I would have to write all these specs docs. Somehow, I don't think that writing low-level specs is always the best solution (if I am wrong, let me know) so that is why I asked this question.


Why is float the default in the majority of languages?

In programming languages, for represent numbers you have (mainly) two types: `Int(s)` and `floats`. The us of `Int` is very easy. However floats cause a lot of unexpected surprises: http://anh.cs.luc.edu/python/hands-on/3.1/handsonHtml/float.html I wonder why is not used a decimal-based type make more sense as the default for literals and normal math? Where normal math is more precise?


Is it better to learn html, javascript, php, then mysql if you want to start your own site?

Is it better to learn html, javascript, php, then mysql if you want to start your site? Is it better to learn it in that order or not?


As a young student aspiring to have a career as a programmer, how should I feel about open source software?

Every once in a while on some technology websites a headline like this will pop up: http://www.osor.eu/news/nl-moving-to-open-source-would-save- government-one-to-four-billion My initial thought about government and organizations moving to open source software is that tons of programmers would lose their jobs and the industry would shrink. At the same time the proliferation and use of open source software seems to be greatly encouraged in many programming communities. Is my thinking that the full embrace of open source software everywhere will hurt the software industry a misconception? If it is not, then why do so many programmers love open source software?


What difference with Android when iOS is not open?

My question may seem silly, but, I've read in many Android books that the better part of Android is Android is open, and iOS is closed. But, from a programmer viewpoint, who cares about this point? Programmers just care about the platform: is it easy to program in, easy to have help in the network, etc. They don't care about whether the platform is open or closed. One book had additional information, but I don't understand it much. Since iOS is not open, I’d be able to share my work with others only if Apple allowed it. So, if you write an app, and need to share, you must have Apple's permission, but not Android's? Please help me understand this point. I'm preparing for a presentation on Android. And I don't know if I should put this point into my presentation.


What is classic object oriented programming?

I heard the phrase _classic object oriented programming_. Is it different from present object oriented programming, like classic ASP and ASP.net?


Design patterns - do you use them?

Being an IT student, I was recently given some overview about design patterns by one of our teachers. I understood what they are for, but some aspects still keep bugging me. Are they really used by the majority of programmers? Speaking of experience, I've had some troubles while programming, things I could not solve for a while, but Google and some hours of research solved my problem. If somewhere in the web I find a way to solve my problem, is this a design pattern? Am I using it? And also, do you (programmers) find yourself looking for patterns (where am I supposed to look, by the way?) when you start the development? If so, this is certainly a habit that I must start to embrace. UPDATE: I think when I ask if programmers do use them, I'm asking if when you have a problem to solve you think "Oh, I should use that pattern".


Proper program design for submitting a form

I have been stuck wondering what the best solution to the problem below: I am developing a form like GUI with quite a few places for input. Currently, I am storing each UI element in an ArrayList representing each modular component of the form (Seperate layouts containing UI elements relevant to one another) I then pass these ArrayLists into a new class that will then handle gathering the data entered by the user after a submit button has been clicked. I feel as though this method of passing the UI elements by ArrayList is not very good practice. If anyone has any better suggestions, I would love to hear them, as I feel this method is somewhat unclean.


How do I make up for a lack of feedback as a solo developer?

As a newly self-employed software developer, my concern is that I am not getting the stream of feedback I have received in the past when working in groups. (I do have feedback (mostly positive) from my customers, and I do spend a fair amount of time on self-improvement.) What should I be doing to fill the gaps? Any other one-person software shops out there? How do you stay connected and avoid becoming too enamored of your own work? Am I worrying about this too much? Thanks for your comments.


Formal requirements analysis

I've been doing a Requirements Analysis module in my university. We've covered all kinds of formal requirements stuff, like UML, Use Case Diagrams, Sequence Diagrams and Contracts. I have to ask- are any of these things of any value whatsoever in the real world? The only Use Case Diagrams I've ever seen could be summed up in a vastly more succint and understandable way in plain English- or even code in a reasonable language of your choice- and the same goes for the other things I've mentioned.


Diagramming large and complex application code

I tried creating a flow chart of a function that I use in my program, but there are a lot of conditional statements in between every process and the diagrams are getting more confusing. Is there a another language or markup other than flow charts that can be employed for large codebases with high complexity?


Post-Project Meeting a Waste of Time?

At my place of employment, we've had some serious growing pains. We went from a development team of 3 to 10, and the company itself has grow 30% in the past year. By most measurements, we're doing well. Unfortunately, the quality of our software has suffered. In a meeting today with my division's manager, I proposed a project team meeting a day or two after the product has launched. We could discuss budget concerns, scope, what went wrong, and what went right. Ideally, learning from our mistakes. We build sites/apps for other people, so our time is either billable on non-billable. A meeting like this would fall under the latter. My manager shot it down almost immediately: "That time isn't billable. It'll make us get behind on another project because we waste time at the end of that one talking about it." I was so caught off guard by this logic that I didn't even bother fighting him on it. So my question: I see the value is post-project meetings, but he doesn't. Is there **documented** proof of post-project meetings helping save time and money in the long (or short) run? Intuitively I think it will/would, but he clearly is more worried about a small amount of un-billable time from the 5 people that would need to be there.


Scrum: What if the Product Owner has tasks?

I have just started working with a team that has picked up some aspects of Scrum (two week timeboxing) but not others (the team does not currently agree to all estimates or to the number of points in a sprint, but I'll change this soon.) The product owner is also a technical resource (scientist) with some development background. Is it appropriate to have the product owner's tasks (which mostly involve research) mixed in with the team's tasks (some of which are research and some development).


Data Grid for Web Application

Are there any good Data Grid libraries that allow the user to view and edit data from a database? My boss asked me to research possible Data Grid resources to supplement our web application and I thought I'd ask here. I know we could make one in-house, but we'd like to have a professional looking one without expending too much time and work. We are looking for a web based Data Grid, preferably written in Java that is free or open-source. JDeveloper looks promising, however, it has quite a bit of overhead and quite a steep learning curve. The web application that this would supplement is not large enough to warrant the time it would take to simply learn JDeveloper. The grid viewer should be able to:   * allow users to view tables   * allow users to edit rows inline   * allow sorting by columns   * pages rows   * associate tables If there are any suggestions of possible Data Grids that allow have this criteria, it would be much appreciated.


Are there technical limitations or language features that prevent my Python script from being as fast as an equivalent C++ program?

I'm a long-time Python user. A few years ago, I started learning C++ to see what it could offer in terms of speed. During this time, I would continue to use Python as a tool for prototyping. This, it seemed, was a good system: agile development with Python, fast execution in C++. Recently, I've been using Python more and more again, and learning how to avoid all of the pitfalls and anti-patterns that I was quick to use in my earlier years with the language. It's my understanding that using certain features (list comprehensions, enumerations, etc.) can increase performance. But are there technical limitations or language features that prevent my Python script from being as fast as an equivalent C++ program?


Books having graded collection of programming problems

I am looking for a book with **graded** (i.e from low to high level of difficulty) collection of programming problems. The problems I am interested in are Algorithm/Data Structure problems, since this is the genre of problems asked in ACM ICPC, Topcoder, CodeJam, Facebook puzzles, and majority of interviews, I suppose. I do know of various collections on web but none of them are graded so it is daunting for a beginner to get started. I am looking for something that starts from the very beginning and goes up to Topcoder level, for instance.


Checking for cross-site scripting vulnerabilities in Perl web applications

I'm putting together some notes for a dev team on how to write secure Perl code - especially taking into account the current OWASP top 10 web application vulnerabilities. For cross-site scripting I've included information on ensuring that all output to the browser is checked and escaped where necessary, but I'm looking for more automated mechanisms that would mean a developer doesn't have to think about every output statement and, potentially, miss one. Perl's 'taint' function sounds like it should be a help because it distrusts all user input, but it doesn't complain on tainted data being output to the browser. Apart from checking all output statements individually (probably by calling a generic sanitizing function) does anyone have any ideas on how Perl can help with this with existing libraries or techniques?


Built-in Context-and-Input-to-Output-Hashing in Compilers

Why doesn't (open source) compilers contain builtin funtionality for (shared) caching and reuse-fetching (using SHA1-hash of compiler-version, build-flags, target-platform and inputs) of executable output objects (ELF or COFF) similar to what `ccache` does and `scons`? Many large software projects would benefit enormously in required build-disk- space and -time if this was present in, say GCC.


Is it okay for programmers to be given the task of outlining database requirements?

In my current job, dba's and programmers are divided in tasks. Any code that needs to be written in procedures dba's write, and programmers do only application code. The strange thing is that whenever a task needs to be defined/specced, programmers get the task, and we have to define all the procedures needed and what they should return. Is this a common practice in software development? Are programmers generally the ones tasked with building requirements for the database side?


Task-based authorization for user stories

My understanding is that the first step of defining user stories is to define roles. The problem with role-based systems is that this form of authorization is often too coarse-grained. Hence, people created task-based authorization where roles are still used to lump tasks into groups (see for example rhino security . At least that's my understanding. How do I write user stories for task based authorization? Any feedback would be very much appreciated. Many thanks!


Is it possible to offer an affiliate program for your iOS or Android app?

Independent of the App Store or Google Play, is there a way to track where new downloads or paying customers came from? For example, if an app advertises my app in theirs - is there a way for me to find out which users actually downloaded it? And then pay that app owner a commission? On the web this is done via a tracking URL which places a cookie on a users machine. If they signup within a designated timeframe, they are 'tracked to' whomever had their affiliate code in the URL they clicked and that person would receive commissions. How could this be done with native mobile apps, while not violating Apple/Google rules?


What do you call one element in an enumeration?

The following C# code defines an enumeration.               enum MyEnum             {                 alpha,                 beta,                 gamma,                 delta             }      As a whole it is called an enumeration. What do you call each item? For example, what do you call the object that is beta?


Integration testing in en example - confused

I know that integration testing means integrating unit tested moduls and testing for interface errors etc. But in real world examples, I am kinda lost. Here is an example of our system: Back end (Java).   Front end (Flex). Back end is processind data heavily and we have a lot of tests for weekly automated regression. But is it a system test? I think so, but on the other hand, it is just back end part testing. Or should I say it is system testing only when UI part is involved as well? But again, with testing UI we cannot test the logic in data processing.


Node.JS or Scala for mobile and web apps

I am coming from a php background with some python as well. I want to start working on a different language for both web and mobile development. I am also interested in real time apps dealing with games. I am looking at node.js because I can use tools like titanium and/or phone gap to have my apps ported and compiled to native java code, or in a way that makes it runnable on mobile (web views). I like this path because I can use existing JS knowledge to build apps. I am also looking at scala. I have done some C# as well as tinkered with Java about 5 years ago. And I do like that I can use scala to make native android apps. But unlike node/js which can be made to also work on other mobile os's, this only works on android. In a way, that doesn't really bother me. But scala seems like it would have much better performance for gaming that JS compiled to android. But I do not know how well. Ine the end I want to focus on socket and REST based web apps for API's that users can have access to, as well as some mobile development. I want to get towards games and interactive apps. The question is, what features of Scala would benefit me over the node/js side of things for making real time applications on web or mobile? I was looking at using frameworks like lift or play for web. Node also makes real time easy with socket.io and node handles much of that in the background. This is why I think node could be a great choice. So I was hoping someone could give some insight on features in Node, that would have some benefit over scala. I don't really want to hear 'this is better cause its webscale or related things. I was hoping for more facts about features that would benefit what I want to do. I already understand why node is good. I just dont know much of anything about scala. Or how they may compare for what I want to accomplish.


Database Facade to wrap our existing queries?

We have a very big application written in C++ using the MFC framework (millions of code lines). No need to say that it's a legacy system, but it's also heavily maintained and updated. This application lacks a lot of architecture. For example, we have a lot of classes that do queries directly to the database, which creates a lot of difficulty for unit testing. I have read the book Working Effectively With Legacy Code, and one of the most important things to do first is to create some kind of architecture so we can separate the GUI from the logic and from the database. My idea to go towards this is to create something like a database facade. There will be 2 goals for this:   1. Encapsulate all the calls to the database behind this facade.   2. Be able to test the facade in batch to detect errors in the SQL very fast. The database facade itself will be implementing an IDatabaseXXXX interface so it could be easily mocked in the unit tests. The second goal will be to be able to run all the functions in the facade in batch to test if there are errors in the SQL queries. I don't count them as unit tests and would be running them only once per day. My main concern about doing this is that I don't know if there is an existing framework or library to take care of this abstraction. As far as I know, there are some on other platforms like .NET, but it seems that for C++ or MFC, there are not a lot of options. Like I said, the application is very big and the change will be done slowly, mostly when new queries are added to the software. I think it is a good thing to add that we also have a LOT of recordsets (one for almost each object). For the moment, I don't know how to deal with them, so I kept them on the side and decided to deal with the regular SQL queries. But if you have suggestions to deal with recordsets, I will be glad to hear them. So my main question is: Is this whole idea of database facade worth trying? Is there any library of framework to help me in this adventure? If there are C++/MFC programmers out there, how do you deal with the abstraction of the query to the database? Thanks! _**EDIT_** Some people on the chat suggest looking up at repository pattern which I knew from the world of MVC 3. Any suggestion or tutorial about the repository pattern in C++? Most of what I found is in the .NET world.


How to insert a database layer in PHP

I maintain and add features on a freelance basis to a website written in PHP. The application was started in PHP4 by a junior programmer back in 2006, and features some very insecure and unmaintainable ways of doing things, which I am trying to correct as time goes on. If the client agrees, one of the first things I would like to do is add in a proper database layer of some sort. The current database access looks like this:               if (!function_exists('my_query')) {     function my_query($query) {              if ($query=='disabled') return false;              global $last_insert_id,$dbconn,$dbase;                   $result=mysql_query($query,$dbconn) or die('ERROR: '.mysql_error($dbconn).'<br />'.$query);         $last_insert_id=mysql_insert_id($dbconn);         return $result;     }     }      There is also a function to make arrays from the data returned.               if (!function_exists('spawnarray')) {     function spawnarray($result)     {         $i = 0;         if ($result != "") {             if (mysql_num_rows($result) > 0) {                 while($result_obj[$i] = mysql_fetch_object($result)) {                     $sp_result[$i]=$result_obj[$i];                     $i++;                 }                 return $sp_result;             }         }     }     }      These two functions are basically the database layer, and SQL queries are constructed on the fly for them all over the place. So my question is, how can I start to introduce database abstraction in to the mix? I would like to move to PDO for security and ease of use reasons, but maybe there is a better way to go? I have already moved the project to Composer for some of its dependencies (Some are dead projects, which is a different issue) so maybe an ORM like Doctrine would be the way to go? That might mean moving the website to OOP in one go though: a daunting prospect, and a sure no-go from the client.


Optimize database interaction through VPN

I have to develop a batch procedure with VB.NET. This simple procedure is going to read some data from a MS SQL database, execute some elaborations and the write the results on another Oracle SQL database located to a remote network reached via VPN. The VPN is "always on", we do not need a client to manage the connection because it is created firewall-by-firewall. The data that I have to write are atomic, so I have to use a transaction. Can you tell me what happen if the VPN connection fall down when a transaction is open and the COMMIT was not executed? Do you have some suggestion/best practice to follow to avoid this scenario?


Should I use a list or an array?

I'm working on a windows form to calculate UPC for item numbers. I successfully create one that will handle one item number/UPC at a time, now I want to expand and do it for multiple item numbers/UPCs. I have started and tried using a list, but I keep getting stuck. I created a helper class:               public class Codes     {         private string incrementedNumber;         private string checkDigit;         private string wholeNumber;         private string wholeCodeNumber;         private string itemNumber;              public Codes(string itemNumber, string incrementedNumber, string checkDigit, string wholeNumber, string wholeCodeNumber)         {             this.incrementedNumber = incrementedNumber;             this.checkDigit = checkDigit;             this.wholeNumber = wholeNumber;             this.wholeCodeNumber = wholeCodeNumber;             this.itemNumber = itemNumber;         }              public string ItemNumber         {             get { return itemNumber; }             set { itemNumber = value; }         }              public string IncrementedNumber         {              get { return incrementedNumber; }             set { incrementedNumber = value; }          }              public string CheckDigit         {             get { return checkDigit; }             set { checkDigit = value; }         }              public string WholeNumber         {             get { return wholeNumber; }             set { wholeNumber = value; }         }              public string WholeCodeNumber         {             get { return wholeCodeNumber; }             set { wholeCodeNumber = value; }         }          }      Then I got started on my code, but the issue is that the process is incremental, meaning I get the item number from a gridview via checkboxes and put them in the list. Then I get the last UPC from the database, strip the checkdigit, then increment the number by one and put it in the list. Then I calculate the checkdigit for the new number and put that in the list. And here I already get an Out of Memory Exception. Here is the code I have so far:               List<Codes> ItemNumberList = new List<Codes>();                   private void buttonSearch2_Click(object sender, EventArgs e)         {             //Fill the datasets             this.immasterTableAdapter.FillByWildcard(this.alereDataSet.immaster, (textBox5.Text));             this.upccodeTableAdapter.FillByWildcard(this.hangtagDataSet.upccode, (textBox5.Text));             this.uPCTableAdapter.Fill(this.uPCDataSet.UPC);             string searchFor = textBox5.Text;             int results = 0;             DataRow[] returnedRows;             returnedRows = uPCDataSet.Tables["UPC"].Select("ItemNumber = '" + searchFor + "2'");             results = returnedRows.Length;             if (results > 0)             {                 MessageBox.Show("This item number already exists!");                 textBox5.Clear();                 //clearGrids();             }             else             {                 //textBox4.Text = dataGridView1.Rows[0].Cells[1].Value.ToString();                 MessageBox.Show("Item number is unique.");             }         }              public void checkMarks()         {                  for (int i = 0; i < dataGridView7.Rows.Count; i++)             {                 if ((bool)dataGridView7.Rows[i].Cells[3].FormattedValue)                 {                     {                         ItemNumberList.Add(new Codes(dataGridView7.Rows[i].Cells[0].Value.ToString(), "", "", "", ""));                     }                 }             }         }              public void multiValue1()         {             _value = uPCDataSet.UPC.Rows[uPCDataSet.UPC.Rows.Count - 1]["UPCNumber"].ToString();//get last UPC from database             _UPCNumber = _value.Substring(0, 11);//strip out the check-digit             _UPCNumberInc = Convert.ToInt64(_UPCNumber);//convert the value to a number                  for (int i = 0; i < ItemNumberList.Count; i++)             {                 _UPCNumberInc = _UPCNumberInc + 1;                 _UPCNumberIncrement = Convert.ToString(_UPCNumberInc);//assign the incremented value to a new variable                 ItemNumberList.Add(new Codes("", _UPCNumberIncrement, "", "", ""));//**here I get the OutOfMemoreyException**             }                  for (int i = 0; i < ItemNumberList.Count; i++)             {                 long chkDigitOdd;                 long chkDigitEven;                 long chkDigitSubtotal;                 chkDigitOdd = Convert.ToInt64(_UPCNumberIncrement.Substring(0, 1)) + Convert.ToInt64(_UPCNumberIncrement.Substring(2, 1)) + Convert.ToInt64(_UPCNumberIncrement.Substring(4, 1)) + Convert.ToInt64(_UPCNumberIncrement.Substring(6, 1)) + Convert.ToInt64(_UPCNumberIncrement.Substring(8, 1)) + Convert.ToInt64(_UPCNumberIncrement.Substring(10, 1));                 chkDigitOdd = (3 * chkDigitOdd);                 chkDigitEven = Convert.ToInt64(_UPCNumberIncrement.Substring(1, 1)) + Convert.ToInt64(_UPCNumberIncrement.Substring(3, 1)) + Convert.ToInt64(_UPCNumberIncrement.Substring(5, 1)) + Convert.ToInt64(_UPCNumberIncrement.Substring(7, 1)) + Convert.ToInt64(_UPCNumberIncrement.Substring(9, 1));                 chkDigitSubtotal = (300 - (chkDigitEven + chkDigitOdd));                 _chkDigit = chkDigitSubtotal.ToString();                 _chkDigit = _chkDigit.Substring(_chkDigit.Length - 1, 1);                 ItemNumberList.Add(new Codes("", "",_chkDigit, "", ""));             }      Is this the right way to go about it, using a list, or should I be looking at a different way?


Geographically Distributed (Data & App) Architecture

Is there any design patterns (or best practices) for implementing a geographically distributed system (mostly a database)? Description: There is a network of warehouses and a central office. Now I want every warehouse replicates it's data to the central office and the central office replicates just that portion of data related to that warehouse (when it's modified). This I can call a "filtered replication". Our database here is SQL Server 2008 R2. Should I go with another database? How about NoSQL databases? This is a .NET based solution. So far I have learnt about Web Synchronization for Merge Replication and I am investigating it; but I did not learnt how to implement filtered replication yet. I am not sure how NoSQL fits for an e-commerce problem (I think I need to use a combination of NoSQL+RDBMS if I should go that way) but I am investigating RavenDB and MongoDB. Any insight would help a lot; Thanks;


"Anything can go wrong will go wrong" - Murphy's Law. so is it necessary to test all the conditional, exception cases?

If "Anything can go wrong will go wrong" is true, we need to test all the conditionals and exceptional cases in my code. But sometimes it's hard to find all of them since many of them are corner cases, which are hard to test. How can I go about finding corner cases better or avoiding the issue?


Are there minimum quality standards for .NET applications?

Does Microsoft require third party .NET applications to meet any minimum standards for things like application security or code quality?


How to visualize code?

I've mostly only had to read my own code. As such, I've had no need to visualize the code as I already know how each and every class and module communicate with one another. But the few times I've had to read someone else's code - let us now assume we are talking about at least one larger module which contains several internal classes - I've almost always found myself wishing _"This would have been so much easier to understand if I could just visualize it!"_ **So what are the common methods or tools for enabling this? Which do you use, and why do you prefer them over the others?** I've heard stuff like UML, module and class diagrams, but I imagine there are more. Furthermore, any of these is most likely better than anything I can devise on my own. **EDIT:** For those who answer with "Use pen and paper and just draw it": This isn't very helpful unless you explain this further. What _exactly_ am I supposed to draw? A box for each class? Should I include the public methods? What about its fields? How should I draw connections that explain how one class uses another? What about modules? What if the language isn't object- oriented but functional or logical, or even just imperative (C, for instance)? What about global variables and functions? Is there an already-standardized way of drawing this, or do I need to think up of a method of my own? You get the drift.


Why separate class CommandHandler with Handle() instead of handling method in Command itself

I have a part of CQRS pattern implemented using S#arp Architecture like this:               public class MyCommand     {         public CustomerId { get; set; }              // some other fields     }          public class MyCommandHandler<MyCommand> : ICommandHandler<MyCommand, CommandResult>     {         Handle(MyCommand command)         {             // some code for saving Customer entity                  return CommandResult.Success;         }     }      I wonder why not just have class `Command` containing both data **and** handling method? Is it a kind of testability benefit, where you need to test command handling logic separately from command properties? Or is it some frequent business requirement, where you need to have one command handled by different implementations of `ICommandHandler<MyCommand, CommandResult>`?


When should I start using frameworks?

I'm little confused with the motive and need for frameworks. At what stage should I use frameworks? For example, if I want to use some CSS framework, should I learn CSS at pro or advanced level to use it?


Solutions for giving feedback to students on their code?

I will be a TA for a course that teaches Haskell this semester and the professor and I are trying to come up with a solution that lets us do entirely electronic submissions. We would like students to be able to upload files (we have a system we could use that puts uploaded files into an FTP server) and then receive grading/feedback on those files. Is anybody aware of good solutions for code review that keep the submissions and feedback confidential?


When to apply corrections on data gathered from a server

I have an program that collects data from other servers. I don’t have access to these servers so I can’t change anything. The servers can give incorrect data, I can solve the problem but I’m a little bit stuck on “when to do the correction”. I download the data from the server, the data gets processed and stored on the hard-drive. When the same data is needed an there is no change, then I use the old data. So this is basically caching. There are 2 places where I could apply the correction.   * When I receive the data from the other servers;   * After I cache the data. So right before I use it. When I apply the correction on the downloaded data directly, then the server doesn’t need to do much calculations. It’s only corrected once. When I apply the correction after I took it from the cache or when isn’t cached after I cache the data. Then I need more CPU power. But this gives me the advantage to access the original data at all time. I could fall back when I made a mistake and apply a correct correction. So the question is, when should I apply the correction? And why should I do it that way.


Generic file parser design in Java using the Strategy pattern

I am working on a product in which the responsibility of one of the modules is to parse XML files and dump the required content in a database. Even though the present requirement is only to parse XML files, I want to design my parsing module in a fashion that I can support any kind of files in the future. The reason for this approach is that we are building this product for a specific client but plan to sell it to other clients in the near future. All the systems in the ecosystem for the current client produce and consume XML files but this may not be the case for other clients. **What have I tried so far? (The Present)** I have the following design in mind which is based on the Strategy pattern. I have quickly written down the code in eclipse to convey my design so it would be great if other aspects such as proper way of handling exceptions are ignored for now. **Parser :** The strategy interface that exposes a parse method.                public interface Parser<T> {             public T parse(String inputFile);         }      *The reason for using a generic parameter is to allow any return type as well as ensure type safety at compile time. **ProductDataXmlParser** A concrete class for parsing a product.xml file that contains product related information. (using XMLBeans)               public class ProductDataXmlParser implements Parser<ProductDataTYPE> {              public ProductDataTYPE parse(String inputFile) {             ProductDataTYPE productDataDoc = null;                 File inputXMLFile = new File(inputFile);                  try {                 productDataDoc = ProductDataDocument.Factory.parse(inputXMLFile);             } catch(XmlException e) {                 System.out.println("XmlException while parsing file : "+inputXMLFile);             } catch(IOException e) {                       System.out.println("IOException while parsing file : "+inputXMLFile);             }             return productDataDoc.getProductData();         }     }       **where** : ProductDataTYPE and ProductDataDocument are XMlBean POJO classes generated using an xsd and the scomp command. **The future** If I have a product.txt file to be parsed in the future, I can define my own POJO called ProductData that will hold the required contents of the file. I can then create a concrete class called ProductDataFlatFileParser that implements the Parser interface and have the parse method populate the ProductData POJO for me after parsing the file. Does this design make sense? Are there any obvious flaws in this design? As the design stands, I am allowing the concrete classes to define the algorithm to parse a file and letting the concrete class decide where to populate the data. The design seems to be more dependent on the domain objects rather than the file formats. Is this a bad thing? Any inputs on how I can improve my design will be highly appreciated.


Domain Driven Design with an EAV database model

How can one apply DDD to a EAV database model? Consider this EAV database model: ![enter image description here](http://i.stack.imgur.com/yVT7q.png) How am I supposed to build a domain model if all my entities and their attributes will be stored in the database? **UPDATE** To help clarify the question I'll give an example. If I'm building a **Store** that is going to sell some **Products** then I'll have 2 entities in my domain model corresponding to them. Now my `Product` entity will normally have a fixed number of attributes (ex: `Product_name`, `sku`, `weight`, etc...). However, in a EAV model entities have a variable number of attributes. How should I write a model for `Product` if each concrete instance of it will have a different number of attributes?


Does C# experience translate well to C++?

My programming classes in school were C++, but I ended up working a job doing C# for the last few years. If there was a position that required say 1 or 2 years experience in C++, would my experience in C# be worthy of consideration? How effective could I be in such a position? So do I need to start out as an entry-level C++ programmer to gain the necessary experience?


Which style is better to check and log the error?

I have read some code and here are two ways to check and log the error in cpp code that repeats in my project many times. Which way is better? 1.               bool AClass::myMethod()     {          if (!SomeCondition())          {              Warning("AClass::myMethod: your description");              return false;          }         doSomthing();         return true;     }      2.               bool AClass::myMethod()     {         if (SomeCondition())         {             doSomething();         }         else         {             Warning("AClass::myMethod： your description");             return false;         }         return true;     }


Real world usage of DelayQueue

What would be a real world usage of DelayQueue, what common problem it was designed to solve?


Antonym to "cross-functional team"

What is a widespread antonym to "cross-functional team"?


Why would I need a Git Repository?

I'm a beginning developer setting up a project in Xcode 4.3 and I'm wondering under what circumstances I would need to check the "Create local git repository for this project" box. Thank you!


What Use Cases are Appropriate for JScript.NET?

In this Stack Overflow question: http://stackoverflow.com/questions/9471332 I learned that Jscript is not dead after all. Yay! But what is JScript.NET good for? According to this article, you can use it to provide C# with an Eval function. That's neat, but it seems like kind of an edge case. If you were after first-class scripting capability, doesn't PowerShell fit the bill?


Scrum: Handling lack of motivation

According to this, "Scrum highly relies on a highly motivated, closely collaborating, cross-functional and self-organized teams." So how do you handle co-workers who may not be as motivated to take ownership of the code? How do you get someone interested in taking ownership?


Are there any practical uses of allowing recursive inclusion of a file?

I am currently implementing NASM-like preprocessor for my assembler, and I am wondering what is the correct way of handling recursively included files. From what I see, there are two ways to deal with it without hanging the preprocessor or even the OS:   1. Set maximum include depth.   2. Disallow including a file recursively (not to be confused with disallowing including a file _twice_ ). Also, as far as I can see, the second approach does essentially the same job, but produces nicer error messages. Compare output of Clang, when compiling file containing `#include "main.cpp"` only:               In file included from main.cpp:1:     [ repeated many times ]     In file included from main.cpp:1:     main.cpp:1:10: error: #include nested too deeply     #include "main.cpp"      with this (current way of handling this in my preprocessor; input is similar to above, does `%include "1.mov.asm"` at line 6):               In file /home/griwes/projects/reaverasm/tests/1.mov.asm in line 6:     Error: file `/home/griwes/projects/reaverasm/tests/1.mov.asm` included recursively.      The approach disallowing recursive inclusion produces - IMHO - more readable output. The question is: **is there any preprocessor technique that would be killed by disallowing recursive inclusion?** This question is language-agnostic, so feel free to give examples from any languages.


Exclude the zero in the given data in Haskell

I have a list of integers. Also, I have a function which returns True when the element is non-zero, and returns False when the element is zero (let's call it FUNCTION1). So, how to define another function (using FUNCTION1), which will give us a new list and only include the non-empty elements? For example, we have [1,2,3,0,6,0], and we want [1,2,3,6]


Good ways to jump to a particular state in a yielding stateful function?

I'm working on some embedded code using C. Various pieces of functionality need non-blocking stateful functions, which are mostly implemented using a switch on various states. For example, a modem connection manager (pseudo- code):               void manage_connection(void) {         static states state = IDLE;         switch (state) {             case IDLE:                 if (connection_requested()) state = BACKOFF;                 break;             case BACKOFF:                 if (random_delay_timeout()) {                     do_connect();                     state = CONNECTED;                 }                 break;             case CONNECTED:                 result = send_data();                 if (result == DATA_SENT) {                     state = IDLE;                 } else if (result == ERROR) {                     // Go straight to backoff state and connect ASAP                     state = BACKOFF;                 }                 break;         }     }      State machines are nasty at the best of times, so I've started to move to a different paradigm using coroutine-style functions, using a "yield" statement. Of course, C doesn't provide a "yield" statement, but I'm using protothreads to achieve this. Protothreads is great, and gives me exactly what I want to implement the above non-blocking state machine in a structured-programming style. The above function roughly translates to (pseudo-code):               void manage_connection(void) {         WAIT_UNTIL(connection_requested()); // or, while(!condition) yield;         WAIT_UNTIL(random_delay_timeout());         do_connect();         WAIT_UNTIL((result = send_data()));              if (result == DATA_SENT) {             // RESTART starts from top. It is part of the protothreads API.             RESTART();         } else if (result == ERROR) {             // This is the part which doesn't translate so well.             // Could use an ugly goto:             goto backoff;             // Or similar alternatives, none of which scale well:             // - Set a flag to skip the states I don't want, and RESTART();             // - Use while loops or other control logic to branch appropriately.         }     }      As you can see, the protothreads version is, on the whole, much clearer & simpler in terms of the flow of logic (once you learn how protothreads work, and look past some very minor boilerplate which I haven't included in the example). But jumping to a particular state in a state machine is a common pattern that I'm come across, which the state machine version handles elegantly, but the procedural version does not. Of course, that's why the procedural version is less bug-prone and clearer -- because you _can't_ jump all over the place on a whim (except for goto, which I'd like to avoid for the usual reasons). However, when you have a good reason to want to jump, it adds significant bug- prone lack of clarity to what is otherwise a very straightforward function. Obviously there are plenty ways to achieve the necessary functionality, but none of them scale well to more than a few states. Bear in mind this is the simplest possible example -- my real-world functions fill half a screen. What are some ways to solve this problem in a way that doesn't muddy the otherwise-lucid flow of logic?


Is there any scenario where it's useful to keep mutable properties cached in domain objects for anything else than informational purposes?

Usually in a domain model, you'll have objects, and those objects will have properties that are mutable and properties that are immutable - for instance, a instance id/name will be immutable, while some other properties (specially properties that depend on relationships with other objects) can vary in the lifetime of an object So, in the usual scenario where multiple clients are accessing the same data store, your ORM tool will usually model columns as properties and relationships as lists, in the mutual understanding that any mutable property might be outdated in the client - that is, they only represent caches of the values of the properties. However, in many circumstances, one wants to do an operation that might require the actual state of the mutable properties, otherwise the operation might fail or produce data corruption, so in those cases you'll attempt a lock in the row in question, and if the row has already changed then you cancel or abort. In any case, the operation is done off the client application. At some point I have to ask a question (oddly enough, its turning out to be surprising hard!), so I guess the question would be: **is there any scenario where it's useful to keep mutable properties cached in domain objects for anything else than informational purposes?** After all, if there are relationships that we care for, say we want to traverse the neighbours of some object, we'll want to do that with their real (not cached) states, which would involve a database transaction, or some other means to do the process atomically (maybe map reduce?).


To reorganize code, what to choose between library and service?

I want to reorganize a large application with lot of code duplication into multiple components. Plus, some code is also duplicated over other applications. The common set of functionality that can be taken out of main application is clearly defined. Now, do I write a library or do I write a service for this functionality; so that all such applications continue to work and there is only one code-base (of common functionality) to maintain ?


Looking for good testing in multithreaded C or C++ open source projects

I have read a lot about the importance of unit testing, and testing in general. In particular I have read about TDD which, in theory, seems like a good way to ensure effective test coverage for a project. However, when I look at open source projects, or code that is available as open source, I am having difficulty finding good examples of testing in real projects that I can learn from. In particular I haven't seen much in the way of unit testing (at least not that I can understand). For example I just downloaded the source code for the Java HotSpot JVM. I thought it would be very useful for me to look at and learn from because a JVM (written in C or C++) will have to deal with many complex issues associated with multithreading and low-level system interaction. Which are the very same things that I'm having difficulty in figuring out how to develop unit tests for. But unfortunately it seems like the amount of code written specifically for testing is quite limited. There is a `test` directory but it looks like it contains examples of code that can be used to test various different bugs, rather than any formal regression tests or unit tests. So my question is are there examples of open source projects that use unit testing that I could look at to learn from? Something like a JVM is perfect for me because it is more complex than the project that I am working on, but would face many of the same issues associated with thread interaction and memory management.


Apple's new compiler

I heard that Apple is going to replace the GNU compiler built into Xcode with a new compiler. What is the new compiler and what type of changes can we expect to see?


Is there a way to use gcc as a library?

Anyone knows a solution that works something like this:               #include <stdio.h>     #include <gcc.h> /* This .h is what I'm looking for. */          int main (void) {         /* variables declaration (...) */              /* The following line is supposed to be equivalent to:          *     $ gcc main.c -o main */         results = gcc_compile_and_link("main.c", "main");              /* Now I want to use the warnings and errors to do something.          * For instance, I'll print them to the console: */         printf("warnings:\n");         for (i=0; i<results.warns_len; i++)             printf("%s\n", results.warings[i].msg);         printf("errors\n");         for (i=0; i<results.errs_len; i++)             printf("%s\n", results.errors[i].msg);              /* free memory and finalize (...) */         return 0;     }      I know I can run the command "gcc main.c -o main" in a fork and parse the output... but I was looking for something more ' _reliable_ ' like the example above.


Update strategy for a software framework once it has been deployed

I need to update a software framework once it has been deployed. The framework we are creating is made up of .NET 4.0 libraries (in Visual Studio). This common set of code libraries will be available for 2 .NET Windows services, a standalone .NET application, and a .NET MVC 4 website. (The services will run on a single server, and the standalone application will be used by a select few individuals.) We are in the early stages of the project, and the big questions that have come up are:   * What happens when we have to make a change to 1 or more of the framework files?    * How do we deploy patches and/or updates to each part that relies on the framework?   * What considerations can we make early on to make the update/patching process easier later on? This is the first time our small team has tackled a problem like this and we're not sure what the best practices are. **edit** We have 4 software pieces that rely on the framework: 2 services, 1 app, 1 website. Once this all hits production, there are already upgrades and updates planned. The updates will require changes to the framework files and the programs. My question was intended to refer to that later process of redeploying the upgrades. Once we're in production, and we've coded the updates/upgrades to the framework files, the applications, and the website, deploying those updates will need to happen as quickly as possible. What do we need to do to streamline that process?


How secure is this way of authenticating an ASP .NET Web API - creating your own tokens?

http://www.codeproject.com/Articles/630986/Cross-Platform-Authentication-With- ASP-NET-Web-API#_rating The above link shows exactly how I want to go about authenticating against an ASP .NET Web API. It looks very easy but how safe is it in practice? It involves creating your own encrypted token by stringing together the user's user ID and the IP address of the client being authenticated. Then authenticating that string variable using some kind of encrypting technology. Then upon each subsequent request that is sent to the API by the same user, the API will check if the token is valid (it comes from the same client that authenticated, it has not timed out, etc.). The token will be checked by decrypting the token and checking that the client ID that comes out of the decryption is the same as that of the requester's IP.


How do you follow the single responsibility principle in classes responsible for behaviour?

I have many classes in my application responsible for behaviour- views, controllers, models, network- often the state of one class or system depends on another and I'm finding that classes that are primarily responsible for the behaviour for one system inevitably become dependees or dependers of other systems or classes. I've tried passing in interfaces of dependencies from the constructor of the system all the way to the class the depends on it and registering for events on it but this gets extremely complex and crazy and definitely violates OCP and SRP at least. I'm considering making an event system that all event dispatching and listening classes would be coupled to, providing a layer of indirection for classes that require interaction with classes from other systems however in the worst case behavioural classes could be responsible for the behaviour of a class, handling events, and dispatching events- so that definitely also violates the SRP even though I'm pretty sure it would follow the OCP. Is there a better solution out there? Am I applying these principles correctly? I'm very hesitant to use an event system as it will require most classes to be extremely tightly coupled with it.


Does an in-code enumeration provide a stronger domain model than a static table?

Does an in-code enumeration provide a stronger domain model than a static database table? As an example, say I have an `Marble` entity, with a `Color` attribute. The color attribute has a finite set of possible values--say red, green, blue. Say the database team recommends having a static `S_ValidColors` table, to the effect of:               -----------------------     | ColorId | ColorName |     -----------------------     |    0    |    Red    |     -----------------------     |    1    |   Green   |     -----------------------     |    2    |    Blue   |     -----------------------      Whereas I'm thinking more along the lines of (this is just a sketch for the general concept):               public class Color {         public static const Color Red = Color(0);         public static const Color Green = Color(1);         public static const Color Blue = Color(2);              private Color(uint typeCode) {             ...         }         ...     }      Aside from the question of which is better (which probably depends on any number of other factors not represented here), is this a question that touches how strong the domain model is? Is one way more anemic than the other?


Interacting with clients using project management systems

I work in web development, that involves a lot of smaller custom projects rather than one large product. Requirements and specifications are always coming from outside the company. We've setup a ticket tracking system (Active Collab, which is rubbish compared to redmine btw) and given access to clients so they can submit issues. The idea being that less time is taken up with long phone conversations and emails. I think it can work really well if done right. However I'm not so sure it's always a good thing. Feature requests have gone up a lot on some projects. The system also needs to be friendly to non- developers while having the many features that developers use. Developers' tickets do not always map 1-to-1 with the tickets clients will create. So the requirements and broader tickets need to be separated from the more specific developer (specification) related tickets. Perhaps we could use two systems, one for clients to submit their requirements or describe a bug, and one for developers to create tickets like `implement method x in class y`. Maybe this can be achieved by structuring tickets into more appropriate categories or creating sub-tickets under a feature request ticket. I've briefly looked into Pivotal Tracker and it has a fundamentally different workflow. **tl;dr** How do you keep technical tickets (developer jargon) separate from client tickets (layperson language).


PHP to SharePoint roadmap

I'm a PHP developer with familiarity with Rails and a focus on MVC development. My company is moving more and more to SharePoint and I feel I need to learn to build application within the SharePoint system. I have some brief introduction to C# but that's about it. I've used some SharePoint Designer and the web interface but not that heavily (most of my "development" so far for SharePoint has been html/css/javascript page manipulation in SPDesigner). What, and in what order should I be learning to eventually develop applications for SharePoint? Also, any good resources for each step?


Scaling up Git to Team Usage

For the last 3 years I have used git on an almost daily basis for all my pet projects and at work for small projects that were not in the global SVN repository. My workflow is quite similar to the famous git branching model from http://nvie.com/posts/a-successful-git-branching-model to sum it up:   * I work in branches, one branch for one feature (I.e. not mixing up the bugfix with the new feature, etc.)   * I commit really really often, often just 2-5 lines, biggest commits are usually new functions etc. I heavily use the interactive committing tool to semantically organize my commits (i.e. while fixing an import declaration and something in a function, I tend to split that up in two commits when the changes are not related).   * Finally I tended to use `git merge` with the `--no-ff` option, because I kind of like the visual branch-history graph in gitk.   * Never really used rebasing (except for fixups) _Of course this workflow never had to face merge conflicts as serious as teams working on the same codebase face._ Now I have read here and there, that some projects are very concerned about keeping a "fast-forward" history. **Why is this important? What is your choice in that respect?** I can imagine that a 'linear' history is easier to handle when looking at histories, but: It is also valuable to have the true history in my opinion. The linear history without fast-forwards is more similar to SVN histories maybe, but my git commits are usually a lot smaller than the average SVN commit, these are - I think - more comparable to a branch-merge in git (at least my usage). Working without `-no-ff` would kind of "clutter" the history in master (This is my concern about fast forward merges).


Bringing code to an interview?

Is bringing printed code or code on a USB to an interview a good idea? If so, what kind of code should I bring. Should I avoid big projects and just show small snippets which show off my skills?


Suggest a good programming language to learn that is not OOP and definitely not in C style syntax

My first programming language in school was C. Then I learnt C++ and Java and got stuck with Java for 2 yrs. I was so addicted to java and OOP at first. I started making Java applications and became fully thorough in OOP. Now I would like to learn different languages. My mind is full of C style syntax. Sometimes in my dreams, I see camelCase words and paranthesis and braces and dots. Even JavaScript uses C like syntax. I want to get adapt to different languages so that I won't find difficulty when I get a job that requires me to program in different syntax and different paradigm.. I do not know what functional, logical, hybrid paradigms mean. So I am asking here. Suggest me a different language (and some good book on it if possible) to learn..


Past If statements Arrays, loops... Now what?

I gave up on programming a little over a year ago when I kept hitting this wall. I am revisiting the subject because I want to create basic Android application. But I feel that my limited knowledge will not suffice. Here is my problem. I have read a few books and watched video tutorials on C#/Java, followed examples, then finished the book. In the end they always seem to leave me dumbfounded as to what to do next. What a mean is they teach you from your basic "hello world" application all the way up to if's and arrays then seemingly expect you to know how to go out into the world of coding and create anything. Am I missing something here? I know these are the building blocks of all programs but books that I read never really show me what to do next. The easy answer I suppose would be to 'start coding', but where? I read "Head First Java" for example; up to the part were they tell you take everything you have learned and create a dog racing game.... "try not to cheat and look at the source code provided, you should be able to do this by now" _ that's not an exact quote but basically that's what I was told....... Half an hour ago they were just explaining how to do arrays, then without any theory I am meant to create a working game? The reason I ask this is because I fear that this is all I am supposed to know to at least start coding, yet it feels like I have been given a small toolbox and been told to build a skyscraper. Thank you for any advice


How should I implement the repository pattern for complex object models?

Our data model has almost 200 classes that can be separated out into about a dozen functional areas. It would have been nice to use domains, but the separation isn't that clean and we can't change it. We're redesigning our DAL to use Entity Framework and most of the recommendations that I've seen suggest using a Repository pattern. However, none of the samples really deal with complex object models. Some implementations that I've found suggest the use of a repository-per-entity. This seems ridiculous and un-maintainable for large, complex models. Is it really necessary to create a UnitOfWork for each operation, and a Repository for each entity? I could end up with thousands of classes. I know this is unreasonable, but I've found very little guidance implementing Repository, Unit Of Work, and Entity Framework over complex models and realistic business applications.


What is the benefit of Continuous Integration over make?

We are evaluating and setting up Continuous Integration for our PHP project. Each of the Continuous Integration tools has their own proprietary "build language" which will run many commands and check the return status of these commands. Here is an example of a `.travis.yml` configuration:               language: php          php:       - "5.3"       - "5.4"       - "5.5"          script: phpunit test          notifications:       email:         - sourcespeak@phor.net      A Jenkins configuration will be in XML and is too long to paste here. Here is an example of a `circle.yml` configuration:               dependencies:       override:         - bundle install:             timeout: 240             environment:               foo: bar               foo2: bar2             pwd:               test_dir      **My question is: what is the benefit of using all these popular, proprietary configurations languages for CI instead of using a Makefile to set up your test environment and have whatever CI server just run`make test`?**


Are there metrics, like in other professions, that can be used to measure whether a programmer is considered experienced?

Driving instructors (at leas in Germany) often mention 100.000 km driven as a reference point where a driver is considered experienced. Is there a similar number for programmers? For example, how many lines of code does the average junior/senior developer have written when starting their job? Also: after how many lines in a specific language does one usually become an expert of that language? Of course, there are many other factors, that make up who is a good programmer and who is not, however I feel like the number of lines of code could be a pretty good indicator of hands on experience. ## Update: Originally, I asked for a number of lines of code. Of course I am aware, that it makes a big difference, what quality of code was written, in what fields etc. I would not consider any person, that has driven over 100.000km, a good driver either. And I am still convinced, that everybody needs a certain time of experience, to become a great programmer. Though hours was not the measure I was looking for, the number of hours in the answer of suhit was essentially what I wanted. A more clear version of my original question might be: After how many lines of code has a dedicated programmer, who constantly challenges himself, likely acquired enough knowledge and skill to be considered experienced?


Is it good approach to open a keyboard at Actvity start where only one EditTextbox is present

I am working with _Forgot password_ , where I have single EditTextBox and a single submit button. So whenever I am opening this _Forgot password_ page, my keyboard is opened at the start of this page. In my mind there is a question that it is not a smart choice to open a keyboard at the start of the _Forgot password_ Activity.


Complex string matching with fuzzywuzzy

I'm attempting to write a process that matches obscure strings to a single 'master string' for further processing. I have a lot of data that looks something like this:               Basketball     Basket Ball     Football     BasketBallR     BBall     BBall - r     FootB      ...and so on. These need to be mapped to a master record like so:               Basketball       = Basket Ball, BBall     Basketball - R   = BasketBallR, BBall - r      I also have instances of data resembling this format:               Football -r     FootBall - r-g/H,Q,HH      These situations need to be separated into different categories before being mapped. For example `FootBall - r-g/H,Q,HH` should be:               Football - r     Football - g     Football - H     Football - Q     Football - HH      At this point, it still needs to be mapped to a master record... I've tried several different combinations of fuzzywuzzy matching methods, Levenshtein Distance measurements, regex, etc. and can't seem to find a reliable method to logically associate different naming styles of a single item with a master name. I'm throwing my hands up in desperation. Are there any existing python resources than can help sort out my problem? Are there other options? Can anybody point out an obvious option that I might have overlooked? Basically, any suggestion, solution, resource or alternative method is greatly appreciated.


High performance computing and interconnects

High performance computing means different things to different people. From a pure programming perspective what I gather is that these are loads of individual machines connected by extremely fast interconnect not necessarily based on usual TCP/IP. My question is on the interconnect side of things: How do you make interconnects faster without changing your socket based code much?


Do you apply a code of conduct on accepting jobs, projects or requirements?

**When writing software for yourself, your company or third parties, do you always consider certain principles, values, standards, or rules of behavior that guide the decisions, procedures and systems in a way that contributes to the welfare of its key stakeholders, and respects the rights of all constituents affected by its operations?** And can this code of conduct sometimes be overruled by business requirements, lack of technical skills or other friction during the development process? Some random examples in order of severity. (yes that is controversial) :   * Do you accept known bugs as a risk for the end-user?   * When writing applications, do you always give the end user the chance for a complete de-install?   * Do you always secure and encrypt private data delivered end-users in your web application?   * Do you alwask ask the end-user before submitting his entered data to the server?   * Did you ever wrote an application that sends unwanted e-mails?   * Did you ever work on harvesting or scraping projects only for the benefit of the business?   * Did you ever write software that is legal but moraly controversial, like for weapons industry.   * Did you ever wrote software that ( can intentionally) or is be used for criminal activities It would be nice if you can get a good case with explanation on your moral and ethical decisions. note: _Since ethics and law are quite local and cultural dependent, it would be interesting if you add the location of the "crime scene" with it_.


How have you found, refined and maintained your coding style?

Recently, I've been switching between several projects and development environments. The expectations for coding style in each is different. Now, my question is three part, the first, just of curiosity:   1. How did you define and find your coding style?   2. How do you keep augmenting and improving it?   3. How do you maintain it? (From mental notes, keeping a document, using a tool like StyleCop etc.)


"All software has an expiration date by which time it must be rewritten from scratch."

I stumbled upon a discussion between senior engineers and people from non- technical backgrounds and this seems to be a strongly held belief in some places. I'm of the opinion that such a situation is purely down to incompetence on the side of the developers and project managers, those involved in creating the original system and those struggling to modify it now. Especial those who intersect both these groups. Am I wrong? If so why? If not, how can I convince developers twice my age that they need to change their approach to software development to overcome this problem and that rewriting the system from scratch every 2-3 years is not just an unavoidable fact of life. Are there books or influential programmers I can quote on this issue?


What does Bucket mean?

I found in legacy code a class which name is BucketService. Because english is not my native language I was trying to translate that, but it doesn't make sense. I found few termins like bucket sorting and so on, but I still don't get it. Actually this word is used quite frequently in programming I would be helpfull for some simple explanation of that word


Is there any risk of web browsers spying away localhost applications on an Internet-connected PC?

Despite what it _might_ look like this is a serious question. After that story with Android OS and Chrome browser submitting to Google the details of the WiFi access points they see in the neighborhood which has nothing even remotely to do with their main function I'm inclined to expect everything. But the specific question I have today concerns the following matter. The situation. I'm developing a web application running on a locally installed web server. Naturally I'm testing and debugging it on the same development machine in various browsers such as Internet Explorer, Firefox, Opera, Safari and Chrome. The development machine has a permanent connection to the Internet. Now. Is there any situation or circumstance when any of those browsers would take it upon itself to send the opened web pages from `http://localhost:port/*` to its company or any other third party? For now I seriously suspect if there is a browser crash or an OS crash the browser would submit a report perhaps with the content of my HTML, CSS and JavaScript. What if a browser would submit pages used actively and opened over a prolonged period of time just out of the company's curiosity - what is this nasty programmer working on? Can you confirm that hypothesis? Are you aware of any other situations when a browser would sent out a local resource details? How safe is it to develop on a machine with a permanent Internet connection?


What are some ways to maintain codebases written in two languages that implement the same logic?

I have a logic intensive algorithm that I need to code in two languages (actually I finished it in one language satisfactorily and am about to start coding in the other language). By logic intensive I mean the algorithm is non trivial, needs careful understanding and, importantly, could be having bugs (due to complexity and carelessness, you know) that would have to be patched in the future. Also, I want to make sure that when this code changes hands, eventually, it must not overwhelm the new programmers. Given this scenario, what are some ways that would help maintain the codebases and keep they in sync? By ways I mean software tools, best practices etc. FYI the two languages are C++ and Java. C++ for Windows/Linux and Java for "everything else" including Android.


Data structures VS Classes and what happens if they merge?

Alright so I've learned this: **Classes** have public methods that perform operations on the class's data and they hide away their implementations. **Data structures** on the other hand, completely expose their implementation through properties (getters and setters) and don't usually have methods. So my question is, let's say that I have customer data structure that looks like this:               public class Customer     {        public string FirstName { get ; set; }        public string LastName { get ; set; }        public List<Offer> Offers { get ; set; }     }      I would assume this to be a **data structure**. but what if later during the project, I realize that I need to add some business logic to my customer data structure? Like a method to add new offers because there's more logic in doing so than just adding it to the list? It seems to me that this logic would belong inside of the data structure. What happens then? Does the data structure turn in to a class? Or into some kind of third object type that I'm unaware of? Is this **bad design**?


Does Serialization preclude the use of Dependency Injection?

Simple question: I understand that Serialization in C# requires default constructors. This would eliminate the possibility of using Constructor injected DI (which is generally the favored style of DI, in my reading[citation needed]). So is it really an either-or situation, or am I missing something? (Side question): Do IoC containers side-step this tradeoff somehow?


Have you ever hated a framework/programming language/platform but you eventually became curious in learning?

Little background: I've always been kind of a Microsoft hater. A while ago just the fact of learning a something like C# scared me. I was only interested in opensource project and programming languages. Wasn't impressed with vista(actually I hated vista), so I went back to XP Pro. I had to use Windows because some software I use/used wasn't available for linux. Then came windows 7 and before even trying/using it I already judge it to be a 'insert insult here'. I kept hearing really good stuff about it so I removed XP and install windows 7. After using it just for maybe 2, 3 days I started to really like it. Now I like it a lot actually. It even has these small features that may feel irrelevant to someone (like being able to arrange the windows' in the taskbar) which are very useful to me (I used to open programs in a specific order, even close some and reopen just to rearrange them). Actual question: Now I think more and more about learning .NET and C#. I also seen PowerShell which looks tempting. Call me an idiot but I kind of feel weird about this. It almost feels like I'm betraying someone. Have you ever been in a similar situation?


Does Dropbox use a cronjob to sync up?

I was looking into lipsync on a Dropbox clone. I was looking at the diagram on how it works here. It shows that a cronjob is used to keep files in sync between client and server. Does that mean that every sec/min/hour, a cronjob runs and checks to see if there is a difference between client and server? Is that how Dropbox does it? If it does use a cronjob, what happens when you are in the middle of syncing and another cronjob runs? Does rsync (or additional libs) know how to handle this?


why are all the functional programming tutorials so mathy?

I've been trying to learn functional programming and most tutorials I have found use math as examples for the more complicated constructs (even the simple ones in some cases). Why is this? I would imagine something easier could be used. Its making it difficult to learn. Background Info: I have been writing software for 12 years. I understand some of the concepts such as closures, functions as first class citizens, and generics. I may be having problems with higher-order functions at some advanced level, but I would like to believe I have a basic grasp. Monads are biting me in the butt, and at this point I haven't gotten past that (I'm sure I will eventually, because I'm persistent).


What's the best way to manage list item sort order with Drag & Drop UI?

I have a list of Students that I should display to user on a web page in tabular format.   The items are stored in DB along with SortOrder information. On the web page, user can rearrange the list order by dragging and dropping the items to their desired sort order, similar to this post. Below is a screenshot of my test page.   ![enter image description here](http://i.stack.imgur.com/iPuhT.jpg) In the above example, each row has sort order info attached to it. When I drop John Doe (Student Id 10) above the Student Id 1 row, the list order should now be: 2, 10, 1, 8, 11. What's the optimistic (less resource hungry) way to store and update Sort Order information? My only idea for now is, for every change in the list's sort order, every object's SortOrder value should be updated, which in my opinion is very resource hungry. Just FYI: I might have at most 25 rows in my table.


Aggregate root & Repository dilemma

I am in a big dilemma here. I have a League, Team and Player entities. I have created a repo for the league only as a Team cannot exists without a League. At first I had bounded the players only with the team but then I realised I would have a problem with free agents so I also bounded the players to the league. Then I was wondering if a player could exists without a League or a Team and I am totally confused to that question. So would you make a player repository or include them in the league repo? Thanks


What is the need for 'discoverability' in a REST API when the clients are not advanced enough to make use of it anyway?

The various talks I have watched and tutorials I scanned on REST seem to stress something called 'discoverability'. To my limited understanding, the term seems to mean that a client should be able to go to `http://URL` \- and automatically get a list of things it can do. What I am having trouble understanding - is that 'software clients' are not human beings. They are just programs that do not have the intuitive knowledge to understand what exactly to do with the links provided. Only people can go to a website and make sense of the text and links presented and act on it. So what is the point of discoverability, when the client code that accesses such discoverable URLs cannot actually do anything with it, unless the human developer of the client actually experiments with the resources presented? This looks like the exact same thing as defining the set of available functions in a Documentation manual, just from a different direction and actually involving more work for the developer. Why is this second approach of pre-defining what can be done in a document external to the actual REST resources, considered inferior?


Why error codes are negated?

Very often I see in C code negation of returned error codes, e.g. `return -EINVAL` instead of `return EINVAL`. Why used negation?


Do simple accessors and mutators benefit from commented block headers?

**Short Question**   Is it necessary to add the function header comments for **simple** accessors and mutators? **Example**               u8   OBJ_get_state_x(void) {return obj.state_x;}       void OBJ_set_state_x(u8 x) {obj.state_x = x;}      **Addition Thoughts**   The object (OBJ) overall contains very minimal logic (if any). Its sole purpose is to maintain the state of a system. Additional modules (such as IO, COMM, DISPLAY, etc...) all know _what_ the object is and contain all of the business logic required to drive the states in OBJ. I would _like_ to keep all of the accessors / mutators on a single line to make the file a bit more readable and just put a generic block header above all of them. I just don't know if this is a common (or good) practice. Note that all of the ranges are the bound by their type. If there is a special state that has a range of 0 to 3, I create an typedef'ed enum to use as the type (thus forcing the range and making the code more readable IMO).


Is having trouble with data structures common for beginners?

I'm taking my second course on Java. We are getting into data structures. I have done an assignment on a linked list, and now a stack. I had a hard time with the linked list. The stack gave me a little trouble, but was much easier. Should I be worried about having a hard time with these algorithms and data structures? I just feel like I didn't really grasp it.


What is the correlation between programming language and experience/skills of their users?

I'm sure there is such a correlation, because   * experience and skill leads good programmers to picking languages that are better for them, in which they're more productive, and   * working in a language forms how programmers think and influences their methods and skills. Is there any research or some statistical data of this phenomenon? Perhaps this is not a purely academic question. For example, if someone is starting a new project, it could be worth considering a language (among other criteria of course) for which there is a higher chance of finding or attracting experienced programmers. **Update:** Please don't fixate on the last paragraph. It's not my intention to choose a language based on this criterion, and I know there are other far more important ones. My interested is mostly academic. It comes from the (subjective) observation and I wonder if someone has researched it a bit. Also, I'm talking about a _correlation_ , not about a rule. Sure there are both great and terrible programmers in every language. Just that in general it seems to me there is a correlation.


Web application / Domain model integration using JSON capable DTOs

I'm a bit confused about architectural choices for the web- applications/java/python world. For c/c++ world the available (open source) choices to implement web applications is pretty limited to zero, involving java or python the choices explode to a,- hard to sort out -, mess of available _'frameworks'_ and application approaches. I want to sort out a clean MVC model, where the **M** stands for a fully blown (POCO, POJO driven) domain model (according M.Fowler's EAA pattern) using a mature OO language (Java,C++) for implementation. The background is: I have a system with certain hardware components (that introduce system immanent active behavior) and a configuration database for system meta and HW-components configuration data (these are even usually self contained, since the HW-components are capable to persist their configuration data anyway).   For realization of the configuration/status data exchange protocol with the HW-components we have chosen the Google Protobuf format, which works well for the directly wired communication with these components.   This protocol is already used successfully with a Java based GUI application via TCP/IP connection to the main system controlling HW-component. This application has some drawbacks and design flaws for historical reasons. Now we want to develop an abstract model (domain model) for configuration and monitoring those HW-components, that represents a more use case oriented view to the overall system behavior. I have the feeling that a plain Java class model would fit best for this (c++ implementation seems to have too much implementation/integration overhead with viable language-bridge interfaces). Google Protobuf message definitions could still serve well to describe DTO objects used to interact with a domain model API. But integrating Google Protobuf messages client side for e.g. data binding in the current view doesn't seem to be a good choice. I'm thinking about some extra serialization features, e.g. for JSON based data exchange with the views/controllers.   Most lightweight solutions seem to involve a python based presentation layer using WSGI or JSON based data transfer (I'm at least not sure to be fully informed about this). Can someone give good advice about best practices or easy to integrate frameworks for such case? **UPDATE:**   According to my recent research and comments of colleagues I've noticed that using Java (and some JVM) might not be the preferable choice for integration with python on a limited linux system as we have (running on ARM9 with hard to discuss memory and MCU costs), but C/C++ modules would do well for this (since this forms the native interface to python extensions, doesn't it?).   E.g. a pyramid based solution seems to provide a lightweight framework, that allows to integrate a domain model using an appropriate python facade. Protobuf also provides python class generation support, does someone have experience with integrating protobuf messages as DTO's with python? I can imagine to provide a domain model from an appropriate C/C++ API (though I still think it's more efforts and higher skill requirements for the involved developers to do with these languages). Still I'm searching for a good approach that supports such architecture. I'll appreciate any pointers!


In Java, should private helpers go above or below public methods?

I've noticed that a coworker and I have opposite practices regarding the ordering of methods in our Java classes. One of us begins a class with its major public methods, and then put all of the private helpers afterwards. The other one of us makes sure that public methods are at the very end. Clearly, this is just a style issue and there is no right answer. However, before we decide that this matter is just another Yooks vs Zooks fight and just pick one or the other arbitrarily, I was wondering if perhaps there was a standard Java style guide recommendation or some practical reason why one approach is better than the other.