Is it useful to keep 'definition' entities in a database vs using an enum?

In a project that I have started working on, the database has a lot of `FooDefinition` tables which act like an enum. It's a C# project using Entity Framework although that is not central to the question. The entities have an ID, a string Name field and an int Type field that is converted to an enum. For example:               public class FooDefinition     {         public int Id { get; set; }         public string Name { get; set; }         public FooType FooType { get; set; } // this is an enum that defines the entity     }      The FooDefinition table is populated with an entity for each defined enum value, and does not change unless there is a new enum value added. I am struggling to see the use in this pattern over just using the enum directly as opposed to joining on this Definition table. What are the possible benefits of this approach?


Greenspun's Tenth Rule, does every large project include a Lisp interpreter?

Greenspun's tenth rule (actually the only rule) states that: `Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp.` My memory is that there are some papers on the topic, perhaps for Borland's Quattro (spreadsheet) project and possibly others. Google is unhelpful, maybe the right search terms are not coming to mind. I am looking for papers or articles supporting this claim, if any.


How can I inspire my group to start using an online collaborative tool more?

I'm in a project with 4 other people, and I've been willing to fully adopt a collaborative tool in order to make it possible to share information and store data (PDFs, DOCs, etc.) in an online tool, rather than doing it by e-mail. The problem is that I'm the only one enforcing it; actually I'm the only one using it. The others only use it when I ask them to do so. How would you handle this? Have you experienced something similar, if so, what have you done?


How can you measure your own daily contributions?

I've recently finished the _The Three Signs of a Miserable Job_ by Patrick Lencioni and one of his core ideas is that you need to have _some_ form of measurement. I have a pretty standard internal developer job where I work on new tools and do some support/bug fixes for past tools I have written. For purely personal fulfillment reasons, what things would you measure on a daily basis? (This is not a report to managers and not something to game, just something to help me mark progress). The goal is to find things that measure not just productivity, but how good of a job you are doing (so a customer service person might record positive interactions in addition to number of calls taken). My stab at this would be to measure two things every day: support requests opened/closed and number of checkins to source control. I understand if this gets closed, but once again this isn't a question about management, its about personal development as a programmer/software developer.


Is it reasonable to run processes with CI tools?

At my company, we have a quagmire of disparate cron jobs (on multiple systems) and manually kicked off processes which keep our business functioning that is a result of years of expedient development and subsequent neglect. Someday, we will need to come up with a more centralized solution for obvious reasons. One thought that we have been kicking around is to use our Continuous Integration software (Jenkins) to run these processes, which seems logical. **My question is whether or not other companies are doing this? Is this a generally accepted practice? Doesn't this conflict with the definition of a CI tool implicit in its name? Are there any other options?** Note: https://wiki.jenkins-ci.org/display/JENKINS/Meet+Jenkins Jenkins claims that it focuses on "Monitoring executions of externally-run jobs, such as cron jobs and procmail jobs". I'm not sure if this is exactly what I am talking about.


PHP web application architecture/design

I've been thrown head-first into a new job developing web applications in PHP. I'm by no means new to PHP, but I haven't developed large-scale applications before. I'm wondering how to structure my development to avoid setting myself up for problems in the future. How do I design and architect my applications in a sound way that allows them to scale over time in terms of functionality and performance. I'm thinking of things like:   * Separating back end from front end   * Directory structures I would appreciate pointers to architectural and application design patterns, frameworks and methods that allow me to approach large-scale PHP web application development in a sustainable way.


Estimating Cost of modifying someone elses code

I am relatively new to web development and haven't had to provide estimates for many large projects yet (my last large project was just paid for by the hour without a strict deadline or budget). A client is asking me to provide a cost and time estimate for providing a myriad of changes to another developers code for a website (php/mysql backend). Can anyone provide some advice or links on how to go about analyzing and estimating this? The code is horrible (the website was originally outsourced to india years and years ago) and it's hard to know if I'm going to suddenly hit hurdles and blow my estimates out of the water.


Is there a language between C and C++?

I really like the simple and transparent nature of C: when I write C code I feel unencumbered by "leaky abstractions" and can almost always make a shrewd guess as to the assembly I'm producing. I also like the simple, familiar syntax for C. However, C doesn't have these simple, helpful doodads that C++ offers like classes, simplified non-cstring handling, etc. I know that it's all possible to implement in C using jump tables and the like, but that's a bit wordy at times, and not very type-safe for various reasons. I'm not a fan of the over-emphasis on objects in C++, though, and I'm gun shy of the 'new' operator and the like. C++ seems to have just a few too many hiccups to, for instance, be used as a system programming language. Does there exist a language that sits between C and C++ on the scale of widgets and doodads? Disclaimer: I mean this as purely a factual question. I do not intend to anger you because I don't share your view that C{,++} is good enough to do whatever I'm planning.


What do programmers want in a web API?

I'm currently building a web API for popular piece of forum software (XenForo). What kind of things do developers find important in a web API? Are there certain architectures (REST, SOAP, etc.) that are much better than just doing my own thing? The API I have the most experience with is MediaWiki's API, but that doesn't seem to follow any sort of standard. What should I be planning to include (e.g. output formats, OAuth) and what are some good examples to follow?


How to comfortably monitor 5 daemons while developing them?

This is the scenario: I'm on this project for which I wrote 4 Node.js scripts that act as "servers" for some service (they have to be separated). I also use Redis, that is another service to keep an eye on. The system is not yet in production (the reliability of it will raise another set of problems, but not now). While developing, those services spits a lot of interesting console.log() messages that I care of. I'm actually using a big terminal window split in 4 with GNU screen, but every time I have to start screen, ctrl+a+c, ctrl+a+c, ctrl+a+c and so on then manually start the services. How would you comfortably automate this operation? Or are there some tools to better enhance MY user experience as the shepherd of those little monsters? :) I'm on my way using ANOTHER service that will publish those logs via HTTP. The logs (mostly debug messages) will be published by the other 4 guys in a Redis channel that the log2http server will subscribe to...


What does artifact mean?

The dictionary defines artifact as: > artefact, artifact [ˈɑːtɪˌfækt] n > >   1. something made or given shape by man, such as a tool or a work of art, > esp an object of archaeological interest > >   2. anything man-made, such as a spurious experimental result > >   3. (Life Sciences & Allied Applications / Biology) Cytology a structure > seen in tissue after death, fixation, staining, etc., that is not normally > present in the living tissue > > The word `artifact` often appears in software development, software development cycles, effort estimation, etc. But the above definition doesn't make sense to me in that context. Could someone please explain this word by giving some specific examples from software industry?


What standards does your team use for your specification documents headers and footers?

## TL;DR: What header/footer do you put on your Functional&Technical specifications to avoid people having different versions at meetings? ## Story: We're have a lot of documents, being changed by everyone. Functional specifications, technical specifications, addendums, etcetera. Problem is offcourse that during a meeting, after an hour someone notices their printed version differs from someone else's. I thought this could be solved by forcing everyone to use the same header/footer on each document: ### Header   * Project concerned   * Document title (center aligned)   * Document author (right aligned) ### Footer   * Last modification date   * Date on which document was printed   * Full document path and name (which always include the version number)   * Page X of Y This way, we could all easily check the filename and last modification date before starting the meeting, and make sure everyone has the same copy and is talking about the same document. Would this work? Am I missing something? What do you guys use for your specifications to avoid versioning problems?


In pair programming, what is each role named, and why?

I've heard the person at the keyboard named the "driver", and the other person named the "navigator". I've imagined rally car racers, where the person at the wheel just _cannot_ keep up with _everything_ that's happening, and they _must_ have the help of the "navigator", who's shouting volumes and volumes of directions at them to, literally, keep them "out of the weeds", much like a person at the keyboard is kept "on course" by the person in the second chair. What are the more/most commonly accepted terms for the two roles in pair programming, and (if it's not obvious) are they borrowed from any earlier professions?


Team Git workflow working with a multi-project Sitecore solution using TDS

We are a team of 8-10 developers working on different parts of a Sitecore instance. In the past we've used SVN and more recently (and successfully) Hg, but are moving to using Git as our primary source control. We're working with Sitecore 7, and using the latest TDS from Hedgehog. In case it matters we're also using the Glass.Mapper.sc lib from Mike Edwards. The problem we're running into, especially compared to how easy it was with Hg, is that merges are a nightmare. It doesn't help that most of our team is new to Git, but most of us have at least used Hg so it's not a huge leap. We've had so many problems that we moved to a merge-master setup, where the team leads are handling all the merges. My question is this: From people using these tools, what would you suggest is the best workflow and supporting configuration? A team member suggested rebasing to reduce conflicts, but that doesn't seem to matter. Our Hg workflow, which worked very well was: 1) Commit local changes as many times as needed. 2) Pull changes from the server, and update to the remote branch after any merge. 3) Sync TDS. We do this after the pull so that we're not overwriting the .scproj file in the merge 4) Commit the merge and TDS sync 5) Push the results back to remote We didn't have merge nightmares and tds was kept very clean. We tried to adapt something similar with Git and have wasted a lot of time each week to resolve issues. We currently have each dev working in their own branch because of the merge errors working with everyone in master. The type of merge issues I'm seeing seem to mostly come from what Git merges automatically. I definitely don't want to merge everything by hand every time, but I wouldn't mind doing project file merges by hand. We're using Sourcetree and I have BeyondCompare Pro. Any suggestions, especially coming from successful implementations, would be greatly appreciated. If there are simply config changes that can be made or a change to our workflow to make the process more reliable I'd love to learn about them.


