Is this book a reliable source for beginning Java EE?

Core Servlets and Javaserver Pages: Core Technologies, Vol. 1 (2nd Edition) Can I rely on this book to learn Servlets and JSP,or is there a better book out there I should be reading instead?


What semantics should be used when referring to waterfall and agile methodologies

I've just been involved in a debate regarding semantics of how to define approaches to the software development lifecycle. As far as I have been concerned, waterfall and agile are not methodologies, they are vaguely defined approaches/models. The definition of a methodology being a set of tools and techniques used to exactly define the steps taken to develop a successful software project. In my understanding, the following statements are true: -   * SSADM (Structured System Analysis and Design) is a waterfall methodology   * Scrum is an agile methodology   * XP is an agile methodology Thus, it would not make sense to write: -   * Waterfall is a waterfall methodology   * Agile is an agile methodology Since you would get into a recursive mess. The issue is, whenever I get into this debate with anyone, they seem to be certain that waterfall is a methodology and so is agile. An example of what I see as being incorrect is the following article: - http://en.wikipedia.org/wiki/Software_development_methodology > Methodologies Waterfall Prototype model Incremental Iterative V-Model Spiral > Scrum Cleanroom RAD DSDM RUP XP Agile Lean Dual Vee Model TDD FDD DDD These are listed as methodologies on the wikipedia page and I find that this is just plain wrong. Can someone please correct me and/or let me know what terminology I should be using?


Why Microsoft’s Web API is named as ASP.Net Web API

ASP.Net is Active Server Pages using .Net Framework Wikipedia says > It was first released in January 2002 with version 1.0 of the .NET > Framework, and is the successor to Microsoft's Active Server Pages (ASP) > technology. While answering this question following thought came to me – why Microsoft named it’s Web API as “ASP.Net Web API”. There are no `Pages` involved in Web API. Then why do some people call it as “Active Server Pages .Net Web Api” ? I believe there are some `fundamental features` of ASP.Net shared with Web API. So what are they? Another observation - why is the tag in `programmers` naming it as "asp.net- mvc-web-api"? **Reference** :   1. ScottGu's Blog- ASP.NET Web API


How does Elastic Search approach the problem of distributed membership and consensus?

I already understand that Elastic Search is supposed to be deployed in a distributed topology, in that you can have multiple nodes for a cluster of ES instances. I like the API, and it looks promising. But I wonder how Elastic Search solves some standard problems in distributed computing. My "architectural" questions are motivated out of trying to understand whether I ought to commit to using the product. Consider membership problem: If I add a node to the cluster, how does Elastic Search cluster know to add that node wants to join? Or what if a node goes down (or the network to the data center it is in) gets too flaky. Is it using some sort of gossip protocol like Amazon Dynamo does? Consider the consensus problem: if I POST a document to one node to the cluster, how does the change get propagated to the other nodes? Of course, I understand that the document has to be indexed, so I cannot expect a search query to find it immediately. Does ES use a Paxos algorithm? Raft algorithm? N.B. if someone could tag this question as "elasticsearch" I'd appreciate it!


Which licenses are free for commercial use?

I'm lost in a mass of licences - GPL, LGPL, Creative Commons, BSD, Apache, etc, and looking for a beginners guide. When using a component under a popular licence like these, what are the restrictions for using them without paying in a commercial product? E.g.   * do I have to redistribute the source?   * do I have to credit them?   * what if I modify the component? etc. From what I can tell from http://www.codeproject.com/info/Licenses.aspx, only GPL and Creative Commons force you to redistribute source?


Is an 8 second (incremental) build time common?

My current project takes 8 seconds to build one C++ file. Is this common? Other files take 12-15 seconds but most at the moment are about 8 seconds. I use Visual Studio to tell me the time. I have gone into the headers and removed things I didn't need and used forward declaration. It did save me about 2 seconds per file and one header takes about 4 seconds to go through alone. In that header I need all its declarations and using a lite version which removes private methods public functions I don't need. Should I be happy it's 8 or so seconds or is that too long to compile one file?


Planning software development

I'm fairly new to programming (still a student), and I haven't had much experience with planning out my software development. Usually if it's a large project, the profs break it up into steps for me. If it's smaller, I usually just dive right in. This has worked so far, but I'd like a better process. I'm planning to do a rather ambitious project, and I'm worried that my code will turn out a mess and/or take a lot longer than if I had planned it properly. I'd like a method/technique/advice for planning out my software development.


Why was the first compiler written before the first interpreter?

The first compiler was written by Grace Hopper in 1952 while the Lisp interpreter was written in 1958 by John McCarthy's student Steve Russell. Writing a compiler seems like a much harder problem than an interpreter. If that is so, why was the first compiler written six-years before the first interpreter?


Merge sort versus quick sort performance

I have implemented merge sort and quick sort using C (GCC 4.4.3 on Ubuntu 10.04 running on a 4 GB RAM laptop with an Intel DUO CPU at 2GHz) and I wanted to compare the performance of the two algorithms. The prototypes of the sorting functions are:               void merge_sort(const char **lines, int start, int end);          void quick_sort(const char **lines, int start, int end);      i.e. both take an array of pointers to strings and sort the elements with index i : start <= i <= end. I have produced some files containing random strings with length on average 4.5 characters. The test files range from 100 lines to 10000000 lines. I was a bit surprised by the results because, even though I know that merge sort has complexity O(n log(n)) while quick sort is O(n^2), I have often read that on average quick sort should be as fast as merge sort. However, my results are the following.   * Up to 10000 strings, both algorithms perform equally well. For 10000 strings, both require about 0.007 seconds.   * For 100000 strings, merge sort is slightly faster with 0.095 s against 0.121 s.   * For 1000000 strings merge sort takes 1.287 s against 5.233 s of quick sort.   * For 5000000 strings merge sort takes 7.582 s against 118.240 s of quick sort.   * For 10000000 strings merge sort takes 16.305 s against 1202.918 s of quick sort. So my question is: are my results **as expected** , meaning that quick sort is comparable in speed to merge sort for small inputs but, as the size of the input data grows, the fact that its complexity is quadratic will become evident? Here is a sketch of what I did. In the merge sort implementation, the partitioning consists in calling merge sort recursively, i.e.               merge_sort(lines, start, (start + end) / 2);     merge_sort(lines, 1 + (start + end) / 2, end);      Merging of the two sorted sub-array is performed by reading the data from the array `lines` and writing it to a global temporary array of pointers (this global array is allocate only once). After each merge the pointers are copied back to the original array. So the strings are stored once but I need twice as much memory for the pointers. For quick sort, the partition function chooses the last element of the array to sort as the pivot and scans the previous elements in one loop. After it has produced a partition of the type               start ... {elements <= pivot} ... pivotIndex ... {elements > pivot} ... end      it calls itself recursively:               quick_sort(lines, start,          pivotIndex - 1);     quick_sort(lines, pivotIndex + 1, end);      Note that this quick sort implementation sorts the array in-place and does not require additional memory, therefore it is more memory efficient than the merge sort implementation. So my question is: is there a better way to implement quick sort that is worthwhile trying out? If I improve the quick sort implementation and perform more tests on different data sets (computing the average of the running times on different data sets) can I expect a better performance of quick sort wrt merge sort? **EDIT** Thank you for your answers. My implementation is in-place and is based on the pseudo-code I have found on wikipedia in Section **In-place version** :               function partition(array, 'left', 'right', 'pivotIndex')      where I choose the last element in the range to be sorted as a pivot, i.e. pivotIndex := right. I have checked the code over and over again and it seems correct to me. In order to rule out the case that I am using the wrong implementation I have uploaded the source code on github (in case you would like to take a look at it). Your answers seem to suggest that I am using the wrong test data. I will look into it and try out different test data sets. I will report as soon as I have some results.


Programming a promotions engine

I am trying to implement a promotions engine for an e-commerce application and I want to figure out how such engines work especially in situations like the following. > Buy X Items from Category A Get Y Items from Category B at Z% discount If the order contains many different items from category A how the engine selects the items that trigger the promotion since there can be many combinations of items that qualify and some combinations make the rule not applicable. A brute force approach would be to find all possible combinations of items that qualify and stop when the rule applies successfully. Are there any algorithms for this or other promotion patterns that I can use?


Doing 'more' with C on Windows than very simple programs?

I'm currently learning C via 'C Primer Plus' as recommended by a lot of people here and I'm finding it very interesting - the in-depth explanations of how and why we do certain things in C are great rather than just being told what things do and going no further... I feel as though all I can do with C at the moment is maths, which isn't terribly inspiring when trying to picture putting various applications together in my head (besides calculators (-_-)). I'm only about half way through the book so it hasn't covered things like the if statement yet, but I'm just taking it easy - I already know a fair amount of programming concepts since I'm fairly capable in PHP. My question is - are there any tutorials are interesting bits of source code people can link me to that will inspire and educate me beyond the loops/variables/operators/etc universal programming features that will give me an insight into programming say.. with Windows API? Or things along those lines? I found PHP fine to learn since I already knew html/css which obviously handle the front-end of my web applications, as well as the reverse - getting input data from forms, interacting with a database etc, but with C I don't know anything other than 'backend' and standard I/O stuff. Many thanks to those that can link some interesting resources - a lot of sites seem to be fairly old, which is fair enough (what, with C having been around for coming up 40 years?), but I'm not programming for 40 year old computers so...


When using your own API (Dog Fooding). How do you avoid giving away the secret key?

