How do I build a highly scalable user/profile service?

Question -- I currently have a large monolithic Java application which I am working to break up into services components. One of the components I want to separate out is the service which handles and presents users and profiles. Currently the core service uses a MySQL backend and is written in Java, and is only hosted on one set of servers (web, app, db). My primary goal is to get the user/profile service to be n+ scalable across multiple web, and app servers and trying to figure out a way to do it across the database layer. What are some of the best practices to achieve high scalability with this environment? (We currently have a few million users, but expect to grow past that). Thanks!


Do unfamiliar frameworks make you nervous?

Our company is a small (non-technical) startup who is currently going through a developer transition, and we considered bringing in a local web development firm to work with us on a project basis. I sat down with a developer from one of these firms, and gave him a tour of our code base. He seemed like a pretty bright guy, and while he admitted no experience with our particular PHP framework (rhymes with 'Bend'), he appeared to be a totally capable developer. We found out the next day that they didn't want to work with us because of our choice of framework. For people who do consulting or work for development, how much does a client's choice of framework influence your decision for taking the client? Obviously, language and platform make a huge difference (I wouldn't expect a PHP shop to write C#), but as a developer I would always pick the client using any framework, over one that does not. I know everyone has their own comfort level and areas where they specialize, but do you feel comfortable tackling a new technology armed with only some API docs and google? Do you try to make this as clear as possible to the client? What are some reasons you would turn down someone for their choice of framework (assuming it fell into your basic realm of knowledge)? And with all the frameworks out there, how is one developer ever expected to pick something others can support?


Possible holes in a spam-registration prevention approach?

I was thinking of creating some login code (probably to work with BrowserID so users don't need to store their passwords with my site while also ensuring the supplied email account belongs to them) which required any user accounts to be an email address in the ".name" or possibly ".me" TLD (or in any other TLD that was intended for individuals or individual corporate employees only-- i.e., not open to public registration) and perhaps disallowing subdomains (as it might be tempting for some companies to purchase a generic domain and lease out the personalized subdomains); of course it wouldn't stop a company from leasing out names like user123@spam-friendly-site.name, but as the TLD is intended for individuals, it would hopefully be easier to blacklist any such bad behavior-enabling sites wholesale. The purpose would be two-fold:   1. Raise the threshold for spammers as they would have to either purchase a new domain any time they wanted a new spam account (and any abusing _domains_ could be blacklisted and shared as a public list) or obtain control of a legitimate user's email account or browser/system.   2. Encourage people to throw off the yoke of dependency on fixed third parties for emails as well as website hosting, chatting, etc. by getting their own domains. One wouldn't want a phone number like 555-123-1234@att.com because one could not freely change providers. And there are no doubt many would-be content creators who would share more freely if they had a site belonging to them. If one wanted to be anonymous, one could reserve domains like anonymous567.name (e.g., me@anonymous567.name) -- and this would be fine with me as my purpose is not to positively ID people outside of the context of confirming they control the email address they give me but to raise barriers to spammers. It would add a small price to do content creation on the site as users would have to purchase a domain and configure email on it and would cost more so to become truly anonymous (e.g., to purchase separate domains for each site to avoid tracking between sites), but I think the burden should not lie on content websites to deal with spam registrations. If this really gets going, one might also be able to set up one's email filters to block anyone not belonging to such a personalized domain as well, giving an auto-reply of how to register for one. Does anyone have feedback on the idea, specifically any unexpected barriers I might encounter (such as ways it could be circumvented)? I know of course that it will raise barriers for some users, but any potential technical challenges?


VB stand alone application or ASP web application

I have experience developing software and web applications and I have decided to do some freelance work on the side. Well, I met with my first client and they are requesting a relatively simple, custom system that (without being long winded) tracks client’s paperwork as it progresses through the business’s different manual processes. It is a small business that has about 10 employees, but all of the employees will interact with the client’s paperwork, therefore everyone would need access to the new system. When I say **track** I literally mean that the employees will **check as complete** on a simple page the increases a progress bar at different stages for the paperwork. Now I am %110 capable of coding the custom system that meets their needs, but I am unsure about how I should go about doing it. The information that is being tracked in the new system and stored in the DB is confidential information that they are very protective of. My main question is how should I be developing this to be as secure as I can?   * They have their own server in house, so should I develop an application (VB and SQL) for the server and require employees to log on remotely to use it? Can more than one person access/use the application at a time?   * Or should I develop a web application (ASP.Net/VB and SQL) that is only accessible on their network to their employees? They plan to expand offices, could they set up a VPN to access the site? I’m leaning towards a web application, but I have not done too much in term of security. What specific options do I have for security that aren't too complex. Basically I’m looking for pros and cons for either option or any suggestions on what I should.


Is testability and mockability really that important in web development?

I'm reading this series on Laravel, and it's in great depth dealing with making everything testable, using _Repository_ instead of just using the _Models_ , using _Dependency Injection_ and other obscure techniques. I've got a feeling that adding all this extra complexity in the name of Testability may not be the right thing. Writing unit tests for everything, that sounds plain silly. I have used Laravel before, without all this "testability" stuff, and it just worked. Is "testability" worth the effort and making code harder to understand? (note that I'm posting here instead of StackOverflow, for this is kind of opinion based. I hope I won't be frowned upon for asking it.)


Setting fields with correct default value

When writing constructors, I regularly encounter a situation where some fields already have approperiate (default) values, such as `false` for boolean values and `0` for integers. What are reasons to emphasize these values, for example like: `state = 0;` Do you appreciate it when reading someones code? On one side I feel like expressing implementation details explicitly, on the other side I find it pointless to set a field when I'm sure it is already correct.


Why doesn't layered architecture translate easily to tiered architecture?

Basically, I'm trying to understand why layered and tiered are that different, and why they don't translate easily to each other. I understand that layered could be 3 separate class files for UI, BL and DAL. Whereas tiered can be a Project for the UI, which links to a BL project which links to a DAL like entity framework, and then a database. So why are/aren't they easily translatable? Hope that makes sense, Thanks.


Cron'ing PHP scripts that write to other files.

So the client I am working for right now is really big on load time speed, so we try to shave every micro second possible. We found a file the other day that was pulling some word press blogs and it was adding a solid second to the load time. Now I didn't write that particular script and perhaps I can go optimize it later, but for now, what I did was make a script that writes the output of the wp script to another file, then I simply reference that file when we need it. We run a cron on the script I wrote so it checks the wp script every so often and outputs any updates if needed. That obviously really made things faster but I just have never done it before so I am curious about it:   * obviously we have a file with 777 permissions, what are my security concerns for this?   * Is this a good strategy to cut down in the future when the processing doesn't have to be done at the time of load?


How to name your application version so a user don't find out that it doesn't change during an update

I know it's a strange requirement but we want to create some version string which wouldn't change and that would prevent a user to notice that after an update, the version is the same as before. Example               asfkl1sd35f1s3df15s53dfs1df3sd15s3fsf      But this is quite ugly and may attract too much attention :) Simple strings on the other hand are easily distinguishable and one may notice that it does not change in time... So basically we want to have the same version but we don't want to hear users complaining that they updated the application and the version is the same. Any ideas?


Copyright/Licensing on a complete rewrite

There was an application for PalmPilots that I liked back when PalmPilots were a thing. I want to recreate it (or at least what I remember of it) for modern mobile devices. The problem is, after scouring the internet for any information on the application or the original author, I am unable to find anything. I can't even find any binaries for the app. Since I have absolutely nothing but memories to work with, I'll have to write this from scratch, but my intention is to make it as similar as possible to the original. Since I have no idea who the original author was or what the original license was (I do know that it was at least freeware), I wonder to what extent I can do this. I don't plan on charging for my rewrite and I would like to license it under the GPL or similar. I know this is probably a gray issue, but is it closer to light gray or dark gray? EDIT: I should also add that I know for a fact that any text or graphics (ie. anything except code/functionality/UI layout/general concept) would have been licensed to the author in such a way that, without question, I would also be able to use them.


Does a repository belong in this project?

I have a project that gets all of its data from API calls. The server that hosts this API connects with it's own database (not even sure what DB it is, etc). More or less the idea of a repository is to separate data and map it, right? I shouldn't be concerned where my data comes from. But if, at the end of the day, they are API calls, should the repository itself be doing all the api calls within its methods? For example if we had a FindBY method in the repository, should that method be the one making the API call?


A good substitute for ASMX web service methods, but not a general handler

The best thing I like about ASP.NET MVC, is that you can directly call a server method (called action), from the client. This is so convenient, and so straightforward, that I really like to implement such a model in ASP.NET WebForms too. However, in ASP.NET WebForms, to call a server method from the client, you should either use **Page Methods** , or Web Services, both of which use SOAP as their communication protocol (though JSON can also be used). There is also another substitution, which is using Generic Handlers. The problem with them however is that, a separate Generic Handler should be written for each server method. In other words, each Generic Handler works like a simple method. Is there anyway else to imitate MVC model in ASP.NET WebForms? Please note that I can't change to MVC platform right now, cause the project at our hand is a big project and we don't have required resources and time to change our platform. What we seek, is a simple MVC model implementation for our AJAX calls. A problem that we have with Web Services, is the known problem of SoapException, and we're not interested in creating custom SoapExctensions.


Sorting an ArrayList by a Split Value

I am attempting to create an list which should be sorted by a particular field in a colon separated string. I have an array of strings with the following values:               name1:535     name2:697      After sorting this list, I would have it sorted by the number in the second field:               name2:697     name1:535      How should I go about doing this, are there any issues I should be aware of when sorting this List of Strings?


What should I put in comments while commiting to the Source Control?

I am a lone developer and maintain a SVN server for source control. So far, I haven't followed anything specific while committing my changes. I was just reviewing my previous commits, and couldn't make any sense of my comments. What do you put in comments while committing your checkins?


Moving our web application from a windows development environment to linux environment seamlessly

I am trying to develop a web application on a windows machine using apache wicket, java, jquery etc. Apache wicket comes with an embedded jetty server. I am using eclipse as the IDE. The application needs to access some resources like configuration files etc that are present on remote machine (linux server) to which we could ssh, once development is complete we would like to deploy this application on a tomcat server hosted on this linux server. How to move seamlessly from the windows development environment to the linux server deployment? Right now we do the development by copying over the latest config files from the server, however this is error prone as it becomes difficult to keep track of the latest config files, this leads to unexpected behavior when the application is deployed. Our team is located in India and our servers are located in US, mapping the config files and accessing them do not have good response times.


PaypalCheckout object is composed of PaypalQuery objects. Hide PaypalQuery objects to users of PaypalCheckout?

I have a `PaypalCheckout` object that handles the checkout process: from initiating API calls, to providing an interface for front-end code (e.g. View/Controller). The `PaypalCheckout` object handles: gathering price details from a basket, to redirecting to paypal for payment, to getting the customer's address details from Paypal, sending payment confirmation to paypal and finally determining the status of the payment. It does so by instantiating children of an abstract `PaypalQuery` class such as `PaypalQuery_StartCheckout`, PaypalQuery_GetAddressDetails`,`PaypalQuery_ConfirmPayment`. **My question is about how to organise methods in`PaypalQuery_ConfirmPayment` and 'PaypalCheckout':** At present, my `PaypalQuery_ConfirmPayment` objects have methods such as:   * `public function isPaymentSuccessful();`   * `public function isPaymentPending()`   * `public function hasItemNotReceivedProtection()`   * `public function getPendingReason()` And I was hoping to hide all `PaypalQuery` object methods from front-end code. The problem is, that would involve making methods in `PaypalCheckout` which blindly call and return methods in the `PaypalQuery` class(es). While not exactly much of a hassle, it 'smells'. Although what the smells are, let alone the best solutions, elude me. I am hoping to keep this simple - while I may add other payment options besides Paypal in the future, I am comfortable refactoring at that later date. Also, in case it makes a difference, I don't think I am using any traditional framework patterns such as MVC - (although I have taken ideas from them). I am doing this in PHP. What solutions could I use? Thanks


CI runner on same server of GitLab?

I'm setting up a GitLab server in my company and now I'm adding GitLab CI to it. Before start this task I'd like to understand if there are any disadvantages running my runners on the same server used by GitLab and GitLab CI. I've read that there are security concerns but we use it only internally so I don't think this could be a problem. Am I missing something?


How to best organize spaghetti Javascript on the client with an MVC server architecture?

A LAMP project I am currently working on is pretty well organized on the backend. However, there are a ton of pages that just have a diarrhea of javascript and html squirted all over numerous locations with little discernible architecture, rhyme, or reason. In a few cases, some kind of javascript prototype was created for a common control, and the MVC framework in place is taking care of templating pages. How do we start to get all this spaghetti code under control? On backend projects I would start with getting some unit testing in place, CI, refactor common MVC or model/mapper code out etc..


Good resources for web form design and usability

Can anyone suggest good resources about web form design and usability for web applications?   Especially complex forms with 15+ fields etc.


Should I start making connections even if I'm not ready for a job yet?

The first job is always the hardest to get and I'm no exception. I'm 23 years old and I have no college degree but planned on going to college this year if all goes well (CS of course). I'm self-studying java right now. I know most of the topics related to the language besides the more advanced topics and I'm beginning to look at open source projects. I would like to find a job (at least a part time job) after a year or two when I'll gain more experience and learn more about java technologies and other technologies that interest me. Finding a job will be a bit difficult because most of the people (or a lot of them at least) at my current age already have 2 years or more of experience, so I will be somewhat disadvantaged. Should I start building connections and joining websites such as linkedin ? I never bothered to look into it because I'm not much of a social network person. If I start contributing to open source projects and create personal projects for 2 years could I apply for jobs that require 1-2 years of experience? Does this experience count ?


Equal Gifts Algorithm Problem

Problem Link - http://opc.iarcs.org.in/index.php/problems/EQGIFTS > It is Lavanya's birthday and several families have been invited for the > birthday party. As is customary, all of them have brought gifts for Lavanya > as well as her brother Nikhil. Since their friends are all of the erudite > kind, everyone has brought a pair of books. Unfortunately, the gift givers > did not clearly indicate which book in the pair is for Lavanya and which one > is for Nikhil. Now it is up to their father to divide up these books between > them. > > He has decided that from each of these pairs, one book will go to Lavanya > and one to Nikhil. Moreover, since Nikhil is quite a keen observer of the > value of gifts, the books have to be divided in such a manner that the total > value of the books for Lavanya is as close as possible to total value of the > books for Nikhil. Since Lavanya and Nikhil are kids, no book that has been > gifted will have a value higher than 300 Rupees... For the problem, I couldn't think of anything except recursion. The code I wrote is given below. But the problem is that the code is time-inefficient and gives TLE (Time Limit Exceeded) for 9 out of 10 test cases! What would be a better approach to the problem? Code -               #include<cstdio>     #include<climits>     #include<algorithm>     using namespace std;          int n,g[150][2];          int diff(int a,int b,int f) {         ++f;         if(f==n) {                    if(a>b) {                            return a-b;                    }                    else {                         return b-a;                    }         }         return min(diff(a+g[f][0],b+g[f][1],f),diff(a+g[f][1],b+g[f][0],f));     }          int main() {         int i;         scanf("%d",&n);         for(i=0;i<n;++i) {                          scanf("%d%d",&g[i][0],&g[i][1]);         }         printf("%d",diff(g[0][0],g[0][1],0));     }      Note - It is just a practice question, & is not part of a competition.


Scientific evidence that supports using long variable names instead of abbreviations?

Is there any scientific evidence that the human brain can read and understand fully written variable names better/faster than abbreviated ones? Like               PersistenceManager persistenceManager;      in contrast to               PersistenceManager pm;      I have the impression that I get a better grasp of code that does not use abbreviations, even if the abbreviations would have been commonly used throughout the codebase. Can this individual feeling be backed up by any studies?


Share Mulitple Classes as one dll or a lib with Mulitple Projects

Currently I have some shared class files(.cpp and .h) which I include them in around 20 Projects. Currently I have to include them in all of the projects. So if I get some business requirments and I change some of the shared(.cpp or .h) files I have to include them in all the 20 Projects which is kind of tedious. Is there a way where I can create a shared dll or library and include it all of my Projects. So if I have to change it, I just have to change it once and then just Add Reference to include that dll or library which contains all the shared(.cpp, .h) files. Any help/recommendations regarding the same, will be highly appreciated. I am using VS2012 for VC++.


Might I run into any trouble if I plug into an existing service/application with my own application and charge for it?

I know this is more of a lawyer question, however I figure someone here has probably done this and can give me a quick answer. Lets take a moderately extreme case. I build an adapter for a website that translates the requests and markup into a more formal API. I then take this API I developed and build a mobile app on it. So in short I take a site that doesn't support mobile. Build a mobile application, and then charge for the mobile application. I am not talking about charging for any of the original product. Simply the extension to the product. I ask because there is a site I would really like to build a mobile app for, because it would make my life easier, and it would be pretty gravy if I could earn some cash on the side from the work as well.


File system implementation in MongoDB with GridFS

I am working on two projects that will both implement a Webdav server backed by a MongoDB GridFS. In each case, there is the potential for the system to store tens of millions of files spread across thousands of hierarchical directories. I can come up with two different ways of storing the directory structure:   * As a "true" hierarchical file system, with directories containing the IDs (`_id`) of subdirectories and regular files. The paths will be separated by slashes (`/`) as in a POSIX-compliant file system.     * The path `/a/b/c` will be represented as a directory `a` containing a directory `b` containing a file `c`.   * As a flat file system, where file names include the slashes.     * The path `/a/b/c` will be stored as a single file with the name `/a/b/c` What are the advantages and disadvantages of each, with respect to a "real" folder-based file system?


Best alternative of Property file in Java

Hey I an working on the product which is live at multiple portals. The product is developed in GWT, JAVA, Hibernate. **My question is :** Whether there is any alternative of using property file in java. **My Requirement :**   1. For one property key there are multiple values in live portal for each different portal.   2. Each time I change property file, I need to make the war again.   3. The loading of any of the property should not be time-consuming. Any help or suggession would be apprecialble !!!


Concept of bit fields

Whenever I read a code like this:                 struct node       {               int x : 2;               int p : 4;        }n;      with bit fields involved, I get really confused, as to how they are represented in memory, what is `sizeof(n)` etc., how does it differ with normal members of structures? I tried referring K&R and http://en.wikipedia.org/wiki/Bit_field but they little to remove my confusion. What concepts of bit fields am I failing to grasp?


Is having some logic in source code in order to perform some tests a good practice?

The question is not about changing the method/function visibility or extract local variable into instance variable in order to perform unit tests. There are cases where we could include some logic in the source code in order to help us performing some functional tests or end-to-end tests. Generally speaking, these code interact with main logic directly and if the test code is defective, the business logic is affected. One example could be that we have some test code around date/time logic so that if the testers make server and client time different, this code could help them to perform some tests. So how bad you think having this is, if there is no other easy(ish) way to test this part of business logic? Please comment if this plain explanation is too vague and you need more examples.


Many Arguments in Case Classes

I have generally read that having many (>4) arguments to a function/constructor is a bad practice.   1. Is this still considered a bad practice? And is there a non-obvious reason?   2. In something like a Scala Case Class where there may be many fields what can be done to avoid such a construction? (Not sure if this is best fit for here, SO, or CodeReview)


Passing member variable as a method parameter

In a project, I've found a code like this:               class SomeClass     {         private SomeType _someField;              public SomeType SomeField         {             get { return _someField; }             set { _someField = value; }         }              protected virtual void SomeMethod(/*...., */SomeType someVar)         {         }              private void SomeAnotherMethod()         {             //.............             SomeMethod(_someField);             //.............         }          };      How do I convince my teammates that this is bad code? I believe this is an unnecessary complication. Why pass a member variable as a method parameter if you already have access to it? This is also a violation of encapsulation. Do you see any other issues with this code?


Why is prefixing column names considered bad practice?

According to a popular SO post is it considered a bad practice to prefix table names. At my company **every column** is prefixed by a table name. This is difficult for me to read. I'm not sure the reason, but this naming is actually the company standard. I can't stand the naming convention, but I have no documentation to back up my reasoning. All I know is that reading AdventureWorks is much simpler. In ~~this~~ our company DB you will see a table, Person and it might have column name: Person_First_Name   or maybe even   Person_Person_First_Name (don't ask me why you see person 2x) Why is it considered a bad practice to pre-fix column names? Are underscores considered evil in SQL as well? * * * Note: I own Pro SQL Server 2008 - Relation Database design and implementation. References to that book are welcome.


Would adding award points or game features to workplace software be viewed poorly amongst the programming community?

So one of my responsibilities at work is to build an internal tool that helps the workers enter in all their information. It's an enterprise application that is similar to a Windows forms database tool. So it's not much different than like developing a Word + Excel combo application, but the average person in this workgroup is a 20-40 year old woman or a random chatty male type. Plus I know all of these people are heavily involved with Facebook on a daily basis. How bad would it be if I styled my new interface to be similar to what Facebook does. People could get award points and stuff when they fill out different types of forms and basically compete against each other like it was a game. When people had completed one, it would be posted on their wall and everyone could comment/like stuff just like in Facebook. And it would be like they are doing peer reviewing for fun. The rewards would be outstanding I would imagine. These people are so into Facebook and Facebook games that productivity would rise due to them trying to compete and earn points and achievements. Would this be taking advantage of the people by 'tricking them into working harder by giving them a game' or would it be viewed as something that would improve happiness at work?


Arrays vs Objects in view template

I am wondering, in view templates, what would contribute to me choosing between using arrays or objects for getting things printed out in arrays `{{$user->zip_code}}` vs `{{$user['zip_code']}}` I'm working in blade templates in Laravel/PHP fwiw. My feeling is that it makes sense to use objects: we can use methods if we need to to display/format data, it looks a lot cleaner in the views, and bc of how PHP works fails gracefully if the item isn't set (an unset array value will puke, so you either need to make sure all possible properties are present but false, or do a `{{(isset($user['zip_code'])) ? $user['zip_code'] : ''}}` for everything you use in a view. However, I have encountered some contrasting opinions like: the less the view knows about the layers below it, the better. As such, "flat" values (arrays) are better to use in the view. We should not trust the view not to explode if a value is not set, that should be handled in the controller. Because our object properties are not encoded in the models in this system, we can't rely on each object always having the same info in a model level. Wondering if there are other factors at play here. Orr.. Does it not matter


Uncomfortable terminology

I couldn't imagine using terminology like "code smell", scrum "chickens", "pigs" at my workplace. These types of terms just wouldn't fit in to my environment. My co-workers would look at me, and tell me to grow up, or stop being offensive or similar. Does anyone else find terminology used on this site, or other related terminology uncomfortable to use at work?


Can relational algebra/calculus proofs be used to test/verify SQL?

Is it feasible or even possible to use relational algebra and/or relational calculus in the form of proofs to test/verify the correctness of SQL statements, functions, and stored procedures? It seems to me like it should be at least possible, but I don't know if there's a detail I'm missing that makes a 1:1 mapping between the proof and the code incorrect. Have any of you tried a method like this? Did it work? What were your experiences like?


Writing-Reading a hashtable to a text file

I'm implementing a hashtable structure for a dictionary. Dictionary is in a text file. There are 2 words on each line. I'm generating the hashtable by using the first word as a key. I'm holding the hashtable on a list. I want to save the hashtable to a text file to use it every time. What kind of structure should I use? Is there a way to do this without reading the whole hashtable from text file?


Which languages are more conducive to telecommuting, and also less concerned with pairing?

I don't know that it may even make a difference, and I reckon if it did the differences would be cultural rather than technical, but if one were going to set out today (2011) to learn a language, and specifically wanted to telecommute (so they could live in two different places during the year), are there any languages whose culture looks more favorably upon telecommuting than other languages / cultures? For example, I get the impression (and I am probably completely wrong) that in the Ruby community, you are more likely to be expected to be on-site and doing pair programming (though I suppose you can do pairing remotely too). As a corollary question, are there languages / communities where pair programming is less important, for people who wanted to program in part because they aren't social butterflies?


What language is used to program nano quadrotor behaviour?

Just watched this fascinating and terrifying video. I'm curious what programming language / paradigm is used to control these beasties?


How to implement software for my vehicle

I'm developing a Driver Safety Monitoring System which is kind of small software which would be implemented inside a car with connections to few cameras. What I want to know is **to implement this software inside the vehicle what kind of computer can I use?**


Parsing scripts that use curly braces

To get an idea of what I'm doing, I am writing a python parser that will parse directx .x text files. The problem I have deals with how the files are formatted. Although I'm writing it in python, I'm looking for general algorithms for dealing with this sort of parsing. .x files define data using templates. The format of a template is               template_name {        [some_data]     }      The goal I have is to parse the file line-by-line and whenever I come across a template, I will deal with it accordingly. My initial approach was to check if a line contains an opening or closing brace. If it's an open brace, then I will check what the template name is. Now the catch here is that the open brace doesn't have to occur on the same line as the template name. It could just as well be               template_name     {        [some_data]     }      So if I were to use my "open brace exists" criteria, it won't work for any files that use the latter format. A lot of languages also use curly braces (though I'm not sure when people would be parsing the scripts themselves), so I was wondering if anyone knows how to accurately get the template name (or in some other languages, it could just as well be a function name, though there aren't any keywords to look for)


Most difficult subject/theory in Computer Science?

Which is the most difficult CS subject/theory that you studied but important to the field? And the reason please?


Is it OK to live without knowing how the program you created works?

I mean, there are really useful libs that can solve problems when you are stuck and do not know how to solve this or that with your knowledge of programming language you use... For example, Boost for C++ or JQuery for JavaScript or Spring for Java... They solve problems in seconds and you do not really care how they did it (despite that they are written in the very same language you are programming in)... So I wonder am I alone in using libs while not being capable to write solutions for my problems from scratch or is it standard practice?


"Property Container" design-pattern in-depth definition

Could anybody, please, explain what is a `Property Container` or at least where can I get information about that pattern **on the Internet**? I've found that it exists as one of the `Fundamental` patterns in this article. Unfortunately, it is not described in the corresponding English article. The only thing is a short description in Wikipedia that I've tried to approximately translate below: > This pattern allows to add additional properties for the class in container > (inside the class), instead of extending the class with the new properties. If a short example is possible in PHP / C# / C++ or Java, it would be quite useful for understanding. P.S.: It seems like it has been described in "SanFrancisco(TM) Design Patterns: Blueprints for Business Software", but I don't have access to it. Google does not help or I'm searching with the wrong keywords...


How to approach multiple page form with just one save option

The screen shot shows the magento product upload page. The left nav allows you to switch to different options for the product. Basically each option in the left nav appears as a different page. However when you save and close, it will save all the updates made on each page. Using Foundation4, html, css, js - what would be the best approach to replicating something similar? Say I want 3 pages and one save button option. Using http://foundation.zurb.com/docs/components/section.html#panel2 and having the save buttons the top line form level seems a possible option. ![Magento screen shot](http://i.stack.imgur.com/7BRce.jpg)


Problems with Corba

I have a software engineering midterm tomorrow and as I was going through the past exams I saw this question: True or False with justification: One of the problems with CORBA is that distributed systems created using it must be written using the same programming language. I don't remember my professor saying anything about CORBA in class so I am having hard time answering this question even though I searched for CORBA online , so it would be great if you could help me understand the question. Thanks in advance


How could Clang release under BSD license?

I found that llvm could only generate assembly code. If someone want generate and link assembly code to native executable code, they should use external tool(GNU as/ld, for example. Currently lld is not ready, and there no more information about llvm-mc). This question's answer and other answers imply that Clang use Binutils(as and ld) to generate and link native code(I'm not quite sure about this). If so, how could Clang release under BSD like license? I can't find any license exception(like Bison Exception) about ld or as. If I misunderstand some concepts, please forgive me! BTW, could we use GNU as and ld in programmatically way? **EDIT:** Thanks for these answers. It seems that clang still not a standalone toolchain and have to use VS or GNU tools. Does it mean if someone write a compiler based on llvm. If users didn't install GNU or VS tools. The compiler is not a out-of-the-box compiler?


Do paint programs also need database?

I was thinking about how would a paint software works. Firstly I thought that it might not use any database but when I started thinking about the undo function I realized that it might be that the data is somehow stored in the database. Can anyone please help me out by telling me how the images are stored in a normal paint program(say MS-PAINT of Windows).


planning the same app for both OSX and iOS

I would like to ask which is the best strategy for creating an application that will be developed both on Mac and iPad, so to make minumum effort to port it from one platform to the other, starting from iPad, for example, but rather trying to make both at the same time. The application, in fact, would be an iPad-style one on the Mac too. How should I have to plan the project? Which are the main tricks to easily get the goal?


Need to include Calendar and Email in own CRM system. Whose?

I am writing a web based application that needs to have some elements of CRM in it but I cannot use an of-the-shelf CRM to do what I want. (Honestly we have been through it all and it will not work). Now while Tasks, Calls, Meetings and Notes are straightforward the idea of reinventing Mail and Calendars seems a waste of time and effort and also unproductive as most users already have their own and it simply adds to the complexity of my application and hacks users off. My thoughts are going around using Outlook and or GMail/iCal and or Mac Mail/iCal and or Thunderbird and importing the relevant data or if possible integrating it into the application. Any thoughts? Anyone got any experience of this can point me in a few directions. N.B. Not looking for an answer as too complex just some pointers and thoughts. Thanks. p.s. We did look at Sugar CRM as the basis for our project and it is useful to get best practice from but as I say it was not useable due to how we are structuring our software, not Sugar's fault.


Internationalization of non-english application

I know there are lots of posts for internationalization, but this is something I didn't found while searching. I have a PHP Web application, which is pretty big right now. It's developed actively for 4 years and wasn't built with internationalization in mind. Text is everywhere - in plain HTML, in PHP variables, in echo's, in the DB... Now I'm familiar with the concept of gettext and this is what i plan to use for the internationalization project of the application. However the app is not written in English and here is my question: Should I first translate everything to English while wrapping every string in gettext() function, or I can use my native language as a base? P.S. also any quick suggestions (links maybe) on making my life easier with the whole i18n project will be greatly appreciated!


Need advice for approach for a web-based app that loads excel worksheet but exposes only the charts

I'm looking for suggestions on the Visual Studio approach to take for a web application that is in the conceptual stage. My environment has a lot of tools:   * Windows Server 2008 R2 Standard 64bit   * Visual Studio 2010 Professional Edition   * Sharepoint 2010 Server Enterprise Edition   * SQL Server 2008 R2   * Office 2010 Professional I know I will need this app to retrieve data from a database (or a web service - not sure exactly at this point). The data needs to be placed in an Excel workbook dynamically. The app will need to have a nice user interface (standard web controls - perhaps with some Javascript effects). The Excel ribbon and worksheet grid will need to be hidden. Some web control(s) will cause the Excel chart(s) to be rendered. I am thinking this sounds like Visual Studio Tools for Office (VSTO) so as to leverage .Net and hide Excel. Can you offer suggestions regarding: One ASP.Net Web App Project One Class Library Project for Excel or perhaps which one of the several different Excel 2010 project types (addin, template, document) Would Excel Services for Sharepoint be useful (or required) ? I am feeling a little overwhelmed with so many choices at this early stage of conceptualizing the app. Can you suggest some ideas for this sort of thing? Also, I am a bit more experienced with C# but I've read VB.Net is better for work with the Excel object model. What are general advises with regard to tool choice and overall approach tradeoffs?


What's new in PL/I, DB2, and S/390 assembler?

I have an upcoming technical interview with a former employer that will focus on PL/I, DB2, and ISPF. The job will be with systems that I architected and wrote myself 20 years ago. The few years of professional programming that I did since then was all assembly language. The problem is that I haven't programmed professionally in 15 years, and the personal programming that I've done since then has been in other "modern" languages. My question is whether there are new features in PL/I and DB2 that I should be aware of. (When browsing through the latest "Principles of Operation" I saw machine instructions to support C style strings that weren't there in ancient times - cool.)


Separating merged array of arithmetic and geometric series

Given an array of positive integers in increasing order. Separate them in two series, an arithmetic sequence and geometric sequence. The given array is such that a solution do exist. The union of numbers of the two sequence must be the given array.   Both series can have common elements i.e. series need not to be disjoint.   The ratio of the geometric series can be fractional. Example:               Given series : 2,4,6,8,10,12,25     AP: 2,4,6,8,10,12     GP: 4,10,25      I tried taking few examples but could not reach a general way. Even tried some graph implementation by introducing edges if they follow a particular sequence but could not reach solution.


Function overloading? Yes or no

I'm developing a statically- and strongly-typed, compiled language, and I'm revisiting the idea of whether to include function overloading as a language feature. I realized that I'm a little bit biased, coming mainly from a `C[++|#]` background. What are the most convincing arguments _for_ and _against_ including function overloading in a language? * * * **EDIT:** Is there nobody who has an opposing opinion? Bertrand Meyer (creator of Eiffel back in 1985/1986) calls method overloading this: (source) > a vanity mechanism that brings nothing to the semantic power of an O-O > language, but hampers readability and complicates everyone's task Now those are some sweeping generalizations, but he's a smart guy, so I think it's safe to say he could back them up if he needed to. In fact, he almost had Brad Abrams (one of the CLSv1 developers) convinced that .NET shouldn't support method overloading. (source) That's some powerful stuff. Can anyone shed some light on his thoughts, and whether his viewpoint is still justified 25 years later?


Load Test Methodology

I'm currently writing a load test for a cache which should test how a cache will react to persistent requests. A colleague and I had differing opinions on how this load testing should be performed. I believe that a load test should be as random as possible. It should model real-world load as much as possible, and the way towards that is randomality. So I have created this random test as follows:   * Test data is held in spreadsheets and is loaded into TestRunner objects at startup      * The test data is **not** random   * The load test will run 10 random TestRunners in individual Threads at the same time   * The object returned by the cache will be tested to make sure it is sensible, it is not thoroughly tested      * Any tests that fail will be output at the end and each test has a unique ID to easily find failed tests   * At random intervals, the cache will be cleared to model the real-world requirement of the cache being cleared at any time.   * The load test will run for a configurable amount of time My colleague's idea of what a load test should do is:   * Test data is held in spreadsheets and is loaded into TestRunner objects at startup   * All TestRunner objects are run in a sequential manner   * Each time the load test is run, it will run the TestRunner objects in the same order Which methodology do you feel would produce the most reliable load test? I personally think the random test will produce a more reliable load test as it will model real-world usage. It is not known what order requests will come in when this is released to production, so it should be tested with that unknown element taken into account. However, running all tests in the same sequence each time will make any failures reproducable, which is important during testing.


8yr+ .Net developer interested in game programming - should I learn C++?

I've been writing .Net code since 2003 and so I am very comfortable with it now and have a fairly deep knowledge surrounding the .Net framework that I have built over the years, plus feel very comfortable with advanced programming concepts and programming in general. I want to get into some game programming, but the last C++ I wrote was at a beginner-to-intermediate level around 2001-2002. I know that there is a lot of support for game development in .Net languages these days, but I also know that there are a lot of game libraries, resources and commercial products built on or around C and C++. Would learning C++ at this stage be a practical endeavour for me, or would the amount of time required to become competent with C++ outweigh the productivity advantage I'd get from sticking with .Net? One of my considerations is that I'm concerned about the massive and growing impact Apple is having on the tech world and the general complacency Microsoft seems to have with winning consumer and developer mindshare these days, which leaves me wondering, if I were to focus my efforts on .Net technologies (particularly in view of the fact that the Mono team was recently laid off after Novell's acquisition), am I probably severely limiting my potential future audience for any games I create?


Reasons for separate source and generated trees

What are the reasons for putting the generated files in a tree parallel to the source trees? For example, in Eclipse I usually choose to put the sources to `.../src` and the compiler generated files in `.../classes`. _Mixing both in a single tree looks dirty to me, however I can't find any advantage in the separation_ :   * Theoretically, I could backup the sources more easily, but that's not true. I'm using git and ignoring all `*.class` files everywhere is just trivial. With other version control systems it should be very easy, too.   * Theoretically, it helps to find a given source file faster as the tree is not polluted by the class files. Actually, I seldom need it (the IDE offers much faster ways). For looking at the classes I'm using the Class View, which abstracts from the directory structure.   * Theoretically, there may be tools requiring that, but I'm not aware of any. There's two disadvantages of the separation:   * The IDE copies all non-java files ("resources") from the source tree to the generated one. If the IDE doesn't notice a changed resource, then there's an old version on the classpath (i.e., in the generated tree) and I'll find myself running a program working with the old version... this may cost me quite a lot of time.   * Once upon a time, I need to find the class-file corresponding with a given java-file (or vice versa), which takes quite a lot of time. _So what are the real advantages of the separation?_ This question is not Java (Eclipse) specific. However, in Java the problem of navigating to a parallel tree is aggravated by the fact that the trees tend to be very deep (because of the directory structure mirroring the package structure and because of the world-wide package naming convention).


Approach to simplifying an algorithm

For completely random reasons*, I wrote some code that calculates and displays the following expression: > P=1*(2+2) _(3+3+3)_ (4+4+4+4) _.._ (n+n...… Which is equivalent to `(n!)^2` The version I wrote (listed below the line) isn't terribly efficient; especially not in how it calculates the inner product. **How should I go about simplifying the algorithm so it will operate faster and be more easily understood?** And yes, I know I should use something other than `int` for the variables. That aspect of my code isn't as interesting as re-working the algorithmic approach. * In the spirit of full disclosure this off-topic question sparked my working on the code  * * *               int sequence(int n)     {       int i, accum, prod, j;            accum = 1;       for (i = 2 .. n)       {         prod = i;         for (j = 1 .. i-1)         {           prod += i;         }         accum *= prod;       }       return accum;     }


Designing a universal database driver class

I have a homebrew MVC framework that I have been using for a while, and it has been working great, but I am planning an upgrade to it for its ORM classes. So far, it only supports SQL databases by creating statements dependent on what function is being called. The ORM class includes field structure and validation, computed fields, indices and joined classes (for associations, `1-1`, `1-*`, `*-1` and `*-*`), and that provides enough functionality for selecting any data and fetching associated rows in the database. But I would like to extend it to support XML, LDAP and NoSQL databases (i.e. MongoDB). My ideas for implementing this would be to modify the functions within the ORM class to interact with a custom driver (for each database type) in a common format. Unfortunately, I haven't had enough experience with using these other formats enough to adequately design an interface class that could be used by the ORM for any type. So, are there any universal database drivers that would support all of these database types so I can learn by example? The current interface I am working by is:               interface DBDriver {       function connect($host, $un, $pw, $persist = false);       function disconnect();       function selectDB($db);       function charset($charset);       function insert($table, $values);       function select($table, $fields, $joins, $where, $group, $having, $order, $limit);       function update($table, $where, $values, $where, $order, $limit);       function delete($table, $where, $order, $limit);       function transactionBegin();       function transactionCommit();       function transactionRollback();     }      But I am concerned that although this will provide enough for creating SQL statements, it might not be sufficient, or perhaps even overkill for other methods such as XML or NoSQL.


Taking scalability to the next level. What methods can help me make sure I do the right thing?

Myself and a fellow PHP dev are starting to research a new web app that we think (hope) will have a global reach. The trouble is that, whilst we both consider ourselves capable, we are concerned with the sheer size of the potential traffic (neither of us has done anything with a reach beyond a few thousand. This site will hopefully serve millions) and wonder what we can do along the way to ensure we have tested things for scale. The site will be dependant on mass simultaneous log ins, uploads of relatively large files (3-10mb audio, >4mb images) and also streaming of audio.


Data Synchronization in mobile apps - multiple devices, multiple users

I'm looking into building my first mobile app. One of the core features of the application is that multiple devices/users will have access to the same data -- and all of them will have CRUD rights. I believe the architecture should involve a central server where all the data is stored. The devices will use an API to interact with the server to perform its data operations (e.g. adding a record, editing a record, deleting a record). I imagine a scenario where synchronizing the data will become a problem. Assume the application should work when it is not connected to the Internet, and thus cannot communicate with this central server. So:   1. User A is offline and edits record #100   2. User B is offline and edits record #100   3. User C is offline and deletes record #100   4. User C goes online (presumably, record #100 should get deleted on the server)   5. User A and B goes online, but the records they edited no longer exist All sorts of scenarios similar to the above can come up. **How is this generally handled?** I plan to use MySQL, but am wondering if it's not appropriate for such a problem.


SQL Server: When to use SSIS vs T-SQL for ETL Tasks

When should I use one versus the other? For instance, let's say I have 20 comma delimited, denormalized text files and I want to transform the data and load it into normalized SQL Server tables.


Verify uniqueness of new content

I'm working on a review site, where there is a minor issue with _almost_ duplicate reviews across items. Just a few words are changed. It would be very nice to be able to uncover these duplicates before they are approved by a moderator, and I'm hoping someone could chime in on the best strategy to get there. The site is running Ruby on Rails on a Postgres database and using Thinking Sphinx for search (all on Heroku), and so far the best option I see is to be pulling all the reviews out of the db and using a module like amatch to compare the strings. Not very efficient, so in this case I guess I'll have to limit the number/age of reviews to scan for dupes. Anyone got a better idea?


Object Identity and Mutability

I was reading a proposal for value types in Java, and I came across this sentence: "Object identity serves only to support mutability, where an object’s state can be mutated but remains the same intrinsic object." From what I understand about object identity (though I'm likely wrong, in which case please correct me), it's the idea of your variable acting as a pointer or reference to an object located elsewhere in memory (usually on the heap, a la Java and C#). So what would this have to do with object mutability? Does this imply that for example, instantiated objects on the stack in C++ are immutable? I'm having trouble seeing the link here.


What's the best way to use requestAnimationFrame and fixed frame rates

I recently got into using the HTML5-`requestAnimationFrame`-API a lot on animation-heavy websites, especially after seeing the **Jank Busters** talk. This seems to work pretty well and really improve performance in many cases. Yet one question still persists for me: When wanting to use an animation that is _NOT_ entirely calculated (think spritesheets for example) you will have to aim for a fixed frame rate. Of course one could go back to use `setInterval` again, but maybe there are other ways to tackle this. The two ways I could think of using `requestAnimationFrame` with a fixed frame rate are:               var fps = 25; //frames per second          function animate(){             //actual drawing goes here        setTimeout(function(){           requestAnimationFrame(animate);        }, 1000 / fps)          }          animate();      or               var fps = 25; //frames per second          var lastExecution = new Date().getTime();          function animate(){              var now = new Date().getTime();              if ((now - lastExecution) > (1000 / fps)){             //do actual drawing             lastExecution = new Date().getTime();         }              requestAnimationFrame(animate);          }          animate();      Personally, I'd opt for the second option (the first one feels like cheating), yet it seems to be more **buggy** in certain situations. Is this approach really worth it (especially at low frame rates like 12.5)? Are there things to be improved? Is there another way to tackle this?


Sqlite3 slow on standard queries, is it expected?

Using Python and sqlite3. This simple print loop takes a few seconds to execute. I don't know much about databases, so I'm guessing I'm not using these queries correctly. Surely sqlite should be faster? The entire db has 5k or so rows and just a few columns if that matters.               con = lite.connect('gamelist.db')     with con:         cur = con.cursor()         cur.execute("SELECT * FROM GameList WHERE processed IS NULL LIMIT 4")         for i in range(0, 4):             print cur.fetchone()


Should controls on a form be prepared in a separate class?

I have a form with several controls on it. Every control has to be declared in the class, formatted in the constructor (-size, location, event subscription etc), and its event-handlers declared, again, in the class. This is getting a bit unorganized, so I was thinking of refactoring this. For every control: Preparing a class which derives from that control-type (which will include location, event-subscription and event-handlers, etc.), and then using an instance of it. Am I going to run into any trouble doing this?


MIT License Question (download somebody else's code and throw it on github)

Sometimes I use plugins and 3rd party libraries, and one thing that drives me crazy is when these libraries are not versioned. So, if I download it, make some mods to it, I am the only person in the world who can benefit from it... well, until I version it myself. My question is simple: if a library I find online has an MIT License, would it violate the license if I download it, modify it, and put it on github? I'm not trying to pass it off as my own, I'm just trying to help the community benefit from my work. A lot of libraries are pretty nice, but for some reason they aren't versioned... Thanks!


NSNotificationCenter vs. Protocol

I am using `MPMoviePlayerController` in a project. The `loadState` of the `MPMoviePlayerController` object is observed using `NSNotificationCenter`. Why did Apple choose `NSNotificationCenter` in this situation instead of using delegation?


Does OOP fulfill the promise of code reuse? What alternatives are there to achieve code reuse?

Perhaps the greatest promise of using object-oriented paradigm is the code reuse. Some dispute that this was achieved. Why was it (not) achieved? Does code reuse as OOP defines it, make projects more productive? Or more manageable? Or easier to maintain? Or with more quality? Probably we all agree that code reuse is a good thing, but there are several ways to achieve this goal. The question is about the method of code reuse offered by OOP. Was it a good thing? **Are there better methods to achieved code reuse** than object orientation, sub-classing, polymorphism, etc.? What ways are better? **Why**? Tell us your experience with OOP reuse or other paradigms reuse.


Submitting Résumé To Bolster Bids on Side Projects While Employed

A friend is bidding on a IT project, and he needs to include my résumé with his response to the bid; I'm the "Subject Matter Expert." I will be helping him outside of my regular working hours. How do folks in the IT field handle such résumé submissions? First of all, I don't want to include (or exclude) anything that would be misleading or untrue, but my concern is that in my field people know each other and I don't want my current employer finding out that I have submitted a résumé with another company especially when I am not an employee of my friend's company. All in all, I want to avoid the awkwardness of my employer finding out (and the worse of whatever that might lead to), yet balance that with helping a friend. So my question is, what should I leave out or retain? What is appropriate? Thanks!


What did programmers do before variable scope, where everything is global?

So, I am having to deal with seemingly archiac language (called PowerOn) where I have a main method, a few datatypes to define variables with, and has the ability to have sub-procedures (essentially void methods) that does not return a type nor accepts any arguements. **The problem here is that EVERYTHING is global.** I've read of these type of languages, but most books take the aproach _"Ok, we use to use a horse and cariage, but now, here's a car so let's learn how to work on THAT!" We will NEVER relive those days"_. I have to admit, the mind is struggling to think _outside of scope and extent_. Well here I am. I am trying to figure out how to best manage nothing but global variables across several _open_ methods. Yep, even iterators for `for` loops have to be defined globaly, which I find myself recycling in different parts of my code. My Question: for those that have this type experience, **how did programmers deal with a large amount of variables in a global playing field?** I have feeling it just became a mental juggling trick, but I would be interested to know if there were any known aproaches.


Correct comment to put for boolean function arguments that are "false"?

From some open source projects, I gathered the following coding style               void someFunction(bool forget);          void ourFunction() {       someFunction(false /* forget */);     }          I always have doubt about what `false` means here. Does it mean "forget", or does the "forget" refer to its corresponding parameter (like in the case above), and "false" is meant to negate it? What style is used most often and what is the best way (or some of the better ways) to avoid the ambiguity?


Managing setTimeouts and setInterval in a distributed environment

I am building a turnbased game on nodejs using socket.io and redis as the datastore. I am planning on hosting the game on AWS opsworks with the ability to scale by adding more nodes. How should I structure the application so that I can have `setTimeout` like behaviour to work correctly in the event that the node that triggered the `setTimeout` goes under for some reason? My initial plan is to have every setTimeout get stored in redis under a sorted set, with the score of the event as the unix timestamp that it should get executed in. I see 2 major problems with this approach that I am not sure how to tackle:   1. The time of the node that reads the event may not necessarily be in sync with the time of the node that stored it, causing events to fire earlier or later than they were supposed to. I'm not sure how big a problem this might be as a quick googling reveals that the drift will be minimal at worst, but I lack any practical experience to make a judgement call on this.   2. There is no way for any of the 'worker' nodes to know that there might be a task due so they would have to poll redis every second to see if there is a task that they can handle. The ideal solution for this would be a publish/subscribe that has a delay built in but this does not seem to be straight forward to implement either. Any advice on how to solve this is much appreciated!


Decision making process within a Scrum team

Two questions:   1. I assume that when Scrum coaches say "the team should decide" they mean there has to be a consensus decision process usually facilitated by the Scrum Master?    2. What if there is a disagreement between members of the Scrum team on the way to develop/design some feature and a consensus cannot be reached, who decides? The Scrum Master? The system architect? The funcional manager? Thanks.


What's a good way to make sure that locally serialized data can be deserialized in newer code?

Context: I'm working on an HTML 5 game without persisted state. Every time you refresh the page, you start at the beginning. People are requesting that they can start where they left off if they leave the page. I plan to implement this as Local Storage. The thing that makes apprehensive about this is a new kind of bug I'll have to consider: If you come back and there's a newer code, it may not be able to deserialize the storage. As an example, the state when serialized may have looked like this:               {       foo: "bar"     }      But when the player tries the game next month, that field doesn't even exist anymore and has been broken up into two fields with a completely different type. This is bound to happen, and I think I know how to fix this: I'll put a version number in the data, and when I release version y of the app, I'll have to write code to migrate from version x state to version y state. If I release version z of the app, I'll have to write code to migrate from version y to version z. I'll probably call this logic after deserialization. But that's not what this question is about (although if there's a flaw in my approach, I'd want to hear it). What I want to know is: **How do I automate something (possibly a test) that tells me _when_ I need to write a migration script and _when_ I need to change the data's version number?** I feel automation is the key here, because things will go very wrong if I make a mistake and remembering to change a version number / write a migration script will be the last thing on my mind when I just finished that shiny new feature I want others to see. * * * An interesting (but perhaps irrelevant) realization: All these issues go away if I store the data on _my_ server in a database with a schema. That lets me confidently know that all the data is in the right state (if my schema is good). The problem with persisting locally is I lose control of the data and _when_ it gets migrated. * * * This question is similar but different to this one. The difference is I'm concerned primarily with automation and s/he's not and we're using different languages (seeing how the accepted answer is a Java library, that makes it irrelevant to me).


Intel Nehalem/SB/IB/Haswell CPUs, cache vs TLB

On the Nehalem+ architecture Intel CPUs what is the interaction between the L1 cache, L2 cache, L1 DTLB and L2 DTLB? On all the images I have found there isnt a clear explanation whether the CPU looks at the L1 DTLB first, then goes to the L1D cache, or whether it only goes to the L1 DTLB cache if there is a cache miss in the L1D or the L2 cache?


Are there any languages built to facilitate implementing design patterns?

Often it is not obvious how to implement a given design pattern in a language. Sometimes it is difficult or cumbersome. Are there any languages built to make using design patterns easy and effective?


Mental Models or Real-World-Metaphors for Functional Programming

Does anyone have a good mental model or metaphor for functional programming which references something in the real world? Object Oriented programing intuitively makes sense to me. There are things that have properties and sometimes they also can do stuff or perform calculations on their properties (methods). (Ex: Car, Shape, Cat). I bear functional programming no ill will whatsoever and I am not interested in a debate about the virtues of the two. I just need a metaphor or mental model to work with as I have with Object Oriented programming. What are some good mental models or real world metaphors for programming in a functional paradigm? There is something about functions composed of functions processing functions which leaves one without a firm place to stand and cogitate.


How to support the sales team and avoid the "Often the sales team gets us into trouble just to get a commission" problem

With reference to this answer: > At the end of the day, we are delivering a product to a paying customer. > This customer has needs and expectations, realistic or not. Often the sales > team gets us into trouble just to get a commission. I realise there are processes (mainly with communication and project managment) that can help minimise risk (these seem to have minimal impact, mainly due to being ignored by anyone other than dev) and believe a percentage of the problem is their complete lack of technical understanding rather than greed (though this does play a part). But when it isn't possible to get rid of commissions (very good article), get (train) better salesmen, or increase dev resources, how can you minimise the impact on developer moral, timelines and generally development department being held responsible? How common is this damaging to the business (and no one higher up will believe how much better it could be - they don't see any problem now, but wonder why sales fall through and customers aren't happy) and how do others mitigate the risk, prove development is not the issue and handle such situations where the marketing is too aggressive and overselling is normal (which all propagates from the top)? How can you support the sales team and upper management to improve the root cause of this situation and what changes can be implemented in dev department to help with this? Additional information: the is only one product we create and as such is sold with additional functionality as required or work to let it integrate with existing systems. I was worried about close votes, but this is a very real problem (and I have tried to word it objectively)- if you can comment on how to improve this question, please let me know.


How to avoid too much html in JQuery?

I'm not liking how my JQuery is after making some dynamic buttons, or other dynamic things. For example, when I have checkboxes marked, I add a button that is called "Download Selected" and "Remove Selected". Of course, there are many more JQuery + HTML things in my site. I'd like to know how I can make my code better, not spaghetti looking. Thanks a lot!                 $(document).on('change', '.docListCheckbox', function(event){         if( $('#resultsContainer').find('.docListCheckbox:checked').length > 0 )         {           if( ! $('#download-sel').length > 0 )           {             var downSelectionBtn = '<button id="download-sel" class="button-small button-blue" type="button">DESCARGAR MARCADOS</button>';             var delSelectionBtn = '<button id="delete-sel" class="button-small button-red" type="button">ELIMINAR MARCADOS</button>';             $('#selection-controls').append(downSelectionBtn);             <?php if( SwHelper::checkAccess('Docusearch.Documento.Eliminar') ): ?>             $('#selection-controls').append(delSelectionBtn);             <?php endif; ?>           }         }         else         {           if( $('#download-sel').length > 0 )           {             $('#download-sel').remove();             <?php if( SwHelper::checkAccess('Docusearch.Documento.Eliminar') ): ?>             $('#delete-sel').remove();             <?php endif; ?>           }         }       });                $(document).on('click', '#docActionEdit', function() {         var button = $(this);         var isToggled = button.data('toggled');         $('#docDataEditor').slideToggle({           duration: 1000,           easing: 'easeOutBounce',           start: function(){             if(isToggled == 'false') {               button.html('EDITAR');               button.data('toggled', 'true');               $('#docActionSave').remove();             }             else {               button.html('CANCELAR');               button.data('toggled', 'false');               $('#docAvailableActions').prepend('<button id="docActionSave" class="button-small button-green">GUARDAR</button>');             }           }         });       });


Why is the json format necessary over the normal javascript object format?

Before you answer, yes I know that other languages have no native javascript object support, but neither do they have native support for json. So wouldn't it make much more sense to modify the json spec to allow identifiers without "" and allow comments? Very sensible things because you don't have to serialize/deserialize when working in javascript, no?


How strict should you be about indentation/white space?

Our development process is as follows code the task -> someone else QAs code and documentation -> task is merged into trunk. Recently a colleague is refusing to pass the code QA due to issues with indentation and whitespace. Here are examples of these issues (syntax is SAS): Additional whitespace:                       %if &syserr gt 0 %then %goto err; /*last line of code*/                         /* Footer area*/      Extra line of white space, and not indented inside proc sort:                /* End Of header * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */                   proc sort data = %dataset ;         by id;          run;         %if &syserr gt 0 %then %goto err;               proc sort data = &second_dataset.;         by id;         run;          %if &syserr gt 0 %then %goto err;       Extra white space between steps:                       /*join all details on for each record*/             proc sort data = &data out = data_srt ;                    by &conditions;              run;             %if &syserr gt 0 %then %goto err;                  proc sort data = &data2.;                   by &conditions.;             run;              %if &syserr gt 0 %then %goto err;                                  /*cartesian join*/             data new_data;                   join data                                &data2.  ;                   by &conditions;                   run;      The question is, being a good programmer, is looking over your code and correcting all this kind of thing the right thing to do, or is this just ridiculous? There is an additional complication, that because we don't have continuous integration or automated testing, it's not possible for the QAer to quickly fix up these issues and commit the code, for risk of accidentally deleting semicolon or something. (To be fair, the risk applies to the initial developer making these changes, so either way if this mistake occurs, it just needs to be fixed and move on).


why c++11 define closure as a process of capturing variables

when using closure in other languages, it just feels nature, variables from outer scope are captured automatically , without the need of declaring such captures. in c++11, good to see we have closures, but why they make it so uncomfortable to work with, not only have to declaring the capture, but also read write controls? not likely implementation considerations, but what kind of philosophy is leading to this awkward spec ?


Web pages in UML sequence diagrams?

In my current project, we have an ongoing discussion about whether or not it's a good idea to include an artifact representing a web page in an UML sequence diagram for a web application, making explicit which page starts a business interaction. I think it's a bad idea to include a web page, for me a sequence diagram should be about business logic and the interactions between business objects, and not include presentation concerns such as web pages. If I were to include a web page it'd be in a navigation diagram. Also, in my experience I had not seen web pages included in sequence diagrams, up until now. What's the recommendation/best practice on this? Should we include an artifact representing a web page in each of our sequence diagrams, or not? **EDIT :** It'd be ideal if the answers quoted design/modeling guidelines, books on UML, etc. arguing in favor or in opposition to including presentation artifacts in UML design diagrams. So far I haven't found an authoritative source that I can quote on the subject, instead of personal opinions.


Are there any downsides or problems with Haskell?

I'm looking at diving into Haskell for my next (relatively trivial) personal project. The reasons that I'm tackling Haskell are:   1. Get my head into a purely functional language   2. Speed. While I'm sure this can be argued, profiling that I've seen nails Haskell close to C++ (and seems to be quite a bit faster than Erlang).    3. Speed. The Warp web server seems to be crazy fast in comparison to virtually everything else. So, given this, what I'm looking for are the downsides or problems that come along with Haskell. The web has a tremendous amount of information about why Haskell is a Good Thing, but I haven't found many topics about its ugly side (apart from gripes about its syntax which I don't care about at all). An example of what I'm looking for could be like Python's GIL. Something that didn't rear its head until I really started looking at using concurrency in a CPython environment.


Unevenly distributed random number generation

Let's say I have to generate random number from 1 to 100, however, the probability of each number is not 1/100, but a predefined probability. How to generate that number? I use Ruby/Python.


Building workspce using Ojdeploy on linux

I am having a java application created using Jdeveloper. I want to build the workspace on linux machine using ojdeploy instead of Jdeveloper IDE. But for that I need to add 3rd party jars like hibernate. I am using putty to access the machine. so I want to know how to add third party libraries without using IDE. Thanks


How to handle lookup data in a C# ASP.Net MVC4 application?

I am writing an MVC4 application to track documents we have on file for our clients. I'm using code first, and have created models for my objects (Company, Document, etc...). I am now faced with the topic of document expiration. Business logic dictates certain documents will expire a set number of days past the document date. For example, Document A might expire in 180 days, Document 2 in 365 days, etc... I have a class for my documents as shown below (simplified for this example). What is the best way for me to create a lookup for expiration values? I want to specify documents of type DocumentA expire in 30 days, type DocumentB expire in 75 days, etc... I can think of a few ways to do this:   1. Lookup table in the database I can query   2. New property in my class (DaysValidFor) which has a custom getter that returns different values based on the DocumentType   3. A method that takes in the document type and returns the number of days and I'm sure there are other ways I'm not even thinking of. My main concern is a) not violating any best practices and b) maintainability. Are there any pros/cons I need to be aware of for the above options, or is this a case of "just pick one and run with it"? One last thought, right now the number of days is a value that does not need to be stored anywhere on a per-document basis -- however, it is possible that business logic will change this (i.e., DocumentA's are 30 days expiration by default, but this DocumentA associated with Company XYZ will be 60 days because we like them). In that case, is a property in the Document class the best way to go, seeing as I need to add that field to the DB?               namespace Models     {         // Types of documents to track         public enum DocumentType         {             DocumentA,             DocumentB,             DocumentC // etc...         }              // Document model         public class Document         {             public int DocumentID { get; set; }                  // Foreign key to companies             public int CompanyID { get; set; }                  public DocumentType DocumentType { get; set; }                  // Helper to translate enum's value to an integer for DB storage             [Column("DocumentType")]             public int DocumentTypeInt             {                 get { return (int)this.DocumentType; }                 set { this.DocumentType = (DocumentType)value; }             }                  [DataType(DataType.Date)]             [DisplayFormat(DataFormatString = "{0:MM-dd-yyyy}", ApplyFormatInEditMode = true)]             public DateTime DocumentDate { get; set; }                       // Navigation properties             public virtual Company Company { get; set; }         }     }


Distributing PC software without a website

I am trying to distribute a small PC program, but have run into a few problems. I first tried to upload it to cNet, and then to softonic, but the problem with these sites, and all that I have seen like them is that they require a direct link(which I can't get, see below). After running into that problem, I simply uploaded my software to a file sharing site, but in reality, very few of my current users(from a mobile version)installed my software because once downloaded was listed as dangerous by the anti-virus due to the website that it was downloaded from. So then I set about trying to find a download website that would give me a direct link, but unsurprisingly, I can't find that. I can't host the file myself, because I don't have a webpage. Even though I haven't found any, I would be fine with a site that hosts my software and doesn't require a direct download link to use. Or I would be fine with a site that would give me a direct download link. I'm interested in an answer to the general problem - distributing software without a website. I assume that not everyone who has ever released software has their own webpage, what is the best way to get around this?


How do I go from "here's the zip" to a good release strategy?

I can write code, resolve dependencies, and get my program to run on _my_ computer; I have no idea where to go from here though. How do I get the software ready for distribution? The school environment has taught me to do a few random tests by hand, make sure nothing is obviously broken, then throw all the source files into a zip and send it off. This is all that's needed to get a good grade is most CS courses. Nobody taught me how to release to real users. The only clues I have are a few phrases like "automated builds" and "continuous integration", but I don't know what these mean. How can I properly distribute my work? How can I make it easy for others? How can I move beyond "here's the zip" releases?


Heuristic for consistiently ordering points in a a plane

I have rectangular regions in a plane. I want to consistently order them in a human-friendly way that a typical y-x sort won't work for. Basically I want (0,0), (1,0), and (0,1) to sort the same as (0,0), (1, -0.1), and (-0.1, 1). Ideas? * * * _From comments:_   * The obvious answers, y-x and x-y sort, result in different orders for the short example I posted. The things I'm coming up with, now, are clustering approaches where I cluster the y values, sort by cluster y means, then by x. > Question: What are you sorting your rectangles for? Searching? Displaying?   * Numbering the regions, and I want two region sets a human would say are nearly identical to get numbered identically.  > Question: Is the orientation of the rectangles really important (what is the > difference between (0,1) and (-1,0) in the problem domain)? Would primarily > sorting by area or diagonal be ok?   * I can't tell the orientation of them beyond portrait or landscape, and size doesn't work because a lot might be practically the same.


OAuth alternative for a 2 party system

I'm writing a RESTful service (Java EE, Jersey) and a client application that communicates with it, and I wish to secure it and store any usernames & passwords dedicated in my own database. I do not want the client to store the username and password locally, not in any form such as base-64 or other encoding at all, I rather have something like the OAuth2 authorization system, where the client app only stores a refresh & access tokens after the resource owner signed-in, but I do not need to provide access to 3rd party services. Securing my service using Basic auth means the client app has to store the password and send it for each future request, so that's not what I need. I'm aware that OAuth is intended for different situations, where there are more than just 2 parties involved (see other question). as mentioned here https://blog.apigee.com/detail/when_to_use_oauth: `OAuth is the only realistic choice for a web application that itself uses another web application's API on behalf of the user. For instance, consider a web application that integrates with Twitter. (Perhaps it's a geolocation app like Foursquare that offers the ability to tweet where you are and what you're doing.)` So what is the correct standardized method to secure my RESTful service if I do not wish to re-invent the wheel and create my own auth method, and if "Basic" is not what I need because it forces me to store the credentials locally on the client, and OAuth is probably an overkill with it's 3rd party access nature. P.S- I do wish to provide users with an option to sign-in to my service using facebook or open-id, but that's another story I guess.


Does RSI qualify for a disability? Are you killing your career if you do?

My RSI has gotten pretty bad now. I'm still in school and thought about applying for a grant based on disability. Is this a bad idea in terms of it being seen as incapable of doing a job after I graduate? Will people see "oh, you have RSI.. and a permanent disability app.. I don't want to hire that poo-poo head." students with permanent disabilities I know it is possible to recover, but the fact is if you're a programmer, you're going to fight it your whole life.


Is it worth trying my IT experience in a totally different domain?

I have a good breadth of experience now (over a dozen) primarily as a dba,developer, BI admin, data analyst. I started my career in a couple of startups and now for a big internet company. The culture has always been interesting, fast-paced and just constantly moving. Recently, a family member of mine asked if I would be interested in taking my experience to his company (an established Oil & Gas). There's an opening for a database developer position there. The hiring manager liked my quals and has asked me to come in for an interview. Not having experience in this domain, the opportunity seems to be intriguing to work with data in this domain. It sounds like the culture is much slower- paced, but there is stability. People who have worked there for years. This is primarily a windows shop using .NET, Sybase, SQL server. Almost all my experience has been on unix/linux platforms with oracle, mySQL, open source tools. Given my experience thus far described, would this be an opportunity worth trying? Going essentially from an internet domain to a manufacturing company? Anyone experience this transition? I'm thinking there might be a good growth opportunity in the manufacturing company. There is also a chance I can obtain security clearance which could lead into other opportunities as well.


Automation at GUI or API Level in Scrum

I am a Automation Engineer. I use QTP for Automation. I wanted to know couple of things.   1. In a scrum Project which has 2 weeks of work, how can complete automation be done in that time frame (talking only about the GUI Level)?   2. Similarly, how can API Level of automated testing be accomplished, especially inside a single sprint? And what exactly is API level testing?   3. How to begin with API Testing? I assume QTP is not the tool here certainly.


How do I find UI ideas for a reporting system

I am developing an OS reporting system for PHP, it's main emphasis is right now on the server side of things.   I am trying to look for examples of good UIs for reporting systems. The problem: there are dozens of reports, each linked to the other, how do you navigate between them? How do you know the path you took to get to a specific report etc. Any examples out there?


What is the point to namespaces in branches in git?

So I mainly use Mercurial for my projects and I decided to sit down and learn all Git's shenanigans to discover if I'm in the right side (at least for me). I'm learning that git uses namespaces for branches and I would like to know (in your experience) what is the point of namespaces?. In Mercurial I could just set the convention of naming branches like so:               <branch name> //for "origin" branches     <username>/<branch name> //for user branches      I imagine that there is more to it than just the name (aside from avoiding naming conflicts), but what do I get out of this seemingly more complicated (not necessarily bad) model?


Is the Dart philosophy compatible with testability and dependency injection?

One of the Dart criticized features are named and factory constructors. There are opinions (from dependency injection people), that constructors should be simple and just assign some fields and the object graph creation is a responsibility of factories. There are also some argues against the static methods. It seems, that Dart constructors bring complexity to constructors. You can not even have a lot of named constructors to create the object in a various ways, you can even have a static factory supposed to construct object of other type than the class it is in. So, what is the philosophy of Dart and how does it relate (or respond) to the Dependency Injection and no-static state philosophies?


Can you apply agile/TDD in all circumstances?

I'm not against agile/TDD and use it under most circumstances. However, in some circumstances I feel it doesn't work well. For example, the other day I was building a fairly complex data processing app. In an ideal world I'd layout the foundation, design the components, write unit tests and demo on each sprints as I finish "features". In practice however, I don't think this works before the first version is released because:   * **The foundation/component design changes frequently as I figure out how to do things better, and simple test drivers are much more useful than richer unit tests**   If you are building a MVC app., the foundation isn't going to change, but with an app. where you more or less build the framework yourself, and don't quite know how to do things best beforehand this isn't the case. I feel simple test drivers with no automated verification are much more useful than richer unit tests at this stage.   * **Until the basic infrastructure is in place, it's hard to break down things into individual "features"**   If you already have an MVC framework, this is easy. But imagine how the the first MVC framework ever was developed. It must have been much less useful to think things as individual "features" in the initial stages, because the most important thing was to work out the principle and philosophy of separating Model, View and Control, and how to do that.   * **Demos help very little until a sizable part of the app. is done**   In a UI, you can just put up a mocked up interfaces and get lots of valuable feedback. However, e.g. in a web crawler, you can't really do a meaningful demo to non-technical people until quite a bit is done, and even if you did, they usually won't be able to give useful inputs anyway. Sure, you can demo to your developer colleagues, but it's hard to give input based on some log output. It's usually much more productive to explain how you did things and how you plan to do things perhaps showing illustrations and code, and get feedback this way. Or am I just doing it wrong?


Is RESTFUL API as back-end service one of the best (or suitable) choice for Mobile App?

I have a background on .NET development, recently I was asked to code back-end service for a mobile app. I had experiences on MVC, and now I'm trying to understand more on Restful Web API. My questions are: Is Restful API as back-end service one of the best (or suitable) choice for mobile app? What is the common solution for mobile app back-end service nowadays? **Edit** : (about off-topic) I read this before I ask this question. > If it's related to higher level programming concepts or is conceptual (but > still related to programming), it should be on Programmers. This is not a question about **recommend a tool, library or favorite off-site resource** **I asked about**   * if restful web API suitable for creating mobile service    * what are the common solutions to build mobile app API


Is experience very important when hiring/being hired in your country?

In the Indian IT industry, I have found that regardless of the candidate's skill level, filtering is done based on number of years of experience. I have found that people with 5 years of work experience have appalling programming skills, general aptitude and intelligence. They are mostly people who did non-CS courses in college but not necessarily (sadly). I think years of experience is a very marginal and unreliable indicator of the person's skill level. A person could have spent 5 years as a programmer doing mediocre to substandard work. But they are still considered a valuable candidate given the "experience certificate" they can produce. But that's the reality in India. What is the general practice in the US and other countries? Do recruiters filter based on years of experience? If you are a recruiter and you understand the practice of filtering based on years of experience can you explain the logic behind this? Edit: While I agree that experience trumps added qualifications (in terms of degrees), I don't think YEARS of experience - a document stating the same - is a reliable indicator of skill or maturity. That was my question. Indian IT recruitment works on certificates. I don't mean unheard of companies that trade on the sole fact that $1 = Rs.45. I've found this in companies like Oracle! The experience certificate qualifies you or doesn't for an interview. Sure I GUESS you don't want to put a fresh out of college for a project management position. Even there I am no certain how heavily should experience weigh in qualifying candidates for consideration for recruitment.


ado .net connected and disconnected classes?

## Pros and cons and Usage I have been preparing myself for an interview for the post of software developer in .net platform. For database related issues, I have to to a point about the connected ans disconnected classes of ADO .NET. I have read several articles but still not getting a perfect picture of those two terms. Hence, here I am, to the best place to get a concrete ans. Can any one explain me the pros and cons and the usage scenarios?


What are the disadvantages of automated testing?

There are a number of questions on this site that give plenty of information about the benefits that can be gained from automated testing. But I didn't see anything that represented the other side of the coin: what are the disadvantages? Everything in life is a tradeoff and there are no silver bullets, so surely there must be some valid reasons not to do automated testing. What are they? Here's a few that I've come up with:   * Requires more initial developer time for a given feature   * Requires a higher skill level of team members   * Increase tooling needs (test runners, frameworks, etc.)   * Complex analysis required when a failed test in encountered - is this test obsolete due to my change or is it telling me I made a mistake? **Edit**   I should say that I am a huge proponent of automated testing, and I'm not looking to be convinced to do it. I'm looking to understand what the disadvantages are so when I go to my company to make a case for it I don't look like I'm throwing around the next imaginary silver bullet. Also, I'm explicity _not_ looking for someone to dispute my examples above. I am taking as true that there _must_ be some disadvantages (everything has trade-offs) and I want to understand what those are.


Is .Net memory hungry?

A friend of mine told me that .NET Framework is memory hungry and he gave me an example that if I make an application (in .NET web forms) which will take 20 mb of your RAM, it will be actually wasting 1.5 MB This means that it will leak 15 mb for 200 MB application which is way too much. Is it true? Can anyone provide me any links which describes it?


Alternative for Access+SQL Server for enterprise projects

We're a small software company, developing projects for manufacturing facilities about analysis, traceability, reporting etc. We're using Access for front end, SQL Server for back end. We've quite big customers too and our company is growing. So far it is working fine but I wonder should we move to more influential technologies, such as web based solutions. What do you think about the future of Access?


How can documentation writing be made less unpleasant?

What makes writing documentation unpleasant for some people, and what can be done to make it less unpleasant? Current thoughts:   1. Ensure the program being described makes sense (eg doesn't have too many fudges or +1s or -1s in it). You feel bad, and it's more difficult, describing a program that doesn't make sense!   2. Conquer your fear of writing. Improve your writing skills, possibly on pleasant tasks.


Are there any major alternatives to Waterfall and Agile?

I am curious if anyone knows of any methodologies that are significantly different (not a recombination) and I would especially appreciate anyone who brought forward any experience with alternatives.