declaration and definition

People say definition is used when the declared stuff has some memory allocated. If I declare a class               class fish     {       char* name;       int type;       //someting i dont know about fish     };      int main()     {         fish a;        return 0;     }      Should it mean this is a declared fish or a defined fish ? Let me try first! it is called a defined fish! I now leave a breapoint at //something..... (that is a valid declaration of something I just dont know) Do you know what is there that at //someting the debugger may never reach ? Does that also mean there is no memory allocation for it. I'll be deeply sad to hear a no.


How best to learn OOP concepts/principles practically?

I wanted to learn object oriented programming language, I dont want it for any purpose just to know the whole concept of OOP. So can anyone tell me which language I should start learning?


What is the "PHP Way"?

I see constant references to the " Way," such as descriptions of a particular framework or application as "Pythonic," a certain person as a "Perl hacker," or "true Ruby code," but where are the "PHP hackers," the "PHP-ic" applications, the "true PHP style"? This made me think - does PHP even have a definite style? Saying PHP is easily "changeable" to other styles doesn't count, as the same goes for any reasonable language. Any input much appreciated.


Distributed SVN?

I work for a large bureaucratic (and security paranoid) organisation that provides SVN for its development teams to use. I am working with a 3rd party vendor (at their site) and we currently share code via SVN export and patch files. The only way I have for transferring files is by a FTP drop box or email. I would like a better way to work. I am currently lobbying to get some kind of DCVS system setup, ideally cloud hosted. Failing that I want a better way to manage keeping SVN repositories in sync. In the meantime (or if I fail to get DCVS) how do I keep two SVN repositories in sync? How do I best manage exporting the repository? How do I manage incoming changes?


Is it poor technique to have functions within a class depend on one another in a "cascade" type fashion?

I am fairly new to PHP and OOP. Having said that, I wanted to know how independent functions should be within a class. I know that each function should be responsible for doing just one thing. However, as you can see in my class below, I occasionally find myself creating functions that build upon one another in a "cascade" type fashion. Is this good practice? Is there a different way I should be structuring this class/these types of functions? I want to make sure I am developing good habits. Thanks in advance for your help.               class PubMedQuery {          private $query;     private $searchParameters;     private $searchURL;     private $fetchParameters;     private $fetchURL;     private $searchResults;     private $fetchResults;     private $matches;     private $matchRegex;     private $emailAddresses;          public function __construct($query) {         $this->query = $query;     }          public function setSearchParameters() {         $this->searchParameters = array(             'db'         => 'pubmed',             'term'       => $this->query,             'retmode'    => 'xml',             'retstart'   => '0',             'retmax'     => '1000',             'usehistory' => 'y'         );     }          public function getSearchParameters() {         return $this->searchParameters;      }           public function setFetchParameters() {         $this->fetchParameters = array(             'db'        => 'pubmed',             'retmax'    => '1000',             'query_key' => (string) $this->searchResults->QueryKey,             'WebEnv'    => (string) $this->searchResults->WebEnv         );     }          public function getFetchParameters() {         return $this->fetchParameters;      }           public function setSearchURL() {         $this->baseSearchURL = 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils /esearch.fcgi?';         $this->searchURL = $this->baseSearchURL . http_build_query($this->getSearchParameters());     }          public function getSearchURL() {         return $this->searchURL;      }          public function setFetchURL() {         $this->baseFetchURL = 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?';         $this->fetchURL = $this->baseFetchURL . http_build_query($this->getFetchParameters());     }          public function getFetchURL() {         return $this->fetchURL;      }          public function setSearchResults() {         $this->setSearchParameters();           $this->setSearchURL();         $this->searchResults = simplexml_load_file($this->getSearchURL());     }          public function getSearchResults() {         $this->setFetchParameters();         $this->setFetchURL();         return file_get_contents($this->getFetchURL());      }          public function setEmailAddresses() {         $this->matches = array();         $this->matchRegex = '/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}/';          preg_match_all($this->matchRegex, $this->getSearchResults(), $this->matches);         $this->emailAddresses = array_unique(array_values($this->matches[0]));     }          public function getEmailAddresses() {         $this->setSearchResults();         $this->getSearchResults();         $this->setEmailAddresses();         return $this->emailAddresses;     }     }          //Example using search term "psoriasis"     $query  = new PubMedQuery('psoriasis');     echo implode('<br />', $query->getEmailAddresses());


How can I justify software testing to management?

I work for a small company (less than 200 employees) whose software group only makes up a small part of our staff (4 employees, occasionally with a few contractors). The four of us have been making strides in transitioning to better practices, and one of the next logical steps is to improve our testing. As anyone who has done any meaningful tests knows, testing takes a lot of time - and at my company, it takes too much time to justify to management, so we generally do what little we do on the sly. I don't think this is serving us well, as we keep coming up against otherwise avoidable problems when we ship under-tested software. I would like to be able to come to management with a justification for hiring a dedicated software test engineer (someone who can both write automated tests and perform manual ones). Are there any good published studies that show the benefits of adding such a position to a small company? Where can I find information about costs associated with the position? I plan on doing a little number crunching on our own history, but having some external sources to point to would help bolster my case.


async+await == sync?

Stumbled upon this post that talks about making async web requests. Now simplicity aside, if in real world, all you do is make an async request and wait for it in the very next line, isn't that the same as making a sync call in the first place?


What design pattern matches this problem the closest?

I have two objects, one is a User object and the other is a Content object. The User object has properties like 'reads_articles' or 'reads_books'. The Content object has properties like 'is_article' or 'is_book'. If the two properties match up (i.e. the User reads_articles and the Content is_article), then the User can see the Content. Basically, I am looking for the best solution to approach this without using a switch() statement. I am also wondering if maybe I'm making this too difficult and/or a design pattern is overkill here. Preliminary research has suggested that the Strategy pattern may be the most appropriate, but I'm having a hard time modeling this problem to that pattern. I don't want to hard code the tests - I would really like to come up with a general solution that examines the properties of both classes, and determines whether the Content can be viewed by that User. Clarification: My end goal is an algorithm that will examine the properties of the User and the properties of the Content, and see if they match. Basically, I want to see if the two objects have matching properties (without hardcoding the properties themselves into the algorithm) and do some actions. Not sure if what I want is a pipe dream, so I thought I would ask. Thanks for the help!


Did I answer this correctly and concisely?

By email I just answered my brother who is learning computer programming that C++ and Java are more similar than C and C++ even though C++ is nearly a superset of C. Do you agree? AFAIK Stanley Lippman wrote the "canonical work" (C++ Primer) on C++ and Dennis Ritchie and Brian Kernighan wrote the "canonical work" (The C Programming Language) on C but I'm no C++ expert so I ask you the question. Here is the conversation translated to English: > ---------- Forwarded message ----------   >  From: Niklas   >  Date: 1 May 2013 07:22 > > It is rather that one knows Java if one knows C++. > > There is more difference between C and C++ than between Java and C++ example > C + + features, but does not use, pointers, rather than using C + + so- > called references which also are used in Java instead of pointers. In C > dynamic memory is allocated with malloc and in C++, this is done with the > keyword new and in C is dynamic memory is released using the keyword free > which in C++ is called called delete. > > Operating systems get programmed in C and assembly language, and > applications such as GUI programming are done with more object-oriented > languages e.g. C++, Java, Visual Basic, Flash...so it depends on what > problem you want to solve, CPU scheduling or widgets. There are different > paradigms. > > On 1 May 2013 07:16 wrote Holger: > > I'm reading a book on C++. So far it seems to be identical to java, except > for a few minor syntactical variations (include instead of import, etc.), > but I assume that the differences will subsequently. Is it possible to > automatically C if it can C + +? > > On May 1, 2013 6:45 AM, "Niklas" wrote: > > Hello! Here is the pdf of programming in C. It's fine to ask me if you have > any questions. Sincerely, Niklas


How to generate random numbers without making new Random objects?

I'm using this as part of a game, but it's not really a game development question, so I'm putting it on this more general Stack Exchange. The goal is to generate "random" outputs for a fixed integer input, but (and this is the clincher) to generate the _same_ random output every time the _same_ random input is put in. The idea here is that the function will generate the world the same way every time, so we don't need to store anything; the function itself is the storage. Unfortunately access speed is a little slow, because the only way I can find to generate random numbers is to create a new Random() object with a seed based on the input, which is surprisingly slow. Is there a better way? I'm not worried about crypto-safe generation; in fact I'm just going to pick a random seed in advance and expose it quite publicly. The current code looks like this:               private const int seed;          public MapCell GetMapCell(int x, int y)     {         Random ran = new Random(seed + (x ^ y));         return new MapCell(ran.NextInt(0, 4));     }      Where the `MapCell` is one of four types (in fact it's more complicated than this, but not a whole lot). The point is that this could be called for any parameters, at any time, in no particular order, but it needs to return the same answer every time, if x and y are the same every time. That's why I can't fix a certain Random object and use it repeatedly. I also don't want to store anything, because I want to keep the RAM usage quite low, but allow the player to wander freely to the edges of `Int.MaxValue`


Naming methods that perform HTTP GET/POST calls?

In the application I am currently working on, there are generally 3 types of HTTP calls:   * pure GETs   * pure POSTs (updating the model with new data)   * "GET" POSTs (posting down an object to get some data back, no updates to the model) In the integration service, generally we name methods that post "postSomething()", and methods that get, "getSomething()". So my question is, if we have a "GET" POST, should the method be called:   * getSomething - seeing as the purpose is to obtain data   * postSomething - since we are technically using POST   * performSomeAction - arbitrary name that's more relevant to the action What are everyone's thoughts?


What is meant by, "A user shouldn't decide whether it is an Admin or not. The Privileges or Security system should."

The example used in the question pass bare minimum data to a function touches on the best way to determine whether the user is an administrator or not. One common answer was:               user.isAdmin()      This prompted a comment which was repeated several times and up-voted many times: > A user shouldn't decide whether it is an Admin or not. The Privileges or > Security system should. Something being tightly coupled to a class doesn't > mean it is a good idea to make it part of that class. I replied, > The user isn't deciding anything. The User object/table stores data about > each user. Actual users don't get to change everything about themselves. But this was not productive. Clearly there is an underlying difference of perspective which is making communication difficult. Can someone explain to me why user.isAdmin() is bad, and paint a brief sketch of what it looks like done "right"? Really, I fail to see the advantage of separating security from the system that it protects. Any security text will say that security needs to be designed into a system from the beginning and considered at every stage of development, deployment, maintenance, and even end-of-life. It is not something that can be bolted on the side. But 17 up-votes so far on this comment says that I'm missing something important.


SOA, Java EE and data organization

At the company I work for, we're currently splitting up our monolith solution into a number of small services (SOA). The purpose of this is to make the developers working on each chunk of code (service) more independent, and on the whole to make the code base more manageable. When a change in code is introduced, only one part (i.e. a whole service) needs to be deployed, instead of having to deploy _everything_. This also helps with testing, there's less of a need to test everything when something is deployed. Many of the services are small, so we'd like to deploy a number of these services on the same application server, JBoss 7.1 in this case. As per the SOA philosophy, the independence of each service and the teams working on them is very important. What would be the best way to organize the data?   * Use one schema per service      * Would you use one datasource per schema in the application server?     * Or use one datasource, prefixing all DB object names with the schema name in some transparent manner?   * Use a shared schema, but evading any naming collisions by requiring each service to use a distinct prefix for all DB objects   * Other options? Am I maybe thinking this completely wrong here? :) Edit: Explained _why_ the code base is being split up from a monolith to smaller services.


Why are good programmers referred to as Ninjas?

How is a Ninja programmer defined? If it is just an experienced developer, then is there really no better way to describe that? Ninja sounds like a childish marketing ploy designed to attract developers with delusions of self- grandeur. Or am I missing something? In particular I want to know what qualities of a Ninja are desired in programmers that makes the comparison valid (besides the coolness factor)? I did find this article which makes some good comparisons between Ninja characteristics and Agile development. However, I would like to hear from people who have used the word Ninja for hiring purposes and what their motivation was behind it. **Update:** There were several good points raised on both sides of the argument. I've tried to summarize these in my blog post. I've chosen JB's answer as the accepted one because it summarizes all the valid reasons for making the comparison.


Does tweeting 9 to 5 hurt job applicants?

If you were looking into a job applicant's background and discovered that he or she has 1200 followers on Twitter and averages 50 tweets per day (more than half of which are during business hours), would it affect your hiring decision? How and why? Personally, I'd be a little worried about the candidate's ability to focus on the job at hand if they're constantly checking in with their 'tweeps' thoughout the day. In non-tech jobs, a lot of companies simply block Twitter as an irrelevant distraction. But it _can_ be a useful resource---to programmers in particular. I just wonder how much is too much. At what point does it become a red flag?


Is there any reason to Dual-License a permissive License with a copyleft one?

My understanding of permissive licenses (MIT, BSD) is that they allow a user to re-license the software, provided that they attribute moderate portions to the original author. Is there a reason why anybody would dual-license with something like MIT and GPL, if the MIT license would allow any person to take the code and license it as GPL? I know JQuery does this, but I don't understand why. Am I misunderstanding the MIT license or is it just redundant?


Should integration test be included in continues integration (CI)?

Assume that we are developing a web application, and Hudson does typical jobs such as compile, unit test and static code analysis. But the tricky part is: Hudson **deploys and starts up application server to do integration tests** , once the previous jobs done. That means some difficult things, such as database connection, 3rd part application connection, socket port listening, environment variables, server start up failure handing, etc. We have to set up and tear down these things correctly each time, it’s hard thing. Worse, the integration tests can break the integration test easily. Do you think if integration test should be included in continues integration (CI)? Can it be manually? Or simplify integration test?


Are database schema migrations a problem in production environments?

In discussions about NoSQL vs SQL databases, I sometimes hear that companies prefer to use schemaless NoSQL databases because it is problematic to migrate the schema to a new version. But is that really a big problem when doing upgrades? Are relational databases bad for such operations? I read this blog post on the MongoDB blog: Why Schemaless?


Passing data between two windows forms using visual c++ 2010

1. So, i have a simple forms application : i have a form 1 ( **Form1.h** ) and a second form ( **Form2.h** ). Form1 consists of a simple _Add User button_ (which at this stage does nothing but _opens the form2 and hides form1_ ).(Till this point , everything works).    But when I _add a button "Done" to the Form2_ which is supposed to _open form1_ again , there are following **errors** :   left of ->Show must point to class/struct/union/generic type   f1: undeclared identifier   Form1: undeclared identifier   Please help!   2. the code is :              //Project Name: MultipleForms     //Form1.h     #ifndef FORM1_H     #define FORM1_H     #pragma once     #include "Form2.h"     namespace MultipleForms {              using namespace System;         using namespace System::ComponentModel;         using namespace System::Collections;         using namespace System::Windows::Forms;         using namespace System::Data;         using namespace System::Drawing;              /// <summary>         /// Summary for Form1         /// </summary>         public ref class Form1 : public System::Windows::Forms::Form         {         public:             Form1(void)             {                 InitializeComponent();                 //                 //TODO: Add the constructor code here                 //             }              protected:             /// <summary>             /// Clean up any resources being used.             /// </summary>             ~Form1()             {                 if (components)                 {                     delete components;                 }             }         private: System::Windows::Forms::Button^  btnAddUser;         private: System::Windows::Forms::Button^  btnExit;         protected:               private:             /// <summary>             /// Required designer variable.             /// </summary>             System::ComponentModel::Container ^components;          #pragma region Windows Form Designer generated code             /// <summary>             /// Required method for Designer support - do not modify             /// the contents of this method with the code editor.             /// </summary>             void InitializeComponent(void)             {                 this->btnAddUser = (gcnew System::Windows::Forms::Button());                 this->btnExit = (gcnew System::Windows::Forms::Button());                 this->SuspendLayout();                 //                  // btnAddUser                 //                  this->btnAddUser->Location = System::Drawing::Point(78, 44);                 this->btnAddUser->Name = L"btnAddUser";                 this->btnAddUser->Size = System::Drawing::Size(75, 23);                 this->btnAddUser->TabIndex = 0;                 this->btnAddUser->Text = L"Add User";                 this->btnAddUser->UseVisualStyleBackColor = true;                 this->btnAddUser->Click += gcnew System::EventHandler(this, &Form1::btnAddUser_Click);                 //                  // btnExit                 //                  this->btnExit->Location = System::Drawing::Point(263, 136);                 this->btnExit->Name = L"btnExit";                 this->btnExit->Size = System::Drawing::Size(75, 23);                 this->btnExit->TabIndex = 1;                 this->btnExit->Text = L"Exit";                 this->btnExit->UseVisualStyleBackColor = true;                 this->btnExit->Click += gcnew System::EventHandler(this, &Form1::btnExit_Click);                 //                  // Form1                 //                  this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);                 this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;                 this->ClientSize = System::Drawing::Size(410, 200);                 this->Controls->Add(this->btnExit);                 this->Controls->Add(this->btnAddUser);                 this->Name = L"Form1";                 this->Text = L"Form1";                 this->ResumeLayout(false);                  }     #pragma endregion         private: System::Void btnAddUser_Click(System::Object^  sender, System::EventArgs^  e) {                      Form2^ f2 = gcnew Form2();                      f2->Show();                      this->Hide();                  }         private: System::Void btnExit_Click(System::Object^  sender, System::EventArgs^  e) {                      exit(1);                  }         };     }          #endif          //Form2.h          #include "Form1.h"     #ifndef FORM2_H     #define FORM2_H     #pragma once          #include<stdlib.h>          namespace MultipleForms {              using namespace System;         using namespace System::ComponentModel;         using namespace System::Collections;         using namespace System::Windows::Forms;         using namespace System::Data;         using namespace System::Drawing;              /// <summary>         /// Summary for Form2         /// </summary>         public ref class Form2 : public System::Windows::Forms::Form         {         public:             Form2(void)             {                 InitializeComponent();                 //                 //TODO: Add the constructor code here                 //             }              protected:             /// <summary>             /// Clean up any resources being used.             /// </summary>             ~Form2()             {                 if (components)                 {                     delete components;                 }             }         private: System::Windows::Forms::Button^  btnDone;         protected:               protected:               private:             /// <summary>             /// Required designer variable.             /// </summary>             System::ComponentModel::Container ^components;          #pragma region Windows Form Designer generated code             /// <summary>             /// Required method for Designer support - do not modify             /// the contents of this method with the code editor.             /// </summary>             void InitializeComponent(void)             {                 this->btnDone = (gcnew System::Windows::Forms::Button());                 this->SuspendLayout();                 //                  // btnDone                 //                  this->btnDone->Location = System::Drawing::Point(98, 110);                 this->btnDone->Name = L"btnDone";                 this->btnDone->Size = System::Drawing::Size(75, 23);                 this->btnDone->TabIndex = 0;                 this->btnDone->Text = L"Done";                 this->btnDone->UseVisualStyleBackColor = true;                 this->btnDone->Click += gcnew System::EventHandler(this, &Form2::btnDone_Click);                 //                  // Form2                 //                  this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);                 this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;                 this->ClientSize = System::Drawing::Size(292, 273);                 this->Controls->Add(this->btnDone);                 this->Name = L"Form2";                 this->Text = L"Form2";                 this->ResumeLayout(false);                  }     #pragma endregion         private: System::Void btnDone_Click(System::Object^  sender, System::EventArgs^  e) {                      Form1^ f1 = gcnew Form1();                      f1->Show();                      this->Hide();                  }         };     }     #endif


TFS - web sites based under IIS - how to handle branching

I'm just looking for some advice/best practice for this situation: We have a solution with a couple of web sites in it (one is a web site project, the other is a web application project). We have both of these sites set up to use our installed IIS (v7), as we have other projects that we need to access these via localhost whilst debugging. We've just moved to TFS (from GIT) - when we switch branches, I have to go and 'repoint' my virtual directories under IIS to point at the new branch, which is a bit of a nuisance. Does anybody have any advice/guidance as to what is the best way to approach this? I would note that I don't think that switching to using Cassini will suit our situation.


How do you test database abstraction in PHP?

I apologise in advance if this question is too subjective but I'm struggling to find a good answer, probably as there is not really a correct answer to give. I'm currently writing a database abstraction layer to unify the use of a single API throughout my applications. Possibly re-inventing the wheel but I'm mainly doing it for my specific need of certain Oracle functionality that will eventually be migrated away from Oracle. For the Oracle driver I'm finding it difficult to test the object due to the lack of an OO API in PHP, so to test I need to touch the database. There seems to be two schools of thought on testing database functionality.   1. Don't touch the database, mock it all away (obviously impossible without an OO API).   2. Allow the functionality to run and therefore feature test rather than unit test. My question is two fold, has anyone done this before and how did you handle testing? If you haven't had cause to do this before, what are your thoughts on how you would handle it and why?


atlassian confluence as source for bdd stories

I want to start using BDD in our company. The best place to keep stories from my point of view is the Atlassian Wiki pages. Obviously I expected some existing techniques for retrieving stories from pages, but found only an advice to use `pageUrl?decorator=printable` to get the page in printable form and parse it afterwards. And that is it, no plugins nothing... **Question** : What is the best way to retrieve stories from Atlassian Wiki? Are there any well known alternatives? I can definitely keep them in the SVN folder where business analysts could have access to, but this is far much less comfortable for them. All other technical documentation is kept on wiki and I do not want to split it.


Purpose of `return self` from a class method?

I came across something like this in an open-source project. Methods that modify instance attributes return a reference to the instance. Would you trust code that is written like this?               class Foo(object):            def __init__(self):         self.myattr = 0            def bar(self):         self.myattr += 1         return self


Being the only developer and its consequences

I am the only developer in my company. I do programming (in ASP.NET 4.0, jQuery and SQL Server 2008) and maintain the database and web server (win 2008 r2). I enjoy the freedom of implementing what I like at the same time I feel I could be doing everything in a bad way. I don’t use any SDLC diagrams not any kind of methods like Agile etc. I handle multiple small projects. I use my free time in keeping up with latest technologies and learning and testing new stuff. I have been doing this for the past 7 years.   1. My concern is how difficult will it be for me to adjust when I switch my job to a company wherein more developers are involved in a project?   2. Since I don’t follow any design pattern would it play against me when I look for job or get adjusted with new job?   3. Any other pros/cons you can think of?


Packaging F#/C# Application

There is a .NET application built using F# (the core part, as a DLL) and C# (the GUI part, using WPF). What is the best way to package it and to make an installer package and what are the most appropriate tools to use, commercial or free? It needs to include F# redistributable package in my application package and to check/download .NET framework needed. As you guessed, I'm completely new to this Windows world. Thanks in advance. Kh


What's so great about Clojure?

I've been taking a look at Clojure lately and I stumbled upon this post on Stackoverflow that indicates some projects following best practices, and overall good Clojure code. I wanted to get my head around the language after reading some basic tutorials so I took a look at some "real-world" projects. After looking at ClojureScript and Compojure (two the the aforementioned "good" projects), I just feel like Clojure is a joke. I don't understand why someone would pick Clojure over say, Ruby or Python, two languages that I love and have such a clean syntax and are very easy to pick up whereas Clojure uses _so much_ parenthesis and symbols everywhere that it ruins the readability for me. I think that Ruby and Python are beautiful, readable and elegant. They are easy to read even for someone who does not know the language inside out. However, Clojure is opaque to me and I feel like I must know every tiny detail about the language implementation in order to be able to understand any code. So please, enlighten me!   * What is so good about Clojure?   * What is the absolute minimum that I should know about the language in order to appreciate it?


UML modeling tool for Linux

I am starting a new project using Eclipse under Linux and I am looking for a UML 2.x **modeling tool** not just a diagramming tool.   * Do anyone has experience with UML plugin for Eclipse? Does it support all UML diagrams?   * Do you recommend another modeling tool?   * If you have been in a similar situation, what did you end up doing anyway?


Why do different java collections have different default capacity?

Looking at different collection constructors the question comes to mind. Why does ArrayList() construct an empty list with an initial capacity of ten and ArrayDeque() constructs an empty array deque with an initial capacity sufficient to hold 16 elements.


Windows Server or Linux for final project

A few weeks ago I came up with an idea to develop a mobile app which will direct students in my university to the nearest printer availiable. The whole thing is part of my final project.   The Android based app will need to perform the following tasks:   1. The user's location in the campus is sent to the server. Assume this part works just fine.   2. The server sends an SNMP request to the printers in the user's vicinity. I'll probably use PHP or Python for that part.   3. The data requested by SNMP is processed and sent back to the client My question concerns the server. The university's IT manager offered me a designated server for development, which sounds great. Now I need to choose which OS I want installed on the server - Windows server or Linux (don't know which versions). I don't have any server programming/operating experince, but generally speaking I feel more comfortable in Windows enviroment (just because that has always been my OS). I don't have much time for learning a new OS, but when does it make sense generally to host or develop server side applications on a Windows environment versus a Linux environment?


Automated architecture validation

I am aware of the fact that TFS 2010 ultimate edition can create and validate architecture diagrams. For example, I can create a new modeling project > add Layer Diagram > Add Layer called View > Add BL Layer > Add DL layer. Then I can validate this architecture as part of the build process when someone tries to check code into TFS. In other words, if the View references the DL then the compilation process will fail and the checkin will not be allowed. For those without an MSDN ultimate license, can FxCop or some 3rd party utility be used to validate architecture in an automated fashion? I prefer a TFS install-able plugin, but a local VS plugin will do.


Why was F# created?

For my current class, I have to pick and research a Programming Language (or popular scripting language) and answer quite a few questions about it, write a paper, and do some example programs displaying it's strengths and weaknesses compared to other languages. I'm currently looking into F# as a possible candidate, my problem is I can't find any information stating (at least explicitly) why F# was created. I've found many strengths and a few weaknesses of F# but do these necessarily imply reasons as to why it was created? Does anyone know any links or reads that would explicitly state why F# was created and/or the history of F# (particularly things like, what the creator was thinking, and stuff like that)? And yes, I've been searching and will continue to, I just can only find implicit reasons, and I was hoping to find something stating explicitly reasons why F# was created.


Is it considered Pythonic to have multiple classes defined in the same file?

In working with python for the first time, I've found that I end up writing multiple classes in the same file, which is opposed to other languages like Java, which uses one file per class. Usually, these classes are made up of 1 abstract base class, with 1-2 concrete implementations who's use varies slightly. I've posted one such file below:               class Logger(object):              def __init__(self, path, fileName):             self.logFile = open(path + '/' + filename, 'w+')             self.logFile.seek(0, 2)              def log(self, stringtoLog):             self.logFile.write(stringToLog)              def __del__(self):             self.logFile.close()          class TestLogger(Logger):                 def __init__(self, serialNumber):             Logger.__init__('/tests/ModuleName', serialNumber):              def readStatusLine(self):             self.logFile.seek(0,0)             statusLine = self.logFile.readLine()             self.logFile.seek(0,2)             return StatusLine              def modifyStatusLine(self, newStatusLine):             self.logFile.seek(0,0)             self.logFile.write(newStatusLine)             self.logFile.seek(0,2)          class GenericLogger(Logger):              def __init__(self, fileName):             Logger.__init__('/tests/GPIO', fileName):              def logGPIOError(self, errorCode):             self.logFile.write(str(errorCode))      As seen above, I have a Logger base class, with a couple of implementation differences below that. **The Question:** Is this standard for python, or for any language? What problems could arise from using this implementation if any? **EDIT:** I'm not really looking for guidance on this _specific_ file, but in a more general sense. What if the classes ended up being 3-5 moderately complex methods? Would it make sense to split them then? Where is the cutoff for saying you should split a file up?


Best way to process a queue in C# (PDF treatment)

First of all let me expose what I would like to do : I already dispose of a long-time running webapp developed in ASP.NET (C#) 2.0. In this app, users can upload standard PDF files (text+pics). The app is running in production on a Windows Server 2003 and has a dedicated database server (SQL server 2008) also running Windows Server 2003. I myself am a quite experienced web developer, but never actually programmed anything non-web (or at least nothing serious). I plan on adding a functionality to the webapp for which I would need a jpg snapshot of each page of the PDF. Creating these "thumbnails" isn't the big deal as such, I already do it inside my webapp using ghostscript. I've only done it on 1 page documents for now though, and the new functionality will need to process bigger documents. In order for this process to be transparent aswell for the admins as the final users, I would like to implement some kind of queue to delay the processing of the thumbnails. There again, no problem to create the queue, it will consist of records in a table, with enough info to find the pdf document back. Then I will need to process this queue, and that's were my interrogations start. Obviously the best solution to process it isn't an ASP script or so, so I will have to get out of my known environment. No problem, but I have no idea which direction to go. Therefore, a few questions :   * What should I develop ? I presumably need something that is "standby" on the server, runs when needed, then returns to idle state until further notice.Should I be looking into Windows service ? Is there another more appropriate type of project ?    * Depending on the first answer, what will be the approach ? Should I have somehow SQL server "tell" the program/service/... to process the queue, or should I have that program/service/... periodically check the state of the queue and treat new items. In both case, which functionality can I use ?   * we're not talking about hundreds of PDF a day (max 50 maybe), I can totally afford to treat the queue 1 item at a time. Can you confirm I don't have to look much further on threads and so ? (I found a lot of answers talking about threads in queue treatment, but it looks quite overkill for my needs)   * Maybe linked to the previous question : what about concurrent call to the program, whatever it is ? Let's suppose it is currently running, and a new record comes in the queue, what should be the behaviour ? I don't need much detailed answers and would already be happy with answers like "You can do the processing with a service, and yes it's possible to have sqlserver on machine A trigger a service start on machine B" or "You have to develop xxx and then use the scheduler to run it every xxx minutes". I don't mind reading articles and so, but I can hardly afford to spend too much time learning stuff to finally realize I went the wrong way for this project, so basically I'm trying to narrow down the scope of matters I need to investigate. Thanks for reading me, I hope I'll find some helping hands on here :-)


How would I structure my code into an MVC format?

I want to have the home page (root of the website), check if a cookie exists for a user being logged in, and then based off of that determining whether or not to load the sign up page (landing page) or the feed of the user logged in. Where would I have this check occur? I've kept it in the controller for now, but based on some articles I've read (such as Skinny Controller, Fat Model, I'm not sure that's the right place to keep it in.


Is there any way without looking at the source code to know how modular the code is

I've been working with TDD, most patterns, mostly OO code and still not found a way of knowing if a particular piece of code confirms to modularity , without the need reviewing the code. On a recent project which had split up everything into jars specifying a "module" which still wasn't modular code. So is there any way of actually knowing or measuring if code is modular or not? Modularity is away of minimizing the ripple effect when doing changes to a system. I've been doing a post mortem on a large system and one of the biggest issues have been the inability of containing changes to a minimum. There are several reasons for this, one where the code is actually not modularized despite following best practices. As a result the belief have been that the system is actually resilient for changes but in practice it isn't. A distinct pattern have emerged and shows why the system fails being modularized and that might be a a way of actually provide metrics for how modularized you code is.


How to 'reproduce copyright` in an app?

>   * Redistributions in binary form must reproduce the above copyright   >  notice, this list of conditions and the following disclaimer in the   >  documentation and/or other materials provided with the distribution. > The above is quoted from a BSD licensed COPYING file. How can I "reproduce the above copyright" when I distribute my app in binary form? Should I put the COPYING file content in some `Credit`/`About` screen of my app or what? Thanks!


How do I communicate concepts and design for a web application?

Iam not sure if this topic is ok to ask, but we are talking about this since years in our Developer-"Shop". How to write concepts for Web- Applications? We are using Zend Framework (MVC), OOP Based, Databases, LDAP and such stuff. But no one ive ever meet can show me an good example for some kind of "technical conception". Goal: Write an document, hand it our to an 2nd person with "some" knowledge about our systems and good PHP 5/Zend Framework skills. Now he must be able to code without many questions to the architect. Is it possible that this is not common in the "web scene"? Does everyone is just hacking code till the application works? If someone knows some good papers, examples .. Some keywords to think about:   * ERM   * UML


Any real use of pointers in C#?

What is a situation while coding in C# where using pointers is a good or necessary option? I'm talking about _unsafe_ pointers.


Can writing mobile apps be a full time job?

As an aspiring android developer, reading this today gave me a distinct feeling of a rug being pulled under my feet. While the research discussed, is about the Apple apps store, I believe it safe to say that everything is also true for the multitude of Android apps markets (or Plays as they are called these days). If it's true, then what does it mean for developers considering up to mobile development as their chosen career? Do any of you makes a living out of apps development? Can it be done as a full-time job able to pay the bills and put food on the table?


How do I keep controversy in check?

This is probably OT but it's less OT here than on any other SO site, so please bear with me. I'm working on a new project votEm. The goal is to give independent candidates a platform to introduce themselves to get elected for a political office. My main reason is that today, it's too expensive to run for an office. Some politicians in the US spend as much as 30 million dollars (!) for a single campaign. That money is better spent elsewhere. In a similar fashion, people who want to change countries like Egypt, could use such a platform to present themselves. Now I expect a lot of emotions and pressure on my site. People with a lot of money (and a lot to lose) will try to game it (political parties, secret services of ... errr ... "not 100% democratic countries", big companies, ...) To avoid as many mistakes as possible, I need a list of resources, ideas and tips how to keep such a site out of too much trouble. PS: I'd make this CW but the option seems to be gone...


Why isn't DSM for unstructured memory done today?

Edit: Comments suggested, that DSM just faded out by being not used recently. What were the reasons for this, what are DSMs drawbacks? Literature lists many positive aspects like easy to port programms to, no marshalling and therefore faster and so on but also negative aspects like only usable in homogenous environments due to endianess and word size issues. So why is all data synchronizing done by databases and not DSM anymore? Has there been a historic comparison or study at the time when both ways existed concurrently? Old text: Ages ago, Djikstra invented IPC through mutexes which then somehow led to shared memory (SHM) in multics (which afaik had the necessary mmap first). Then computer networks came up and DSM (distributed SHM) was invented for IPC between computers. So DSM is basically a not prestructured memory region (like a SHM) that _magically_ get's synchronized between computers without the applications programmer taking action. Implementations include Treadmarks (inofficially dead now) and CRL. But then someone thought this is not the right way to do it and invented Linda & tuplespaces. Current implementations include JavaSpaces and GigaSpaces. Here, you have to structure your data into tuples. Other ways to achieve similar effects may be the use of a relational database or a key-value-store like RIAK. Although someone might argue, I don't consider them as DSM since there is no coherent memory region where you can put data structures in as you like but have to structure your data which can be hard if it is continuous and administration like locking can not be done for hard coded parts (=tuples, ...). Why is there no DSM implementation today or am I just unable to find one?


Database connection - should they be passed as parameter?

We have a system whereby the database connection is get once using a common method, and being pass throughout the relevant class to be used. There are doubts that passing the database connection as a parameter to different classes would cause problem, so i'm checking here to see whether this is actually viable, and are there any better patterns to do it? I know there are some ORM tools to do the persistence but we can't go into that, yet.. Any feedback is welcomed, thanks.


Time management and self improvement

I hope I can open a discussion on this topic as this is not a specific problem. It's a topic I hope to get some ideas on how people in similar situation as mine manage their time. OK, I'm a single developer on a software project for the last 6-8 months. The project I'm working on uses several technologies, mainly .net stuff: WPF, WF, NHibernate, WCF, MySql and other third party SDKs relevant for the project nature. My experience and knowledge vary, for example I have a lot of experience in WPF but much less in WCF. I work full time on the project and im curios on how other programmers which need to multi task in many areas manage their time. I'm a very applied type of person and prefer to code instead of doing research. I feel that doing research "might" slow down the progress of the project while I recognize that research and learning more in areas which I'm not so strong will ultimately make me more productive. How would you split up your daily time in productive coding time and time to and experiment, read blogs, go through tutorials etc. I would say that Im coding about 90%+ of my day and devoting some but very little time in research and acquiring new knowledge. * * * Thanks for your replies. I think I will adopt a gradual transition to Dominics block parts. I kinda knew that coding was taking up way to much of my time but it feels good having a first version of the project completed and ready. With a few months of focused hard work behind me I hope to get more time to experiment and expand my knowlegde. Now I only hope my boss will cut me some slack and stop pressuring me for features...


Is it possible to implement an infinite IEnumerable without using yield with only C# code?

# Motivation The main idea is to explore and understand the limits of how far one can go with the basic LINQ primitives (Select, SelectMany, Concat, etc.). These primitives can all be considered functional operations on a theoretical sequence type. Taking examples from Haskell:   * `Select` 'lifts' a function into the sequence (like `fmap` in Haskell)   * `Concat` is composition   * `Aggregate` is the sequence type's catamorphism (fold)   * `SelectMany` 'extracts' information from the sequence (the Monad bind, `>>=` operation)   * etc. (and I'm sure there are better abstractions for the above) So the question is whether or not the basic sequence (Enumerable) operations in C# are enough to construct an infinite sequence. More concretely it is the following problem: # Problem I'm curious to know if there's a way to implement something equivalent to the following, but without using `yield`:               IEnumerable<T> Infinite<T>()     {         while (true) { yield return default(T); }     }      Is it possible to do sue using the built-in LINQ operators only? The short answer is that theoretically yes, but practically not because of how Linq is implemented (causing stack overflows). That's why here are less restrictive rules: # Rules Alternatively a less restrictive question would go by the rules   1. You can't use the `yield` keyword directly   2. Use only C# itself directly - no IL code, no constructing dynamic assemblies etc.   3. You can only use the basic .NET lib (only `mscorlib.dll`, `System.Core.dll`? not sure what else to include). However if you find a solution with some of the other .NET assemblies (WPF?!), I'm also interested.   4. Don't implement IEnumerable or IEnumerator. # Notes An example theoretically correct definition is:               IEnumerable<int> infinite = null;     infinite = new int[1].SelectMany(x => new int[1].Concat(infinite));      This is " **correct** " but hits a StackOverflowException after 14399 iterations through the enumerable (not quite infinite). I'm thinking there might be no way to do this due to the C#'s compiler lack of tail recursion optimization. A proof would be nice :)


Android DB With Some Multi-Language Data

I have a SQLite Database in my Android app with a "Question" table, among others. That table contains "default" or "pre-loaded" data (in this case the questions asked by the app). Some of its columns are "technical" or "internal" data to be used behind the scenes - like the number of points the question is worth, the type of user that may answer it, etc. - while others are textual data that are presented to the user (e.g. Title, Description, etc.). Now, I intend to let my app be internationalization-friendly (translatable) so I'm thinking that:   * Instead of following what seems to be the 'standard approaches' for multi-language DB design - either creating different columns for the translatable attributes (e.g. name_en, name_es, ...) or a separate table where each row represents a translation of the base object;   * ...I could simply keep the values for those translatable attributes in my `R.Strings` resource and have my DatabaseHelper class fetch the text from there, by building the resource name based, for instance, in the question's ID (e.g. q1_name, q2_name, q1_description, ...). This way I could have several R.strings and the DB helper would read from the right one. I'm a bit unsure about this approach and I'm curious if this is a bad practice and/or I'm missing any potential drawback.


The model to sell apps on App Store is better with a paid only version?

Rob Napier, the author of iOS 5 Programming Pushing the Limits, mentioned there are several models of selling apps on the App Store:   1. Write an app and sell it   2. Publish a free and a full version   3. Ad supported by third party or by iAd   4. In App purchase Surprisingly, the author said that the most workable model is (1) in terms of sales. I would think that (2) with fairly limiting ability for the free version can bring more sales, as people without trying, might not plunge down $0.99 or $1.99 for something they haven't tried? I for one, might not have purchased Angry Birds if I didn't try their free version first. Also, I think it also depends on the situation: for example, if the app is an alarm clock, and there are already 5 alarm clocks in App Store that are free, then your app that is $0.99 might not be that eagerly purchased (or they may end up never trying your app). But if yours is also free, and users really like it out of all the other ones, then they may think, $0.99 is nothing to get a good alarm clock, and gladly pay you the $0.99 in exchange for a full version of the alarm clock, for something that they can't get with the free version. (such as the full version can let you choose a song from your Music Library for the alarm). Could (1) work only if the user definitely want it and have no substitute? How might it work the best?


International two-part date formats

Do people outside of the USA use two-part date abbreviations for the current year? For instance, representing the last day of May, you might see someone enter `5/31` into a date field. Do international users do something similar? In a country that ordinarily uses dd/MM/yyyy would they use `31/5` or some such?


Design pattern advice required for sending xml files to different destinations

I am using an Export Module, now I want to extend it for different connections. I have a database which contains products Its Description, Review, Images etc. I use the serialize function to save it as XML file. After saving it as XML, in admin pannel I have possibility to select how this XML file will be exported. for example throught ftp, http, local, webservice, email etc. user has the possibility to select one or more connections to export the files. Each connection like ftp, http has it own settings in Database e.g ftp domain, username, password. what will be the best way to write these connection classes (by implementing Interface or using Abstract class or some Manager) and how to pass them to the export component as one exoprt may have on to many connections.


1h coding test for recruitement interview, is it a common practice

I received an email for a web company position I applied to. They are asking me to provide a 1h time slot, so that they can make me pass a coding test. They'll send the test, start the time, and 1h after, I'll have to provide them what I came up with. This will be on Python and Javascript. I'm a developer since 18 months only, as I was a Unix SA for 15 years before this. Is it a common practice? How to prepare and is there any tests examples on the net? I cannot find any. Thanks


Is it possible to build software that interprets video in real time?

Say you had a live video stream of a popular boardwalk that had thousands of pedestrians walk down it each day. Could software be written to count the number of people that walk by a camera and collect data on things like how many of them were wearing red clothing or how many were over 6' tall? I'm thinking the software would be a layer between the camera and the people. But I have no idea if that is even possible. If something like this already exists, I wasn't able to find it but please share if it does. Thanks!


Licensing open source controls iOS

I am confused about using licensed open source control in my comercial iOS application. Do I have to include any license in my code or i can just add open source control and push app to app store? For example have look on following https://www.cocoacontrols.com/controls/klnoteviewcontroller It has two lincenses. I can download it for free using Apache 2.0 License but I am not sure if I can use it my paid iOS application. Please advice


As title: Why is aggregation function bad idea for RESTful? Although I know CRUD is good for RESTful. For example, the resource is ' _employee_ ', and client needs to retrive sum of total ' _salary_ ' of all employees. Shouldn't RESTful service provide such sum function? Further question: if aggregation function is bad for RESTful, how can a client get sum of total salary? To retrieve all 'employee' records and sum up itself?


Which is Preferable: FirstName LastName or Forename Surname etc

It seems there are many different ways to represent the same information:               FirstName, MiddleName, LastName     Forename, MiddleName, Surname     GivenName, MiddleName, FamilyName      Which one is preferable? It depends??


Implementing search over large data set, PHP or Mysql stored procedure?

I'm building an Online Food Ordering System with PHP and MYSQL, One of the feature of the application is to allow users to search for the restaurants by typing the area name. I would like to know using PHP for search will be more efficient or using Stored Procedure or using any third party tool. Efficient in the sense when it is to be searched among large set of data which one will be the fastest?


"Pythonic" equivalent term for code written in modern C++ style?

There's a lot of good idioms promoted in modern C++. These include RAII and elegant use of boost or STL or a `std::algorithm` to solve a given problem. Just like you can write C in any language, you can certainly write C in C++. However you can write really good modern C++ code with the right subset of features. When someone does something really cool with an STL or boost construct I always get the urge to call it "pythonic" in the sense that its the canocical elegant way to do something. Is there a term like how "pythonic" is used in python to refer to C++ code written in the modern style with modern idioms?


How to give the sense of a team that is fragmented based on projects?

The software engineering team of which I am part of is approximately 7 strong located in adjacent cubicles. 3 of us work on the same project but the rest are working on their own on different projects. In some cases one guy will be on his own on a project for nearly 1-2 yrs. There is no overlap in the projects that are being done as well. Currently I am one of those 3 guys working in the same project. So I have people to talk and discuss the problems and also to do some peer programming and reviewing. But everybody in the team have also been on a project just by themselves for about 2 yrs. It gives a very aloof feeling as you get further along the project. I was wondering if any of you guys were part of such a team and what did you guys do to have a healthy team spirit. Any thoughts/ideas are welcome. Thanks for your time. Cheers.


Can a random number generator ever produce different output given identical seeds?

The title sums it up. I'm interested to know if there exists an algorithm capable of producing variable output given identical input without relying on other sources for randomness such as DateTime.Now or a number generated from a light sensor etc. In addition, the algorithm can not be run in sequence, just two distinct, unrelated runs that produce different output.


Is there anyone who has used Python/Ruby and PHP for a long time and still prefer PHP?

I am usually fascinated by articles defending PHP and the arguments being used. Quite often authors of these types of articles don't mention what experience they have with other languages. Personally I find it hard to imagine that somebody would know either Python or Ruby, and PHP at a high level and still prefer PHP. So if anyone fits this description, I would be interested in hearing why you prefer PHP to either of these languages.


Do you think we will ever settle on a "standard" platform?

The recent explosion of phone platforms has depressed me (slightly), and made me wonder if we will ever reach any kind of standard for presentation? I don't mean language or IDE. Different languages have different strengths and I can see that there may always be a need for disparity, although I do note that languages are merging somewhat in functionality, with traditional imperitive languages like C++ now supporting things like lambdas. What I'm really talking about is a common presentation mechanism. Before smart phones and tablets came along, the web seemed to be finally becoming a reasonable platform for presenting an application that was globally accessible, not just geographically, but by platform too. Sure there are still (sometimes infuriating) implementation differences and quirks, but if you wrote a decent site you knew it could be accessed on anything from a PC to a phone to a C64 running the right software. "Write Once Run Anywhere" seemed to finally be becoming a reality. However, in the last few years we've seen an explosion of mobile operating systems, and the ubiquitous "app". A good site is no longer enough, you need a native "app", and of course we have a sudden massive disparity in OS, language, and APIs needed to write them as each battles for supremecy. It's kind of weird how the cycle of popularity goes. Mainframes with terminals - thin client. PC - thick client. Web browser - thin client. Phone app - thick(ish) client. I just wonder if you think there will ever be a global standard for clients, or whether the "shiny and different" cycle will always continue along with the battle of the tech du jour.


agile / scrum and functional specs

I work in a small team of four devs, one domain expert and one manager. We are looking to move to using scrum to try and formalise our processes. From what I understand of agile, it seems to be close(ish) to what we are doing anyway. We have a brief document with the overall features our product will have. As we come to code each feature, we sit down and thrash it out verbally, relying on our domain expert for what the customer will want. We then code it, and it gets tested in vague ways by the other devs / domain expert. Improvements get suggested and implemented. At our last ISO 9001 audit we were (deservedly) reprimanded for lack of any traceability. The auditor wanted some way of seeing we had records of what the product would do, and then testing to prove that it did it. We are looking to scrum to give us a process for this, along with other benefits, but my reading up so far has not answered my question of where detailed functional requirements are recorded / tested? My understanding of agile / scrum is far from complete, so please correct me if I have misunderstandings. As an example, let's say we have a user story that says: "As a customer, I need to be able to select a system state of A, B or C". It has an acceptance test that says "I should be able to select state A, B, or C, and the system will change to that state" Come the sprint where this gets implemented, we sit around and decide that we will build a widget with A, B and C radio buttons, and a "Apply" button. Then we code it. When this widget is tested, the following problems are found: 1. Selecting B sometimes doesn't uncheck the previous radio button. 2. Sometimes option C is unavailable on the system, and so should be greyed out. 3. When first opened, the initial selection does not match the current system state. My question is how and where is this recorded? There is no detailed functional spec saying "There will be a widget with three radio buttons. When the widget is created, the current radio selection should match the system state" blah blah. Given the lack of this document how are we supposed to prove that the system does or does not do what it's supposed to to an auditor?


What is "the right way" to do search on a website?

I'm talking the kind of search that auto-suggests your query as you type, the way Google does, the way Wikipedia does, the way Stack Exchange suggests other questions as you type the title, etc. And Wikipedia used to have an _awful_ search implementation, for those of us who remember. It had no auto-suggest, was shut down by the slightest typo or misspelling, and rarely gave pertinent results. As an amateur web programmer, I'm trying to figure out how I would implement an effective and high-performing search-and-auto-suggest as Wikipedia now has, and as SE has, and as so many other websites have. How can you obtain that kind of incredibly fast performance and flexibility? Does everyone just wing it, or are there principles, guidelines, helpful libraries, or other such resources to help you get it done right in the style of the "Internet of the Future"?


Is it recommended to use SQL Server as database for massively scalable applications?

Let's say you are planning to create a website of the scale of Facebook (If I am going to cite a website's name then why not Facebook?!). Is it recommended to use SQL Server as your database for such applications? I am asking this question because many colleagues of mine say that SQL server should not be used such applications. They prefer Oracle or MySQL instead.


Would a professional, self taught programmer benefit from reading an algorithms book?

I'm a 100% self taught, professional programmer (I've worked at a few web startups and made a few independent games). I've read quite a few of the "essential" books (Clean Code, The Pragmatic Programmer, Code Complete, SICP, K&R). I'm considering reading Introduction to Algorithms. I've asked a few colleagues if reading it will improve my programming skills, and I got _very_ mixed answers. A few said yes, a few said no, and a one said "only if you spend a lot of time implementing these algorithms" (I don't). So, I figured I'd ask Stack Exchange. Is it worth the time to read about algorithms if you're a professional programmer who seldom needs to use complex algorithms? For what it's worth, I have a strong mathematical background (have a 2 year degree in Mathematics; took Linear Algebra, Differential Equations, Calc I-III).


secure photos on server

I would like to hear advice from the more experienced developers. The project is now in the design stage. It's mobile application and a simple web application. Content is pictures, comments, personal correspondence. Pictures can be quite personal. Need a very serious attitude to security. The question is simple: **where to store photos and how to secure it?** I think it's will be in the following way:   1. User make some photo. Via SSL the application sends photo to the server.   2. The server recieve photo, encrypt it and store somewhere.  Also, via app the user can see all own photos.   1. Request to server for photos.   2. Server decrypt stored photos and send via SSL to client. I need some technical advices: where to save images, I know that database is quite slow for this case, which algorithms use for encrypt/decrypt, what about cache. It will be highload project and performance is very important. Mobile application is planned on cross-platform framework like phoneGap, Titanium. On the server is .NET. But it is planned. I also consider full stack frameworks for javascript.


Using a standard localised data cryptography pattern with an ASP.NET MVC3 application

I have been given the task to rejuvenate an existing Human Resources application from Access into ASP.NET. This is a strictly internal application, and I have no problems developing it within our standard ASP.NET environment. It does however pose it's own problems, both technically and ethically. The HR app will be responsible for storing employee pay data, for which it is not appropriate for me, the developer, to see. It's essentially three fields (salary band, actual salary, comments) and four other values, calculated on the front end. I'd like to go down the cryptography route to encrypt said data - cryptography with the .NET Framework is very easy to implement. I could "roll my own", which as we all know is a bad idea. However I was wondering if there was a _more better_ way of doing it. Here are some points:   1. For starters, we're all attached to the same domain.   2. I've heard and read about Certificates, can they be useful here? (x.509?)   3. The data will be stored in our local SQL Server, obviously the actual data here needs to be encrypted, so can SQL Server help me? Certificates again?   4. If a user doesn't have the appropriate certificate, can the data just be null? (You can't see this matey!)   5. This encryption problem doesn't have any relevance to usage of the system via a permissions model.


Most common "Y2K-style" bugs today?

I don't specifically mean date-related issues like 2038, but more generally, bugs that fit the pattern:   * A generation ago, programmers tended to write code that ass-u-me-d X, which was reasonable at the time.   * But circumstances have changed, and now X is a common source of problems that need to be fixed. For example:   * X = "Memory is too expensive to justify storing all 4 digits of the year. Don't worry about 2000; that's a long way off." (broken by Y2K)   * X = "Who needs `size_t`? We can just use `unsigned int`." (broken by 64-bit systems)


Designing application flow

I am creating a web application in java where I need to mock the following flow. When user trigger a certain process (add product to cart), I need to pass through following steps   1. Need to see in HTTP Session if user is logged in.   2. Check HTTP Session if shopping cart is there   3. If user exist in HTTP Session and his/her cart do not exist in HTTP Session   4. Get user cart from the database.   5. add item to cart and save it to HTTP session and update cart in DB.   6. If cart does not exist in DB, create new cart and and save in it HTTP Session. Though I missed a lot of use cases here (do not want question length to increase a lot), but most of the flow will be same as I described in above steps. My flow will start from the `Controller` and will go towards `Service` Layer and than ends up in the `DAO` layer. Since there will be a lot of use cases where I need to check HTTP session and based on that need to call `Service` layer, I was planning to add a `Facade` layer which should be responsible to do this for me like checking `Session` and interacting with `Service` layer. Please suggest if this is a valid approach or any other best approach can be implemented here? One more point where I am confused is how to handle `HTTP session` in facade layer? do I need to pass HTTP session object each time I call my `Facade` or any other approach can be used here?


What is your opinion of C++ Frequently Questioned Answers?

Do you think that the criticisms in Frequently Questioned Answers are accurate?


How do you keep track of what classes and functions your team has written?

When working on code, I face many of the same challenges that my teammates do, and I have written some helpful functions and classes, and so have they. If there is good communication, I'll hear about some great thing someone put together, and six months later when I need it I may remember it and call that function, saving myself time. If I don't remember it, or never knew about it, I will probably re-invent the wheel. Is there a particular practice of documenting these kinds of things? How do you make them easy to find? If your team has no such documentation, how do you find out if your wheel already exists? **EDIT:** All but one of the answers so far deals with an ideal situation, so let me sum up those solutions: documentation & communication; wikis, stand-up meetings, etc. Those are all great things, but they rely on programmers having the time (and skills) to write up the documentation and attend the meetings and take notes and remember everything. The most popular answer so far (Caleb's) is the only one that could be used by a programmer who is incapable of documentation and meetings, and does only one thing: programming. Programming is what a programmer does, and yes, a great programmer can write up documentation, unit tests, etc., but let's face it - most of us prefer programming to documenting. His solution is one where the programmer recognizes re-usable code and pulls it out to its own class or repository or whatever, and _by the fact that it is isolated,_ it becomes find-able and eases the learning curve for using it.... and this was accomplished by programming. In a way I see it like this: I've just written three functions, and it occurs to me that someone else should know about them. I could document them, write them up, announce them at a meeting, etc. - which I can do, but it's not my strength - or .... I can extract them to a class, name it well, make them function like a black box, and stick it where other class files go. Then a short email announcing it is easy. Other developers can scan the code and understand it better than they could an isolated function used in code they don't fully understand - that context is removed. I like this because it means having a set of well-named class files, with well-named methods, is a good solution that is accomplished by good programming. It does not require meetings, and it softens the need for detailed documentation. Are there any more ideas in this vein ... for isolated and time-pressed developers?


What C++ coding standard do you use?

For some time now, I've been unable to settle on a coding standard and use it concistently between projects. When starting a new project, I tend to change some things around (add a space there, remove a space there, add a line break there, an extra indent there, change naming conventions, etc.). So I figured that I might provide a piece of sample code, in C++, and ask you to rewrite it to fit _your_ standard of coding. Inspiration is always good, I say. ^^ So here goes:               #ifndef _DERIVED_CLASS_H__     #define _DERIVED_CLASS_H__          /**      * This is an example file used for sampling code layout.      *      * @author Firstname Surname      */                    #include <stdio>     #include <string>     #include <list>     #include "BaseClass.h"     #include "Stuff.h"                    /**      * The DerivedClass is completely useless. It represents uselessness in all its      * entirety.      */     class DerivedClass : public BaseClass {              ////////////////////////////////////////////////////////////         //   CONSTRUCTORS / DESTRUCTORS         ////////////////////////////////////////////////////////////          public:              /**          * Constructs a useless object with default settings.          *          * @param value          *        Is never used.          * @throws Exception          *         If something goes awry.          */         DerivedClass (const int value)          : uselessSize_ (0) {}              /**          * Constructs a copy of a given useless object.          *           * @param object          *        Object to copy.          * @throws OutOfMemoryException          *         If necessary data cannot be allocated.          */         DerivedClass (const DerivedClass& object) {}              /**          * Destroys this useless object.          */         ~DerivedClass ();                        ////////////////////////////////////////////////////////////         //   PUBLIC METHODS         ////////////////////////////////////////////////////////////          public:              /**          * Clones a given useless object.          *          * @param object          *        Object to copy.          * @return This useless object.          */         DerivedClass& operator= (const DerivedClass& object) {             stuff_ = object.stuff_;             uselessSize_ = object.uselessSize_;                 }              /**          * Does absolutely nothing.          *          * @param useless          *        Pointer to useless data.          */         void doNothing (const int* useless) {             if (useless == NULL) {                 return;             }             else {                 int womba = *useless;                      switch (womba) {                     case 0:                         cout << "This is output 0";                         break;                          case 1:                         cout << "This is output 1";                         break;                          case 2:                         cout << "This is output 2";                         break;                          default:                         cout << "This is default output";                         break;                 }             }         }              /**          * Does even less.          */         void doEvenLess () {             int mySecret = getSecret ();             int gather = 0;             for (int i = 0; i < mySecret; i++) {                 gather += 2;             }         }                        ////////////////////////////////////////////////////////////         //   PRIVATE METHODS         ////////////////////////////////////////////////////////////          private:              /**          * Gets the secret value of this useless object.          *          * @return A secret value.          */         int getSecret () const {             if ((RANDOM == 42) && (stuff_.size() > 0) || (1000000000000000000 > 0)                 && true) {                      return 420;             }             else if (RANDOM == -1) {                 return ((5 * 2) + (4 - 1)) / 2;             }                  int timer = 100;             bool stopThisMadness = false;             while (!stopThisMadness) {                 do {                     timer--;                 } while (timer > 0);                      stopThisMadness = true;             }         }                        ////////////////////////////////////////////////////////////         //   FIELDS         ////////////////////////////////////////////////////////////          private:              /**          * Don't know what this is used for.          */         static const int RANDOM = 42;              /**          * List of lists of stuff.          */         std::list <Stuff> stuff_;              /**          * Specifies the size of this object's uselessness.          */         size_t uselessSize_;          };                    #endif


Java Generics - how to strike a balance between expressiveness and simplicity

I'm developing some code that utilizes generics, and one of my guiding principles was to make it usable for future scenarios, and not just today's. However, several coworkers have expressed that I may have traded off readability for the sake of extensibility. I wanted to gather some feedback about possible ways to resolve this. To be specific, here is an interface that defines a transform - you start with a source collection of items, and you apply the transform to each element, storing the results in a destination collection. Additionally, I want to be able to return the destination collection to the caller, and rather than forcing them to use a Collection reference, I want them to be able to use whatever collection type they actually provided for the destination collection. Finally, I make it possible for the type of items in the destination collection to be different from the type of items in the source collection, because maybe that's what the transform does. In my code, for instance, several source items make up one destination item after the transform. This yields the following interface:               interface Transform<Src, Dst> {         <DstColl extends Collection<? super Dst>> DstColl transform(                     Collection<? extends Src> sourceCollection,                     DstColl                   destinationCollection);     }      I tried to be all nice and apply Josh Bloch's PECS principle (producer extends, consumer super) to make sure the interface is usable with super- and sub-types where appropriate. The end result is somewhat of a monstrosity. Now, it would have been nice if I could extend this interface and specialize it somehow. For example, if I don't really care about playing nice with subtypes of the source items and supertypes of the destination items, I could have:               interface SimpleTransform<Src, Dst> {         <DstColl extends Collection<Dst>> DstColl transform(                       Collection<Src> sourceCollection,                       DstColl         destinationCollection);     }      But there is no way to do that in Java. I want to make implementations of this interface something that others would actually consider doing, as opposed to running in fear. I've considered several options:   * Don't return the destination collection. Seems weird given that you do a transform but get nothing back.   * Have an abstract class that implements this interface, but then translates the parameters to something easier to use and calls another method "translateImpl()" which has the simpler signature and thus presents less of a cognitive burden for implementers. But then it's weird to have to write an abstract class just to make an interface user-friendly.   * Forgo extensibility and just have the simpler interface. Possibly couple that with not returning the destination collection. But then that limits my options in the future. What do you think? Am I missing an approach I could use?


Why do code generators always use fully-qualified identifiers?

When you look at the code for the Winforms Designer, you see things like this:               this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", ... etc.      instead of               using System.Drawing;     label1.Font = new Font("Microsoft Sans Serif", ... etc.      The same is true of tools like Linq to XSD, XSD2Code and, I suspect, of Linq to SQL. These tools generate hoards of code with extremely long fully- qualified names. Wouldn't it be easier to generate the appropriate `using` statements, and ditch the long names? Or is there some technical reason for this that I'm missing? * * * **Note:** For those folks that are baffled by the notion that I might want these classes to actually be readable by a human, note that this is exactly my goal. I have an XSD with about 300 classes in it, I don't want to write them all by hand, and yes, I'd like them to look like ordinary code written by humans.


What is good practice when inheriting static classes isn't possible/allowed

I am developing a project in C# and due to a design decision it is not possible to have a static class inherit another static class. But I have, in my opinion, a case where this would make sense. I have a music player which is able to play music from many different music sources: local files, YouTube, SoundCloud, Jamendo, etc. I have currently one static class for each of these sources with static methods such as retrieving the top tracks, searching for tracks, etc. Naturally, a lot of code is shared among all these classes so I wanted to refactor and put all common code into a more generic MusicSource class. But C# doesn't allow me to do that. What would be the best practice here? I want to get rid of all my redundant code and make it easier to create new music sources.


Help needed with class design and structure

This question is mostly about the best way to approach this problem. Any input is appreciated. ### The Problem In my application i need to send some data to a number of different destinations (we will call them receivers from now on) using different protocols (http post, ftp, soap services). Each of the different receivers respond differently and some processing needs to be done on each response to work out what happened. This response processing can become quite complex. My application also needs to do take different actions based on the receiver. ### My Solution My plan is to create a separate class for each receiver that implements an interface and use Factory design pattern to decide which class to load based on the receiver. Each receiver has a unique name (which is stored in the database for other reasons) which i plan to use to decide which receiver to load. I'll pass this to the factory constructor. Currently i plan to have my interface implement these methods   * prepareData()    * sendData()    * handleResult() I'd also like a wrapper for these function such as process() which would just return a boolean based on wether the send sent. I'm not sure where i would fit this in though. Thanks


How to develop line-of-business tablet apps as a .NET developer?

My company has a lot of experience in .NET development, and one of our products in an ERP system. Recently, a customer asked us if we could provide a tablet interface to that system, i.e., a software that allows the customer to view product information and create orders on a tablet. Of course, we are not thrilled about the idea of investing a lot of time and money into learning Objective-C, purchasing Mac development workstations, paying fees to Apple, etc. just for this one project (we _might_ be able to sell the app to a few additional customers afterwards, but the market is very small, since it would only be useful for existing customers of our ERP system). So, what should we do? As far as I can see, we have the following options:   * Write a " **plain old Windows application** " (WPF) and run it on a Windows 7 tablet, such as the Samsung Slate or Acer Iconia. Drawbacks: Heavy, expensive devices with short running time (as compared to "real" tablets).   * Wait for **Windows 8 ARM-based tablets** and write a Metro (WinRT) app. Drawbacks: Wait for at least one year; it's unclear whether Windows 8 ARM will support installation of custom B2B apps without going through the app store.   * Use **mono for Android** and write a .NET app for Android. Drawbacks: Yet another UI library (different from WPF and Silverlight); some providers disallow sideloading of apps. So far, options 1 and 3 seem to be the most realistic. Did I miss any obvious drawbacks or advantages? Is there another option that I haven't considered yet? Have you been in a similar situation and (successfully) chosen one particular option?