I read this article on soundcloud's api:   http://backstage.soundcloud.com/2011/08/soundcloud-mobile-proxies/   It talks about consuming your own API. What I don't understand is how they avoid giving away the secret key. If you normally give the secret key to a developer who is going to use it in his API how do you give the secret key to yourself and avoid divulging it without transferring it over the wire? I am assuming there is a new secret key for each user. Otherwise each user would have the same secret key and a new public key and I am not sure if that would work. * * * I am not talking about developers. I am talking about users like us are to Stack Exchange (actual users of the app itself). My app will be consuming it's own API. Each user that signs up for the app (I assume) would get a private and public key. Each call to the API would need to (potentially) authenticate with a public and private key. If in this situation the user is a regular user of the app, how does one get the private key to the user. Or is this not the best way to do this?


Study on designing user prompts (choice of wording, response format, etc.)

Sometimes there are different ways to ask a user the same question. For example, if the user tries to exit a program without saving their file, you can ask either of these questions:   * Are you sure you want to exit without saving? `[Y] [N]`   * Do you want to save before exiting? `[Y] [N]` These are essentially the same question, but because of the different wording, they have **opposite** answers. This raises some questions on which is better to use like which is which is clearer? which reduces mistakes? and so on. I’m wondering if there are any studies, statistics, or experimental research, clinical trials, etc. on these sorts of things that can help design UI/UX to minimize user frustration and errors. I know there are papers and books on designing user interfaces, but I have not seen anything specifically about specific wording, deciding between positive and negative responses, and such like with the above prompt example.


What percentage of software developers work solo?

I'm trying to put together some ideas for a talk, and one of the things that occurred to me, is if there's any documentation or research into how many programmers work as the lone developer within their team. I think this is an important distinction because individual developers (and perhaps small team developers) end up having to wear many more hats than developers part of a large developer group. It could give us some better insight to career development and transition tactics, as well. I've tried some generally googling, and wasn't able to turn up anything, so I'm hoping maybe someone has seen (or studied) something related to this. Thanks in advance!


Showing the structure of the program (menu) as a tree - does it a have name?

In my thesis, I want to show the structure of the program, like this: > >     > Menu  ---  Settings ---- Audio ---- ... >     >                     ---- Video >     > >     >       ---  Perform  ---- Calculation >     >                     ---- Video demo >   You know, like a map for a website, I would like to present a tree for the menu. But does this have a fancy name in SW engineering?


Split work item into prototype and main work item?

During grooming, we usually have work items which get approved based upon the team understanding that what needs to be done? The product owner does not discuss the details of how it will be done and stops the discussion if team tries so. This applies to all work items (new UI, new API or changes to existing UI/API). Product Owner's reasoning is that getting into the details (both technical & functional) of how it will be done is something that needs to happen during sprint and discussing it during grooming is not correct. The effort estimation also happens based upon this discussion. But during sprint planning, approved items are taken for the sprint and expectation is that if work item is approved, team should know all the details of the solution and should be able to complete the item in sprint. What happens is team spends first 2-3 days in doing the research and getting the PO's approval for the solution (UI design, key business logic clarification). Unless the analysis results in great difference in effort estimate, team is asked to complete the feature. This happens in each sprint. I dont have a problem with putting extra effort in completing the work item. My question is regarding the process.   1. Should the team say no in approving the item unless team understands how the solution will look like?   2. Should the work item be splitted into research/analysis in which solution prototype will be proposed to the PO? Once the PO will approve the prototype, the main work item will be marked approved.   3. Any other suggestion as to how it can be handled in better way?


Is it a bad practice to store large files (10 MB) in a database?

I am currently creating a web application that allows users to store and share files, 1 MB - 10 MB in size. It seems to me that storing the files in a database will significantly slow down database access. Is this a valid concern? Is it better to store the files in the file system and save the file name and path in the database? Are there any best practices related to storing files when working with a database? I am working in PHP and MySQL for this project, but is the issue the same for most environments (Ruby on Rails, PHP, .NET) and databases (MySQL, PostgreSQL).


How do I move into consulting/building apps for small-to-mid businesses?

I have a few friends who are small business owners (~100 employees) and I've had good luck turning their Excel spreadsheets and the like into actual applications. It works great for them and is rewarding for me. You guys might laugh, but you'd be surprised the money and personnel time it saves them. The work isn't complex, per se, but I really love it. Why do I love the work?   1. I work directly with the person who pays me and who gets to see the results.   2. I'm working in whatever framework/platform I fancy, so I can stay abreast on new technologies.   3. I get to pick and chose what projects I want to work on. This is great, but I'm getting to the point where I need to get extra income and I'm finding it _really_ hard to branch out and get more clients. Mostly, small businesses seem to really leery of something they don't understand. Any idea how to penetrate this market? Is this something, someone is doing right now? Are there certain industries where this is more amendable than others? This is really my dream, so any advice is appreciated.


Using one repository for the foundation of another

I have an existing website theme that I have built. I've been using github to maintain this theme, let's call it `dragon`. We are changing the theme entirely but we're using the existing theme as a foundation. Should I create a new github repository for the new theme? Or should I just continue pushing to the `dragon` repo? If I do create a new repo should I use clone `dragon` and use that as the base for the new repo?


Should EICAR be updated to test the revision of Antivirus system?

I'm posting this here since programmers write viruses, and AV software. They also have the best knowledge of heuristics and how AV systems work (cloaking etc). The EICAR test file was used to functionally test an antivirus system. As it stands today almost every AV system will flag EICAR as being a "test" virus. For more information on this historic test virus please click here. Currently the EICAR test file is only good for testing the **presence** of an AV solution, but it doesn't check for engine file or DAT file **up-to- dateness**. In other words, why do a functional test of a system that could have definition files that are more than 10 years old. With the increase of zero day threats it doesn't make much sense to functionally test your system using EICAR. That being said, I think EICAR needs to be updated/modified to be effective test that works in conjunction with an AV management solution. This question is about **real world testing** , without using live viruses... which is the intent of the original EICAR. That being said I'm proposing a new EICAR file format with the appendage of an XML blob that will conditionally cause the Antivirus engine to respond.               X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-EXTENDED-ANTIVIRUS-TEST-FILE!$H+H*     <?xml version="1.0"?>     <engine-valid-from>2010-1-1Z</engine-valid-from>     <signature-valid-from>2010-1-1Z</signature-valid-from>     <authkey>MyTestKeyHere</authkey>       In this sample, the antivirus engine would only alert on the EICAR file if both the signature or engine file is equal to or newer than the valid-from date. Also there is a passcode that will protect the usage of EICAR to the system administrator. If you have a backgound in "Test Driven Design" TDD for software you may get that all I'm doing is applying the principals of TDD to my infrastructure. Based on your experience and contacts how can I make this idea happen?


A better workflow between designer and developer on iOS XIB files development

We're working on an iOS project and right now, and whenever the designer has some feedback about fonts, colors, positions of elements, what images should go where etc., I have to go back and go through each little detail and make sure it's fixed. I'm thinking there's got to be a better way to do this, where the designer could somehow be directly involved in the application's design. The first idea I got is to create a global plist (or a per-XIB plist) which contains the details of the different elements (size, font, title color, background image etc.) and just let the designer fill that in, and have a special class that looks over the plist and sets the properties accordingly. If I have the time I might implement this. Is there some other method of working that saves the developer all that nit- picking designing time? edit: Or maybe is there some way to do iOS development similar to how CSS works with HTML?


what is the name of the model for the describing strategy between R&D and Professional Services

Is there a model that describes the different strategies that a company may use where the organisation is split into an engineering division and a professional services division? This is the sort of model that is followed by companies like Microsoft, whereby Engineering (or R&D) produce the core software, and professional services can then help clients implement that software.


Using past participle for non-altering functions

I often have naming problems when I write classes and functions. Generally speaking, I try to follow the following set of rules if I have to deal with a function whose name is a verb:   * If the function alters the parameters, use an infinitive.   * Otherwise, use a present participle.   * If the function is a boolean, use `is`, `has` or `can` before the infinitive. I thought that this rule made sense, but looking at standard libraries of several programming languages, I feel rather alone. For example:   * Python's string methods do not alter the strings but are name with infinitive verbs ( _e.g._ `capitalize`, `split`, `strip`...).    * D's `std.functional` functions return new functions but are named with infinitive verbs too ( _e.g._ `memoize`, `curry`...). While it would have made sense to me to use `strip` (had Python strings been mutable) to alter a string and `stripped` to get the a new string (similar to the one passed but stripped from its leading and ending spaces), it seems that such a convention is almost never used (however, Python also provides the built-in functions `reversed` and `sorted` which do use past participle to tell that they respectively return a reversed or sorted collection without modifying the one passed to them). Are there contraindications concerning the use of past participle for the names non-altering functions and methods? **EDIT:** I fail to see what is unclear, so I'll sum up the question in a few words: _Is it bad pratice to use past participle instead of imperative or infinitive verbs to name functions that take a single parameter, do not alter it, but return an altered copy of the said parameter?_


What is the proper and easy way to move a LocalDB to Azure using code first ?

The only way I could figure how to do it was create the schema on the localDB with code first and then manually change the database string to Azure and then run the code on Azure.. But that only gives me the schema and not the data.. Is there a better way like ? bacpac? Create a script instead? Or some other concept I am missing ?


Workflow for building a RESTful API

I am building a RESTful API, and so far, to make sure that my resources work as I need them to, I am using a REST client called Postman. This makes it easy for me to store routes and quickly make requests to them for testing. My current collection of routes in Postman looks like this: ![](http://cl.ly/image/29410W1W0i3h/content) The trouble with testing the API is this way is I have to manually change resource IDs. For example, if I want to test the `PUT` method on my posts resource, I have to first create a resource, find the ID, and then paste it into the `PUT` URI. This is long! What is considered professional practice for building a RESTful API? Should I be writing unit tests for each route, dynamically creating the post before testing methods like update?


What happens when using address before it's allocated?

The very simple piece of C++ code below is incorrect, it's easy to see why and tools like Valgrind will tell you. In running several C++ codes containing this kind of error, I noticed that each time, it ended up with a `Segmentation fault` at the line which tries to use the address. So my question is: is it safe to claim that trying to use an address before it's allocated will **inevitably** lead to a `Segmentation violation` at the corresponding line?               class ClassType     {       public:int data_;     };          ....     // Using address before it's allocated     ClassType * ClassType_ptr;     int x = ClassType_ptr->data_;


Is there a better alternative to the folder-based file system, and will it be replaced any time soon?

All file systems I've encountered have been based on folders - you have a root folder, which contains files and subfolders, which in turn contains files and subfolders, and so on. Is there a better alternative to organizing files, and will it replaced the current system any time soon? Feel free to include some history about file systems, if you judge that's in order in your answer. Interpret the term "better" any way you please.


Are there any online/parttime degree programs focused on IT Security?

I'm a software engineer and would like to focus more on security related stuff (cryptography, mobile security, identity management, ...). As I would like to do a M.S. in Computer Science anyway I'm looking for a program where I can combine both.


Managing Eclipse projects in source control

I've been using eclipse for a long time to do development. One of the problems I've come across when working on other people's projects is if they come from source control, some of the eclipse project files "default.properties" and other xml config files are missing. Its usually a big pain in the butt to get the project running in eclipse. I understand the reasoning to not have certain files tracked because they may be full of specific stuff to a certain eclipse install. How do all of you manage that?


Do licenses matter if there's nobody around to enforce them?

Suppose that the original creators can't (or won't) enforce a license on their software/code, but that work is still popular. I guess if you want to visualize it, I'll throw out a convoluted hypothetical:   Imagine a very small group of developers that released a code project under an open-source license. The repository was hosted on their servers. However, everybody on the immediate development team passed away in a tragic accident or something. Their servers shut down after this happened. The project had a fairly large user base, and so others began to host the last revision on their own servers for others to download. (Yes, I have an active imagination) Does abiding by the license simply become a matter of morality by its users, or can there still exist a legal penalty when there is no one user or group to enforce it? Could anything be done if an unscrupulous user decided to branch off the project and use it under a different license? I am not looking for legal advice -- I am simply curious about how software licenses work. I tend to think of strange situations and wonder what would happen in those scenarios.


Do technical interviews tend to be subjective?

Based on my experience in technical interviews, I have found that most tend to be subjective because the interviewer already has his own answer. Even though the answer from the candidate is correct, because the interviewer was not prepared for that answer, the candidate does not get the job. In an interview recently I said something about using an AVL tree algorithm to solve a specific problem that was asked. The interviewer responded: "What's an AVL tree?". Another example is anything around syntax; I've encountered this mostly in interviews that require Ruby code because there are many ways to implement a solution to a given problem. A very common ones is problems around Object Oriented designs. In this situation, there's no way for the interviewee to succeed. Has anybody else felt this way too or is it just me? If it's not just me, how can we make technical interviews better?


How can we design mobile chatting XMPP server

I have a xmpp server design problem, I have been thinking and searching about this for a while, but cannot reach a decision, I hope experts here can give me a hint, really appreciate. <Requirement>      Build a mobile chatting server, this server should allow:   1\. Register new user   2\. upload user photos   3\. edit their personal information.   4\. User can chat with each other.   5\. Release API and allow android or IOS to use.   6\. Should be extensible, should allow us to add new features later without too much structure change. <My question>   I know there is _OpenFire_ open source xmpp server that we can use, but these two are standalone servers, they don't allow user to upload pictures, edit their own personal information, or some other activities. So how can achieve this? Can we create all the add-on features on Tomcat server, and make Openfire working with it together? Or can we create Plugin in openfire to achieve this? What is the best solution?


scaffolding a multi-angular-app portal with usersystem

I'm trying to find the best way of developing a portal that a user can log in to and then be presented with a range of different apps (angular). They should share the same api-backend. I think that each angular-app could (and should) be developed separately. The only thing I think I need to do is place the dist-folder (or create a symlink to it) in the "portal"-part. When I say the portal, I mean the part where user is presented with a login- screen, and after successful authentication is routed to a app-menu. Pretty static stuff really. The api-backend can be a separate express-app to make it less complex (atleast I think so). My goal is to make the development-process effective and easy to maintain. Each angular-app is scaffolded with yeoman, and I develop them while doing a 'grunt serve'. 'grunt build' will then produce a nicely packed app in the dist folder. I'm quite happy with this solution. The Backend is an expressjs app, and I use nodemon to do it effectively. My issue right now is how do I scaffold all of this ? I once tried setting up a large Gruntfile.js to build the backend, portal, and each angular-app and stitch everything together. I gave up. As I see it, the parts I need to stitch together is: Login/portal/menu (express/passport)   n * Angular apps   API-Backend (express/mysql) I have a portal-part that works with passport, I have a API-backend that works, and I have some conceptual angular-apps that works. my git-repo contains everything, and I have this structure:                git       |-- backend       |      |       |      +-- api        |          |-- app.js       |          |           |          |-- lib       |          |-- public       |          +-- config       |            |            +-- frontend               |-- App1               |     |--Gruntfile.js               |     |--node_modules               |     |--app               |     |   |--bower_components               |     |   |--images               |     |   |--views               |     |   +--scripts               |     +--dist               |                      |-- App2               |     |               |     |--Gruntfile.js               |     |--node_modules               |     |--app               |     |   |--bower_components               |     |   |--images               |     |   |--views               |     |   +--scripts               |     +--dist               |               +-- Portal                     |                     express/passport app      Should the portal-part and the api-backend be the same ? Any good ideas on how to scaffold this is much appreciated :) (I even appreciate it if someone care to read my long question)


CodeIgniter routing helping

Can you explain these two lines of code in `applications/config/routes.php` file in the CodeIgniter framework?               $route['default_controller'] = 'pages/view';     $route['(:any)'] = 'pages/view/$1';


If I were to start doing a GUI how do I decide on what platform to use?

I hear about WPF, Silverlight but then there is also windows RT, metro stuff, windows 8 and so on at the moment - I'm having a hard time nailing what to bet on. How do I, at a given point in time, find the best platform for doing somewhat future-proof GUI?


Help understanding MapReduce Sort example

From Section 5.3 of Google's paper describing MapReduce. > "A Map function extracts a 10-byte sorting key from a text line and emits > the key and the original text line as the intermediate key/value pair. We > used a built-in Identity function as the Reduce operator. This function > passes the intermediate key/value pair unchanged as the output key/value > pair. The final sorted output is written..." I don't understand how the actual sorting happens. As far as I understand, they Map function extracts a key value pair, and then the Reduce function somehow spits out the data sorted. What is a "sorting key"?


npm packages.json: devDependencies vs global installation

I'm new Node.js development and I have a question about best practices when writing `package.json` files. From my understanding, you have to list all devependences that you need to execute your app under `"dependencies"` in the `package.json` file. All your extra dependences that are required to run your test (or your build process) have to be listed in `"devDependencies"`. But what about tools that you additionally use, but which are not necessarily required by every developer. Take the `node-inspector` package as an example, which I installed globally on my machine but did not add to the `package.json` file. Is that a good practice, or would you recommend to also file those packages as `"devDependencies"`?


Why aren't there modern C IDEs?

Why weren't the features present in modern IDEs for Java & C# (Intellij IDEA, Visual Studio, eclipse) developed in (earlier) IDEs for C language? I mean I don't know any IDE which has modern features (auto-complete, code navigation, refactoring, VCS integration etc.) that was developed especially for C. I know that eclipse has plug-in for C and Visual Studio can run an old version of C but they weren't designed for C but rather for Java/C# (or the other .NET languages). I also find it hard to believe that things like "pressing a key to go to a function or struct definition" or "commit to SVN from 2 key shortcuts rather than going in shell and writing a command" or "pressing a key for extracting a method or a variable" are useless and emacs or vim is enough. Not to mention code analysis, code coverage and probably most important specific library/framework support. These are all functions which greatly increases the productivity of a programmer. The only reason I thought of is that there aren't many large projects in C (hundreds of thousands LoC), but still, there are plenty of them; and also, most of the functionality is very useful for smaller projects also.


Is this the correct way to use extends?

I am making a UML diagram. Im wondering if im using the extends feature correctly. I have a marketer that can search contacts but only if they have created them in the first place.... Have i got the right idea. Or should there be an association between the marketer and the update/delete contact too? Should the update/delete even extend the create contact? ![enter image description here](http://i.stack.imgur.com/qeMtm.jpg)


The overlap between open source and closed source

I would like to understand why do some people like open source and some others like closed source? Let me be more specific and make my question about web development. If I build my site using an open source server side language what are the benefits for me? and if I build it using a closed source server side language, what are benefits? I just want to understand how can I choose between the two differnt paradigms when building different types of web sites and applications!


Testing chainable method calls return type and value

Is it worth testing the return type and value of a method call that is designed for chaining? It is conceivable that a fellow programmer could accidentally change the return type to void and remove the return while furiously refactoring some methods? This would potentially break a lot of code for an unsuspecting user. However, I feel like I would be testing code structure rather than code functionality. Is this a reasonable thing to test? Or is it just a big waste of time?


Complex Mutual Exclusion Validation Logic

I need to validate some form inputs in complex way. E.g.               <select id="options" multiple="multiple">       <option>A</option>       <option>B</option>       <option>C</option>       <option>D</option>       <option>E</option>       </select>        For example, if user selects A and B, user should be given an error if user also selects D. Note, I'm trying to keep this business rule in a separate layer from this UI code, which could be an entirely different form, e.g. checkboxes, drag-and- drop, add/delete options with possibly accompanying fields. I'm looking for a framework, design pattern, or other elegant way to code this logic, preferably ultimately through validation attributes in a model.


Why doesn't Microsoft release UX frameworks to build UI's like their current UIs?

When I started learning programming with the .NET framework, I started by using WinForms as a UI technology. It uses “classic” menus just like this office 2000: ![office 2000 user interface](http://i.stack.imgur.com/cevjt.png) A few years later Office 2007 was released, the ribbon was born: ![office 2007 user interface](http://i.stack.imgur.com/WvWbm.png) And even some years later Office 2010 was released, which also added new features like the stage:![office 2010 user interface](http://i.stack.imgur.com/fYfEQ.png) A few days ago Office 15 preview was released and they added more fancy new stuff: ![office 15 user interface](http://i.stack.imgur.com/hf2Wl.png) That's huge progress IMO, but why don’t they enable the developers to build UI’s like them? When I have a look at .NET, there’s still no way to build a ribbon. Even with WPF, which is highly extensible, there are no premade controls. So the community has started several projects to create all those "features". I know, today Microsoft has released a ribbon for WinForms and WPF, but that's still not part of any core framework (not even the 4.5 one). But this is not limited to .NET as far as I know? Today there are still no APIs for unmanaged applications to create those ribbon UI’s?! In Germany they are offering free UX training to make sure everything fits their style! http://j.mp/NZGgH9 **Why doesn’t Microsoft give the cool stuff to us developers? Do they want their applications to be unique?**


When to use custom collections?

I see a lot of APIs that use custom collections instead of just using strongly-typed packaged generics. For instance, the API will have a `Object1Collection` instead of just a `List<Object1>` (or whatever the appropriate generic would be). When do you know to use one or the other? I understand you'd create a custom collection if you want to _extend_ the capabilities of a pre-shipped generic collection, but what if that's not the case? Is it prudent to create the custom collection from the beginning, with thoughts that in the future that object might scale up and require further capabilities, and it may be easier to just do that initially? Is that justification enough? And if you just want to _extend_ functionality, instead of _define_ collection functionality, you would just derive your custom collection from a base generic collection class, otherwise inherit the interface accordingly? Is that typical?


how to choose co programmer

I am working on a idea, I need a co-programmer to get that to a good shape. What are the factors should be considered while choosing people for such positions. (Note : if any java programmer is open-minded, please contact me. This however is not a job offer :-) )


how are virtual methods slower in C#

I was reading the that virtual calls make the code slower than calling non- virtual call in C#. However the IL instruction for both are the same `callvirt` except in cases where `base.somemethod()` is called. So how does virtual method hurt performance ?


How can I handle chat messages asynchronously?

I'm working on a program where part of it will be working as a chat between different people. I'm trying to figure out the best way to send and receive messages. A PrintWriter or something similar won't work because the process will stop at the `read()` method while waiting for a message to be sent to it. I'd like to check to see if there is a new message, and if not, continue the execution. I've seen some stuff about JMS, but I haven't done enough research to determine if it's up for this job. _Is_ JMS the best option for this, or is there a better way?


What are SCM tasks that could be performed on a mobile device?

Given an iPad, iPhone, Playbook, or other mobile device, what SCM tasks make sense on these devices. Code review? Change propagation between branches? Automated build results after check in? What else? Code generation? Debugging? Code editing in the cloud? Or do you think all SCM tasks will always be performed on a desktop computer?


how to use the same behaviour in different classes

I have a behaviour that I'd like to use in different classes. Those classes are unrelated to each other (no inheritance). I'm using AS3, where multiple inheritance is not possible. I could use an interface but then I'd have to rewrite the same implementation every time, which is basically what I'm doing now (but without the interface). As en example I have many situations where I have an icon and a text label. In buttons, signs, etc. I'd like to centralise the alignment behaviour between the icon and the label. What is the best OOP pattern for that?


How is this number calculated?

I have numbers;               A == 0x20000000     B == 18     C == (B/10)     D == 0x20000004 == (A + C)      A and D are in hex, but I'm not sure what the assumed numeric bases of the others are (although I'd assume base 10 since they don't explicitly state a base. It may or may not be relevant but I'm dealing with memory addresses, A and D are pointers. The part I'm failing to understand is how 18/10 gives me 0x4. **Edit: Code for clarity:**               *address1 (pointer is to address: 0x20000000)          printf("Test1: %p\n", address1);     printf("Test2: %p\n", address1+(18/10));     printf("Test3: %p\n", address1+(21/10));      Output:               Test1: 0x20000000     Test2: 0x20000004     Test3: 0x20000008


Why would you hire in-house software developers instead of outsourcing them to develop a product for your company?

Why would you hire in-house over outsourcing in developing a product for your company? I can only think of a few but I'm not entirely sure if they're good enough reason. This is actually for a debate that I'm going to have in class. I'm more inclined on the outsourcing part but unfortunately, I was asked to switch to the in-house side of the debate. Any ideas?


When to use the 3 layers model?

I was recently exposed to the three layer model (DAL,BL,UI). Someone told me I should ALWAYS work with this model. I have a medium project that I'm starting and I have doubts whether I should build it with layers and make myself work with more complex code just to 'code by the book'? Even though I read about this model, I'm still not entirely convinced it's worth it. I understood that it would help if I change the UI, but I really don't see any chances that the UI of this app will ever change. So is it worth the hassle? I would appreciate your opinion - would you advice me to always build projects by this model (even if currently I can't see much of a benefit)? **EDIT:** guys, please don't catch me on the word 'ALWAYS' - the meaning was just that generally this is the proper way I should design my projects by.


Best approach for saving highlighted areas on geographical map

I am designing an application that allow users to highlight areas of a geographical map using a tool that is like brush or a pen. The tool basically draw a circle with a single click and continue drawing those circles with mouse move. Here is an example of drawing made by moving the tool. It is pretty much same as Microsoft Paint. ![enter image description here](http://i.stack.imgur.com/aXG9T.png) Regardless of programming language what is best approach (most inexpensive approach) for saving this kind of data?


Silverlight, one database per user

I have a Silverlight application with WCF and entity framework. Is it possible to have one database per user. So when the the user log in, the user will use his own database?


How discrete should a RESTful API be?

I've never built a RESTful API before and I am wondering how discrete should it be? For example lets say I have a customer which has a name, address, phone number, email address, language, etc. Does it make sense that there is a way to update each individual field (update address, update email address, etc), or should there just be a single update for the entire customer and each field is optional?


Which is better to use? (Enum or Constant)

I have my enum like this.               enum Size{PAGE_SIZE=20,               HEADER_SIZE=30     };      I only use them as constants(No enum variable created) in my program.   i.e= `int x = PAGE_SIZE + 20;` So what is the better way to declare the constants in this scenario? (enum or const)


What are Ruby's strengths?

Before I'd read this article, I never understood why anybody liked LISP. After reading it, I was able to give LISP a fair enough shot and have since grown to like it. It wasn't until I read this that I began to understand why some people cared about TCL. I need an equivalent for Ruby. I can read the code. I've written a trivial amount of it. I've seen Rails. Yes, everything is an object... yes, the syntax is novel... I still don't understand why folks are so enamored with it.


What pattern helps to compose nested views at runtime?

Are there any design patterns to compose views within a parent view during runtime? Say we are composing the views in a workflow tab and views in the tabcontrol depend on the country, store type and/or other conditions. This is a MVP, WPF, PRISM application.


Why do Windows Forms / Swing frameworks favour inheritance instead of Composition?

Today a professor of mine commented that he found it odd that while SWT's philosophy is one of making your own controls by composition, Swing seems to favour inheritance. I have almost no contact with both frameworks, but from what I remember in C#'s Windows Forms one usually extends controls, just like Swing. Being that generally people tend to prefer composition over inheritance, why didn't Swing/Windows Forms folks favour composition instead of inheritance?


Implementing bussiness logic with a large number of business rules and processes

We are currently working on a project that heavily relies on a database. Among many tables the main focus is on table "data" which is linked to another table "data_type" as many-to-one, which is then linked to table "data_operation" as one-to-many. The last table defines specific set of operations that has to be processed for each row in table "data" based on specific data type. The operation is processed against specific fields in table "data" and partially data from other tables, not mentioned in this example. The actual operation is mostly a complex calculation or specific formula. The result of a specific operation will be stored in yet another table. So in general we have: ![Trivial scheme](http://i.stack.imgur.com/V8jrq.png)   * Projection for table "data" is approximately one million rows per year, while other tables should not change drastically on a yearly basis, but it will initially hold a few thousand rows, that is, each data type will define roughly 10-15 operations.   * Each operation should be reversible (revert changes).   * Processing speed is a very important factor.   * The application will most likely process 2500 new table "data" rows per day. My question is concerning the best approach to implement operations. Do you think it is wiser to move business logic and rules to a database (procedures, triggers for each operation) or implement and process each operation in the application/business layer? What would be the ideal generic structure? Also I am open for other approaches as well.


Are audit and log exactly doing the same things in a software system?

I've seen that some of software systems have functionality of audit and log. Both of those functionality seem that they are just doing the same things - **records all the users's actions behind the scene.** There are respective tables of audit and log even exist in the database. If they are really doing the same things why the developer developed duplicated function in a system?


Should an algorithm handle invalid inputs and can it have hard-coded paths for certain input data?

I have certain preconditions on input data and I need to design an algorithm for that data. Should I also handle invalid preconditions? Also is it normal that my algorithm will work only for a certain number of inputs, for example 4, and for any smaller number of inputs I'll have "if input.size" clause? To clarify my question. Well, actually it's a task from a book but anyway. So it says i'm given an array sorted, then swapped so that it looks like "4567123" first part "123" is swapped. So, should I bother to design algoritm for non-swaped case? Also my algoritm doesn't work well for input size 1, 2, 3, so I inserted cases for 1 , 2 ,3. Is it ok. So here is the code:               //file SwapedArraySearch.java\     public class SwapedArraySearch {         public static int search(int[] arr) {             switch (arr.length){                 case 1:                     return arr[0];                 case 2:                     return arr[0] > arr[1]?arr[1]:arr[0];                 case 3:                     return arr[0] > arr [1] ? (arr[1] > arr[2]?arr[2]: arr[1]):                                                 (arr[0] > arr[2]?arr[2]: arr[0]);             }             int x = arr[0];             int n = arr.length/2;             int prevn = arr[n] > x ? arr.length -1 : 1;              int t;             while(prevn != n) {                 if (x < arr[n]) {                    if (arr[n] > arr [n + 1] )                        return arr[n+1];                     t = n;                     n = n + (prevn - n)/2;                     prevn = t;                 } else {                     if (arr[n - 1] > arr[n])                         return arr[n];                     t = n;                     n = prevn + (n - prevn)/2;                     prevn = t;                 }             }             return arr[0] > arr[1] ? arr[arr.length - 1] : arr[0];         }              public static void main(String... args) {             int[] arr = new int[args.length];             for (int i = 0; i < args.length; i++)                 arr[i] = Integer.valueOf(args[i]);             System.out.println(search(arr));                     }     }      Also I'm bother that it looks too complex. Doesn't it or is it fine? Also, let's say, binary search, it obviously shouldn't check before run that array was sorted before, right?


comparison of floating point numbers vs. comparsion of Integers in C

Does comparison of floating point numbers takes (considerably) longer time than comparison of Integers in C? I just wrote a C program of heap sort to sort floating point numbers. I am on ubuntu 14.04 and I used `time` command to check the time taken by this program for sorting 50, 5000 and 50000 random numbers and then I just changed all `double` to `int` and again checked time for 50, 5000 and 5000 numbers and statistics are as follows:               $ time ./heap 50 < input.txt           real    0m0.003s     user    0m0.001s     sys 0m0.002s     $ time ./temp 50 < input.txt           real    0m0.003s     user    0m0.001s     sys 0m0.002s     $ time ./heap 5000 < input.txt           real    0m0.008s     user    0m0.007s     sys 0m0.002s     $ time ./temp 5000 < input.txt           real    0m0.005s     user    0m0.004s     sys 0m0.001s     $ time ./heap 50000 < input.txt           real    0m0.030s     user    0m0.028s     sys 0m0.002s     $ time ./temp 50000 < input.txt           real    0m0.027s     user    0m0.026s     sys 0m0.002s     $ time ./heap 500000 < input.txt           real    0m0.263s     user    0m0.259s     sys 0m0.003s     $ time ./temp 500000 < input.txt           real    0m0.219s     user    0m0.216s     sys 0m0.003s      Here heap is the executable of floating point heapsort and temp is the executable of Integer number heapsort. As we can see there is noticeable difference in running times? What is the reason? I can upload the codes if needed.


Are basic level programming skills taught at elementary necessary/helpful for success in maths?

How would you feel if basic level programming skills were taught in elementary school? Would kids not be up to par with what programming demands, brain capacity wise? Would it help the kids with maths and other similar classes, or even be worth it for kids who have no interest in the field.


Good design for a simple site that contains a blog

What is a good design for a simple web site with mostly static pages and a blog? I am helping a friend build this for their small business. We are looking for a simple approach that can be implemented fairly quickly. (I am a programmer and can help with coding, hosting, etc.) One option is to use a site like virb, which lets you choose from one of their themes and build a site pretty easily. You can also include a blog. They host the site for a pretty low monthly rate. I recommended this option, but my friend wants a design that is unique and custom. So, I took one of the themes and started modifying the HTML and CSS. This might still be a good option, but... ...If we are going to greatly modify it, why not just create the static pages from scratch and use something like Wordpress for the blog. Is this a good option? It looks fairly easy to integrate Wordpress with a site so that the design and behavior are really cohesive. Is this a good idea? Do you recommend any other approaches?


Is Cygwin or Windows Command Prompt preferable for getting a consistent terminal experience for development?

### The question: Which is better, installing cygwin or one of its cousins on all my windows machines to have a consistent terminal experience across all my development machines, or becoming well trained in the skill of mentally switching from linux terminal to windows command prompt? ### Systems I use:   * OSX Lion on a Macbook Air   * Windows 8 on a desktop   * Windows 7 on the same desktop   * Fedora 16 on the same desktop ### What I'm trying to accomplish Configure an entirely consistent (or consistent _enough_ ) terminal experience across all my machines. "enough" in this context is clearly subjective. Please be clear in your answer **why** the configuration you suggest is consistent enough. ### One more thing to keep in mind: While I do write a lot of code intended to run on Windows (actually code that runs on Windows Phone which necessitates a windows machine), I also write a lot of Java code, and prefer to do so in vim. I test a local repo in Java on my windows machine, and push to another test machine running ubuntu later in the development stage. When I push to the ubuntu machine, I'm exclusively in terminal, since I'm accessing it via SSH. ### Summary, with more accurate question: Is there a good way to accomplish what I'm trying to do, or is it better to get accustomed to remembering different commands based on the system I'm on? Which (if either) is considered "best practice" by the development community? Alternatively, for a consistent development experience, would it be better to write **all** my code SSHed into another machine, and move things to windows for compile / build only when I needed to? That seems like too much work... but could be a solution. ### Update: While there are insightful responses below, I have yet to hear an answer that talks about _why_ any given solution is superior. Cygwin/GnuWin32 is certainly a way to accomplish a similar experience on all platforms, but since I'm just learning all things command line, I don't want to set myself up to do a lot of relearning/unlearning in the future. Cygwin/GnuWin32 has its peculiarities I would imagine, and being aware of how that set up works on Windows is a learning curve. Additionally, using Cygwin/GnuWin32 robs me of learning the benefits of PowerShell. As a newcomer to working in a command line, which path should I choose to minimize having to relearn/unlearn things in the future? or as my first paragraph poses: > [is it better to use Cygwin] ...or [become] well trained in the skill of > mentally switching from linux terminal to windows command prompt?


Optimizing mindmaps by finding the least amount of redundancy

When using mindmaps, you order them based on how you think it fits best. So for instance (tab means subtree)               requirements       dinner         food         forks         spoons       breakfast         food         forks      this could be written using               food       at         dinner         breakfast     forks       at         dinner         breakfast     spoons       at         dinner      What would an algorithm look like that finds the best sorting in the manner described. Best means, the least amount of redundancy? (The 2nd example might not actually reduce redundancy but it shows what is meant by sorting/reordering)


what is the difference between a software engineer and project manager?

I understand that a software engineers job is to work with all aspects of developing and supporting a software system. How does a project manager fit/work with a software engineer in a small team (5 or less) environment?


Is it reasonable to use git only on my local machine?

Is it ok to just use git only locally? I don't want to have to pay for a service that provides private repositories (such as Github) but I think git is a great way to organize my closed-source project.


Communication between teams in the same company

In our company we have 3 teams working on different software. The level they are working on is very diverse from 8/16 bit microcontroller in C , via 32bit arm on C++ under winCE to PC software developed with C# and windev. The tools and procedures we all use are roughly the same, although some teams use VSS and others SVN for version control. At the moment there is not much formal communications between the teams. Improvements in the process are only accidental because you hear something from a member of the other team that you could use in your own development. We would very much love to improve this situation but don't know how. What did you do that did or didn't work in such situations?


What are some good books to use to learn ADA?

I was recently encouraged by a potential employer to go out and buy a book and begin learning ADA. I generally find that starting out with a good book, then supplementing that learning with continued research on-line with reference as needed to the book is the best way that I learn. What books would you recommend to start out with learning ADA? The job itself would involve embedded programming which I don't have experience with either. Any books that cover both topics well?


In an event-driven environment, how should a "cancel" function abort all further events?

In my iOS app, things are mostly driven by events.   1. The user presses a button   2. The app listens for an external device to be connected to the iOS device   3. Once the device is detected (is connected), an asynchronous call is made to a web service (to check for user authenticity)   4. The web service returns the user's authenticity (such as a boolean)   5. Another asynchronous web service is called for a stage 2 authenticity   6. Result is returned My question is: If I give the user a dialog box saying "Please wait, processing" and I give them a "Cancel" button, how should I (or how might I) abort everything that's happening? One way to do this is to simply have a boolean called "userDidCancelEverything" and every event-driven method checks to see if this is true. This seems ugly though.


Queries in Agile process

How to determine the story point value in Agile methodology and determine the team velocity? In web search able to get the definition but not the actually process explanation.


Where can I get some sample text?

I am trying to get statistics on 2-character sequence combination frequencies for the English language for a project I'm working on. It's very important that the results are as precise as possible. I'm not quite sure whether this type of research has been conducted before, but not to worry; I can easily whip up a script to report the statistics I need. But what I don't have is a large body of sample text to analyse. Does anyone know of a good resource where I can get a large amount (several GB would be nice) of English text covering a wide variety of topics in plain-text?


Sorting versus hashing

My problem is as follows. I have an array of `n` strings with `m < n` of them distinct. I want to create a one-to-one function which assigns each of the `m` distinct strings to the numbers `0 ... m-1`. For example, if my strings are: `Bob, Amy, Bob, Charlie, Amy` then the function: `Bob -> 0, Amy -> 1, Charlie -> 2` would meet my needs. I have thought of three possible approaches:   1. Sort the list of strings, remove duplicates, and construct the function using a search algorithm.   2. Create a hash table and check each string to see if it is already in the table before inserting it.   3. Sort the list of strings, remove duplicates, and put the resulting list into a hash table. My code will be written in Java, and I will likely use standard Java algorithms: merge sort for sorting, binary search for searching, and whatever the standard Java hash table algorithm is. **Question:** Assume that after creating the function I will have to evaluate it on each of the n original strings. Which of the three approaches is fastest? Is there a better way? Part of the problem is that I don't really know what's going on "under the hood" in standard hashing algorithms. Any help would be appreciated.


Using a product licensed under GNU GPLv3 for internal company use

I am in the process of a creating a small web portal for the department I'm working in. For this is need to present some data, and have found the following: http://www.pchart.net/, which could seem to be of great help to me. The above is licensed under GNU GPLv3, and my question is whether it would be allowed for me to use the above, for free. To clarify, the portal that I'm creating will in no way be sold or generate money, but will purely be for internal informational purposes. I have read through the terms and conditions of the GPLv3, and as far as i can make out, my situation is legal, but i want to be absolutely sure that I'm not using the software illegally.


How can I avoid mistakes using the same variable name again?

This isn't a rare case and occurs with me often and I spent countless time trying to debug the code. Latest example, this PHP code where I used `$email` for the parameter and for object as well.               private function _mail( $email )     {         if( filter_var( $email, FILTER_VALIDATE_EMAIL ) ):             $email = new Zend_Mail();             $email->setSubject( $this->request->post('subject') )                 ->setBodyHtml( $this->request->post('message') )                 ->setFrom( $this->request->post('from') )                 ->addTo( $email )                 ->send();             unset($email);         endif;     }      It was throwing an error, `strtr()` expects parameter 1 to be an string object given and it was really frustrating to browse through zend libraries to see what obscure string statement was throwing this error. How to avoid such mistakes?


Is Moving Entity Framework objects over a webservice really the best way?

I've inherited a .NET project that has close to 2 thousand clients out in the field that need to push data periodically up to a central repository. The clients wake up and attempt to push the data up via a series of WCF webservices where they are passing each entity framework entity as parameter. Once the service receives this object, it preforms some business logic on the data, and then turns around and sticks it in it's own database that mirrors the database on the client machines. The trick is, is that this data is being transmitted over a metered connection, which is very expensive. So optimizing the data is a serious priority. Now, we are using a custom encoder that compresses the data (and decompresses it on the other end) while it is being transmitted, and this is reducing the data footprint. However, the amount of data that the clients are using, seem ridiculously large, given the amount of information that is actually being transmitted. It seems me that entity framework itself may be to blame. I'm suspecting that the objects are very large when serialized to be sent over wire, with a lot context information and who knows what else, when what we really need is just the 'new' inserts. Is using the entity framework and WCF services as we have done so far the correct way, architecturally, of approaching this n-tiered, asynchronous, push only problem? Or is there a different approach, that could optimize the data use?


Is there any research out there on geographic differences in work environments (e.g., respect) for programmers?

One thing I've learned from this website is that software developers are not treated the same as what I've seen in the companies I've worked at, and some of the differences seem to be related to the culture or other factors of the geographical location where the programmer works. In some areas, it seems like programmers can expect many perks and a great deal of professional respect, but in others it sounds like programmers are seen as laborers who are told what to do and then should go do it without question. Even in just the USA, there seem to be major differences in "the norm" between the various regions of this country. I'm wondering how much of this is just my perception, and how much is real differences about how programmers are perceived in their different locations. Is there any research out there discussing major differences in programmer work environments or attitudes about how to treat or respect programmers by geography? I'd be interested in multiple articles tackling different ways of looking at this. Edit: Research, specifically, doesn't seem to be available, so I'm making the question broader. Any good, thoughtful writing on the topic of any kind available?


Automatically analyze excel files

I have to replicate a manual generation of a large number of excel files. I started to manually track the relations between cells ( files, formulas, etc). I also had a talk with the person which generates those files. For now I have a general understanding about how the excel files are generated, but "devil is in the details". I assume that I can write a script which will generate the hierarchy between cells and files, but this might require the same effort as manually noticing the relations. Also, I'm afraid that I'm not too experienced and my app is more prone to error approach than a manual analyze. How to handle this problem? Do you know about an open source project which analyze the excel files in a recursive mode following the formulas ?


Have I understood OOP correctly?

I had originally posed this on StackOverflow. The question was closed and I was asked to post this here instead. Here is the original question I had posted there: * * * I have been programming using procedural method for a while now. I have done some good amount of reading pertaining to OOP and I know how to use it. It's just that I am not sure if whether I still know how to use it correctly? So to put this to a test I am presenting a skeleton of a plugin which I have developed using OOP. The plugin is supposed to fetch values like subscribers, follows etc from various social networks.               // This is an abstract class used by all Social Network classes     abstract class Social_Network {         protected $service_url,$service_identifier,$icon_url,$refresh_data;              function __construct($arguments) {             // Code to populate the protected variables declared above         }              protected function get_value_internal() {             // Internal here means get data from cache.                  // Call get_value_external If cache data has expired or does not exist         }              protected function parse_json_data($data) {             // This function parses data and gets the requested value from it         }              public function display_value() {             // This is a public function which outputs the value                  // Call get_value_internal                  // Display the value with icon, etc.         }              //This will be different for all networks because every network would have a different method for retrieving data         abstract function get_value_external();     }          class Facebook_Social_Network extends Social_Network {         function get_value_external() {             // Unique code for retrieving data from Facebook                  // Process the data fetched above and parse it using the parse_json_data function defined in our abstract class             return $this - > parse_json_data($data);         }     }          class Twitter_Social_Network extends Social_Network {         function get_value_external() {             // Unique code for retrieving data from Twitter                  // Process the data fetched above and parse it using the parse_json_data function defined in our abstract class             return $this - > parse_json_data($data);         }     }          class YouTube_Social_Network extends Social_Network {         function get_value_external() {             // Unique code for retrieving data from YouTube                  // Data returned by YouTube is processed differently so this doesn't use the shared method parse_json_data                  // Process the data and put it inside a variable named $value which will be returned below                  return $value;         }     }      I will appreciate if someone good at OOP can take a quick look and tell me if I am on target with my understanding, close to the target or way off? One thing that's bothering me is whether I should have just used one class which would handle all Networks? * * *


Scientific software design

I asked this question over at stackoverflow and it was suggested a tighter form be posted here. Many early career numerical researchers face the prospect of having to create performance critical software from the ground up. Most are ill equipped to do so, and my lab is no different. I currently work extending a sophisticated C application that is typical of a lot of academic code -- it is a nightmare to work with and adding new features takes much longer than it should. I want to learn how to do it better, and I learn by doing. With that in mind, I would like to jump in the deep end and create an application that is parallel (OpenMPI + maybe OpenCL), combines script driven Python UI with C++ for the heavy lifting, and most importantly, makes use of appropriate design patterns to make the code as modular as possible. The primary reason for doing so is to learn the major gotcha's and some general performance techniques that can be documented and shared around the lab. I have read some of the books around OO and pattern's, but I find it challenging to take their abstract nature and apply it to the problem domain in a useful way. I guess the question I am asking is: **if you were given the task to design this kind of software, what would be the focus of your first hour in front of a whiteboard?**


Should custom data elements be stored as XML or database entries?

There are a ton of questions like this, but they are mostly very generalized, so I'd like to get some views on my specific usage. **General:** I'm building a new project on my own in Django. It's focus will be on small businesses. I'd like to make it somewhat customizble for my clients so they can add to their customer/invoice/employee/whatever items. My models would reflect boilerplate items that all ModelX might have. For example:   * first name   * last name   * email   * address   * ... Then my user's would be able to add fields for whatever data they might like. I'm still in design phase and am building this myself, so I've got some options. **Working on...** Right now the 'extra items' models have a FK to the generic model (`Customer` and `CustomerDataPoints` for example). All values in the extra data points are stored as char and will be coerced/parced into their actual format at view building. In this build the user could theoretically add whatever values they want, group them in sets and generally access them at will from the views relavent to that model. _Pros:_ Low storage overhead, very extensible, searchable   _Cons:_ More sql joins My other option is to use some type of markup, or key-value pairing stored directly onto the boilerplate models. This coul essentially just be any low- overhead method weather XML or literal strings. The view and form generated from the stored data would be taking control of validation and reoganizing on updates. Then it would just dump the data back in as a char/blob/whatever. Something like:               <datapoint type='char' value='something' required='true' />     <datapoint type='date' value='01/01/2001' required='false' />     ...      _Pros:_ No joins needed, Updates for validation and views are decoupled from data   _Cons:_ Much higher storage overhead, limited capacity to search on extra content * * * **So my question is:** If you didn't live in the contraints impose by your company what method would you use? Why? What benefits or pitfalls do you see down the road for me as a small business trying to help other small businesses? _Just to clarify, I am not asking about custom UI elements, those I can handle with forms and template snippets. I'm asking primarily about data storage and retreival of non standardized data relative to a boilerplate model._


Mobile compatible JEE application

Does using frameworks like AngularJS/Backbone JS/Bootstrap/Foundation etc. automatically make the web application mobile device compatible? Is there a framework/design approach to make applications (new or existing) mobile compatible? To put it simply; is there a framework/guideline/library which I can use in my JEE web application UI layer making it automatically compatible both on computer browsers and mobile devices (iOS phone, iPad, Android phones and the whole array of it).


Why don't we completely de-couple frontend JS frameworks and backend APIs?

Whenever we implement a frontend framework in the likes of Backbone, AngularJS etc. there's an integration process involved with the backend technologies like NodeJS, Rails, Yii etc. (like setting up routes, generating views or adding libs etc.) which varies depending upon what you select at the front-end and what you take at the backend, my question is: Why don't we completely de-couple the process so that front-end (HTML, CSS, JS etc.) is completely independent while backend APIs returns us desired data only, just like we do in mobile development.


Modifying an open-source license with optional requests

A general question about open-source licenses: I know you can't modify them yourself (i.e. "GPL except you can't do this") and writing your own is generally a bad idea. However, is it feasible to add "Please do this" riders? For example, say that I want to license something under the GPL. Can I add a clause which says `"If you release a fork of this software, you are hereby requested to contact so-and-so and notify them"`? Would this count as a different license? For that matter, is the license even the right place for such a request, or should it go in a README (and if so, how would you get it to propagate)? **Edit:** To clarify, I'm primarily asking whether this is something that **can** be done, and only secondarily whether it's a good idea (I suspected not, and the first responses confirm it). I have no intent of actually doing so, it's just inspired by an unrelated discussion I had.


Purpose of building file using Make

I am trying to understand what is the purpose of making files using commands such as `cmake ..` and `make`, I have tried looking online but there is no concise explanation on its purpose that i could find. Also, is it necessary to use `make` on a project folder that is not built in order to use the source (C++) in other projects. I know this may be a simplistic question, but as i am fairly new to building files, any information or references would be much appreciated.


How to get money from reluctant client?

I completed this website 4 months ago. (I would like to keep the website anonymous - if this post comes up on google search for his customers, it will have a negative impact on his business). We did several iterations, he was very demanding (and nosy), I complied with every single thing he wanted, including the font-size of the footer which destroyed the aesthetic looks by quite a bit. (and he messed with the colors too, making it look dangerously childish and unprofessional) Anyway, he was very friendly during he whole process. After getting all the requirements I accepted to build the website for £950 and I charged him £150 in advance so he wouldn't want to bail out after I started the work. The requirements kept changing quite a lot, I made adjustments as and completed the website just 5 days late, w.r.t. the agreed date, in-spite all the changes in requirements. That was four months ago. He has never returned my calls nor replied to my emails since then. How do I get the money back from him? I really need some advice on this, this is the second time someone has not payed me. ### Points to be noted: 1) We did not sign any contract - he was a friend of a friend.   2) I still hold the passwords for ftp, cpanel and everything. I don't want to bring the site down. somehow it doesn't seem ethical to me.   3) I posted this on stackoverflow and it was closed, I was redirected here. **EDIT**   Thank you everyone, for your enormous support. I thought I should include some more details: He is hosting the site. as in, I made him register and use his own debit card to buy the domain name, webspace and everything, I just have the passwords for his cpanel, and ftp (well, I have access to cpanel that pretty much gives me access to many things) Now, if I give him a warning, he might change the password to cpanel, but I am fairly sure he doesn't know about ftp's. **UPDATE**   I followed `Anna Lear`'s advice and sent him the final invoice, on Saturday, with a warning that I will take the site down if he doesn't respond to my email before this Tuesday. He hasn't replied to my emails yet, but I will let you know how this goes. Thanks much for your support. I plan to put up a holding page as `Darknight` suggested after Tuesday. **Points**   I dont have a server space of my own, however I have few web spaces of my clients but I dont want to use them for these kind of purpose. **RESULTS**   After my follow up of final invoice and warning, the client refused to anything. workman's advice seemed to be the most sensible to me. I mirrored the site to my own webspace, logged into his CPanel and forwarded the website to my site. Once that was done, I put up a holding page on my site so anyone going to the website would see a holdup page (nothing fishy, just an Under Construction page). Of course, this was all very weak in the sense that if my client knew about CPanel he could just remove the redirection. But, I had this second chance to get back to him and I was relying on him not knowing anything. Two hours later, I got a call from the said client, (and he was acting as if he did not get any of my voice mails or emails) and asked me to get the site back up. I, of-course, said I had to be paid and two days after that he made a bank transfer. His site's back up and running now. Just wanted to say thank you all very much, I was very desperate when I had started this question. You guys are the best, not only you told me to learn the lesson (which I did) you also gave me a very very good solution that seemed to be very ethical (almost) to me. A BIG thank you to workman! * * * If I could choose more than once answer, I would have chosen `Anna Lear` too, but since I followed workman's advice I had to pick that up. People who made a point about not taking the site down without consulting a lawyer, thanks a lot.


How is Delphi going on the market? Is it worth yet to make a project in Delphi?

I use Delphi since 1999 because it is visual, fast, helpful and committed to good programming roles. That's what I tell my friends in the university and interviewer when I apply for a job in any software house. But I am very criticized for using Delphi and for Windows development. It is prejudice IMHO. They say I should use open source technologies and develop in Java, Ruby, Python and other "new" technologies, and I should only develop for the Web and cross-platform. I tell them I do code in Java and PHP when necessary but I dislike script and byte-code languages, but I would not matter if suddenly Embarcadero did a Delphi version with Java, what matters is the IDE and the concepts (RAD Studio still has .NET and C++). I "teach" them that those languages are almost old as Pascal. I tell them that Delphi is so powerful that I can do almost anything with it (with special respect for VCL) and that is becoming a very good cross- platform software compiler, with options to OS-X and iOS. I think at creating a LT about Delphi to present it to people, because after discussion they leave not convinced. And after that I always stop later and think what if I am really wrong about it. But then I open StackOverflow I see all these splendid professional who works with Delphi and knows so much and I think back how can I be wrong!? I my region clients do not care much how the software is made as long as it works and is cheap.   1. So, I am wrong or not?**   2. **So, how about Delphi acceptance in your country's market?**   3. Is there still a place for Delphi specialized professionals, or everybody just want C# and dotNET when it comes to Windows?   4. Is it worth doing a project in Delphi and some year from now have to make a version for the web (which will take longer to be finished considering my skills)? _Please, if you do not feel comfort on this question because there might be opinion based answers, just focus on item 2, which can be based on generally statistic data._ I am my own Boss and I am starting a big project. I have to make a decision if I will go Delphi or Web. Considering that I can finish the project much faster with Delphi (experience and facilities), it's very important to know if I am choosing right. I have to consider that I have years of written code that I made and reuse.


Why is an A element often used instead of a BUTTON for web design?

Is there any particular reason why people use the A tag to mimic a BUTTON in HTML and JavaScript?


What's a good math textbook to have on my desk while studying Haskell?

I just started learning Haskell and it seems like you can't get too far in the language without being comfortable ( or at least exposed ) to certain branches of mathematics. Unfortunately I have major holes in such areas and am wondering what is a good introductory textbook that covers all the concepts Haskell uses? For what it's worth, I have an undergraduate engineering degree ( not comp-sci or EE ), though the math I was exposed to was of the hand-wave and memorize variety. I also took an intro to comp-sci course where we did a few weeks of oCaml.


Best Practice of making a Composite Control with a repeater activity It's Templated-Based, have paging support via a DropDown and 2 Buttons It should have Event-Handling also Needed to work as a package for ( so didn't want to give template-editability or much programming options ) **Key Parts to answer :**   1. A Custom Repeater, A Composite Control , A Custom Control with functionality similar to repeater or `CompositeDataControl`?   2. How prepare and get the data to avoid repetition of the processes I did all controls creation and initiation in `CreateChildControls`   but seems that it is running in every request, Is it good to let all the controls created on every Postback or We have to Control this process, How do you suggest   3. Cause we want to Bind via the repeater should we do anything regarding of Data Binding inside the Composite Control ? In my example I binded the repeater (just the repeater) in a method that will run in each run in every serious event like `OnLoad` (Conceptually we binded the repeater, not the CC)   4. How to make a property such as Page Number persistent via postbacks use `viewStates` or if any click we pass the new Page info from session to the control it should do the job ? What is your Paging Strategy, In simple Lines   5. Should I store anything of the Repeater in **ViewState/Control State** and assign a property for them ? want to know your decision, best-practice other professionals know and suggest


Alternatives to inheritance on complex structures?

I'm working on an ASP.NET Webforms project, using the MVP Pattern (which the presenters as you may know use a Page Controller pattern). I'm given a rather complex inheritance chain for my controllers. Below I depict a small example of the structure I'm facing (it is way bigger structure in my app): ![enter image description here](http://i.stack.imgur.com/zT5Is.jpg) A lot of code among these controllers is duplicated (i.e. creating cookies in RegisterPageController and LoginPageController, access Customer data in ProfilePage and BuyProductPage...), so I decided to systematically apply Template pattern and create an inheritance structure that would allow me to reuse as much of the code as possible (i.e. Creating an AuthenticatedPageController that checks that the user is authenticated and then BuyProductPage and ProfilePageController inherits from this class, reusing the authentication part of the code). However, as I progress refactoring my code and apply more Template pattern, the inheritance chain starts to become more and more complex, and sometimes trying to create a new hierarchy among all my other classes becomes too tedious. I was wondering if there was a better approach to tackle my issues. I've been reading about composition (I read this post Alternative to "inheritance versus composition?") but I'm not sure about how to implement it nor if this would be the best approach for my case. Can anyone enlighten me? Thank you.


Explanation of the Google Gravity trick

I am not much of a JS developer, but I stumbled upon this site called Google Gravity (those who haven't used it, try doing a search there - you'll be amazed), which is a remastered Google homepage. From then on, I've been thinking and wondering about learning more on how the guy implemented it. I tried googling, but could not find a good explanation of the implementation. All the JS/CSS Gurus, can you point me to a location where I can learn more? I already know the basics of working with jQuery and AJAX. Thanks, Yati Sagade


What are the pros and cons of implementing this requirement in different layers?

I have a CRUD app for `<DomainObject>`s. They are persisted in a database. There is a new requirement: keep track of the `<DomainObject>`s that have been created since the app was opened, so that the user can see what he/she has done. I see three ways to implement this:   1. every time the app is opened, create a new sessionid (for lack of a better name) and store it in the database. Store the sessionid as a foreign key for each `<DomainObject>`. Use a custom query to access the data (i.e. `select * from DomainObject where sessionid = "currentSessionId"`)   2. same as 1., except perform the filtering in the business layer   3. don't keep track of this data in the database. Instead, have the model keep track of the new `<DomainObject>`s **The problem:** I don't have enough experience to understand the consequences of each approach. For example, it seems like 1. puts business logic in the database. But 3. doesn't persist some of the data. **What are the pros and cons of each approach?**


Can NoSQL databases be used in e-commerce companies for order management?

Is it possible to use a non relational database be in an Order management system for an e-commerce company with a large number of orders everyday, like Amazon? Can the benefits of Non Relational databases (scalability, reliability etc) be exploited in this scenario, or, is it impossible to give up ACID properties and hence mandate that only a relational DB be used for this purpose?


Why after each restart, my local .NET sites take time to load for the first time?

I'm developing sites based on .NET platform. I usually deploy these sites on my local IIS, so that I can test them and see their functionality before going live. However, each time I restart windows, it seems that sites take a long time to run for the first time. I know about JIT and I'm also aware of this question, but it doesn't answer my question. Does JIT happens every time you restart windows? Is it related to creation of w3wp.exe process? Why sites are so slow for the first request after each restart?


Software bundle containing LGPL libraries as Java Fat-Jar Archive

At work, we're deploying a software bundle of a Java application (written by us) which has lots of external dependencies, most of them being LGPL and BSD- licensed third-party-libraries distributes as JAR archives. Currently, we're deploying a test-client of the software which is distributed as a single java fat jar archive, created by the Maven assembly plugin, which does roughly the following:   * extract all dependencies   * rebundle them as a single jar-archive All class files are extracted, and then bundled back into a single JAR file with our own application. I realized that also some files get overwritten, mostly LICENSE.txt-files, due to having the same name. I'm wondering whether this is correct and complies with the LGPL license. What would be a better way to distribute the software? How would this particular package be best organized? We did not incorporate any source code directly into our source files, nor did we touch the binary files. The source code of the libraries accompanies the whole product. (It is software that is internally used, not deployed to customers or anything, but I guess that does not matter.) PS: I asked the same question on Stack Overflow, and I was suggested to ask it here.


When programming for a new platform, do you change the keyboard mapping to what you're familiar with?

I've been a Windows programmer for a decade or more now, and I'm currently doing my first ever Macintosh project. One of the things that is driving me bonkers is how the keyboard maps differently. There's the little things, like how the equivalent of ALT+TAB in Windows is COMMAND+TAB, which for a standard USB keyboard winds up being WINDOWS+TAB. Then there's the really annoying things, like maneuvering through text in a document is different. In Windows if I want to select a line's text I can position my cursor at the end with the END key, hold SHIFT and hit HOME. On the Macintosh the END key takes you to the end of the document (which, to be fair, is somewhat logical) and holding down SHIFT and the HOME key just selects the entire document up until the cursor. The ALT+arrow keys are more what I'm looking to do. My attitude towards this has been basically to suck it up and learn the new way of doing things and adapt to the idea of going back and forth. My reasoning is that this likely won't be the last new platform I ever program for in my career and it probably benefits me both as a programmer and a computer user to be flexible. In addition, there's always going to be machines I go to where mapping the keyboard isn't in place already, or may not be an option (i.e., helping troubleshoot a QA machine). Plus not everything I'm used to in Windows is going to have a Macintosh equivalent. However, right now I'd be considerably more productive if I were to make things more like Windows. For people who have been working with multiple platforms, do you change the mappings to make everything like what you're familiar with? Or do you do what I'm currently doing which is to suck it up and learn the different way of doing things?


The importance of the length of a program?

* Why is the length of a program important?   * What difference does it make? [Aside from the fact that a short program looks "good".]


Use-cases for node.js and c#

I do quite a bit of ASP.NET work (C#, MVC), but most of it is typical web development. I do Restful architecture using CRUD repositories. Most of my clients don't have a lot of advanced requirements within their applications. I'm now looking at node.js and it's performance implications (I'm addicted to speed), but I haven't delved into it all that much. I'm wondering if   * node.js can realistically replace my typical web development in C# and ASP.NET MVC (not rewriting existing apps, but when working on new ones)   * node.js can complement an ASP.NET MVC app by adding some async goodness to the existing architecture. Are there use-cases for/against C# and node.js? ### Edit I love ASP.NET MVC and am super excited with where it's going. Just trying to see if there are special use cases that would favor node.js


Is it OK to have multiple asserts in a single unit test?

In the comment to this great post Roy Osherove pointed to the OAPT project that is designed to run each assert in a single test. This is written on projects home page: > **Proper unit tests should fail for exactly one reason,** that’s why you > should be using one assert per unit test. And also Roy wrote in comments: > My guideline is usually that you test one logical CONCEPT per test. you can > have multiple asserts on the same _object_. they will usually be the same > concept being tested. I think that there are some cases when multiple assertions are needed (e.g. Guard Assertion), but in general I try to avoid this. What is your opinion? Please provide a real word examples when multiple asserts are really _needed._


How should I expand Jenkins to help me release?

Pushing new Sparkle releases of our internal apps is a pain. I have to make the build, make the release notes file, sign the .zip with the private key, and add a new entry to the appcast file tying everything together. I'd love it if Jenkins could help: use the commit messages for the release notes, and automatically do the rest of it. Should I be looking at writing a new Jenkins plugin, or using shell scripting, or is there something already that will do what I want? (A quick Google didn't find anything.)


What reasons are there to reduce the max-age of a logo to just 8 days?

Most websites set `max-age=31536000` (1 year) on the `Cache-control` headers of static assets such as logo images. Examples:   * YouTube   * Yahoo   * Twitter   * BBC But there is a notable exception: Google's logo has `max-age=691200` (8 days). I've checked the headers on the Google logo in the past, and it definitely used to be 1 year. (Also, it used to be part of a sprite, and now it is a standalone logo image, but that's probably another question...) What could be valid technical reasons why they would want to reduce its cache lifetime to just 8 days? Google's homepage is one of the most carefully optimised pages in the world, so I imagine there's a good reason. * * * **Edit:** Please make sure you understand these points before answering:   * Nobody uses short `max-age` lifetimes to allow modifying a static asset in future. When you modify it, you just serve it at a different URL. So no, it's nothing to do with Google doodles. Think about it: even if Google didn't understand this basic trick of HTTP, 8 days still wouldn't be appropriate, as only those users who _don't_ have the original logo cached would see the doodle on doodle-day – and then that group of users would go on seeing the doodle for the following 8 days after Google changed it back :)   * Web servers do not worry about "'filling up' the caches of clients (or proxies). The client manages this by itself – when it hits its own storage limit, it just starts dropping the lowest priority items to make space for new items. The priority score is based on the question "How likely am I to benefit from having cached this URL?", which is nothing to do with what `max-age` value the server sent when the URL was originally requested; it's a heuristic based on the 'frecency' of requests for that URL. The `max-age` simply lets the server set a cut-off point – the time at which the client is supposed to discard the item regardless of how often it's being re-used. It would be very nice and trusting of a downstream client/proxy to rely on origin servers 'holding back' from filling up their caches, but I don't think we live in that world ;)