Is there anything special to consider when writing my own exception class in C++?

If I wanted to implement my own version of the std::exception for no good reason, are there any special things about implementing this kind of object that I should be aware of? It seems like a fairly simple thing that is mostly a string wrapper... Here is my implementation so far:               #pragma once;          #include <string>          class MyException     {     public:         MyException(const std::wstring&);         virtual ~MyException(){}              virtual MyException& operator=(const MyException& rhs);         virtual const std::wstring& what(){return msg;};          private:         std::wstring msg;     };          MyException::MyException(const std::wstring& message)     :msg(message)     {     }          MyException& MyException::operator=(const MyException& rhs)     {         if(this == &rhs)         {             return *this;         }         msg = rhs.msg;         return *this;     }


Difference between extensible programming and extendible programming?

What exactly is the different between "extensible programming" and "extendible programming?" Wikipedia states the following: > The Lisp language community remained separate from the extensible language > community, apparently because, as one researcher observed, any programming > language in which programs and data are essentially interchangeable can be > regarded as an extendible [sic] language. ... this can be seen very easily > from the fact that Lisp has been used as an extendible language for years. If I'm understanding this correctly, it says "Lisp is extendible implies Lisp is not extensible". So what do these two terms mean, and how do they differ?


Assuming "clean code/architecture" is there a difference in "effort" between PHP or Java/J2EE web application development?

A client asked us to estimate effort when selecting PHP as the implementation language for his next web-based application. We spent about a week exploring PHP, prototyping, testing etc., We are quite new to this language - may have hacked around it in the past but, let's go with PHP-noobs but application development experts (for the lack of a better, less flattering word :) It seems, that if we write, clean maintainable code, follow separation of concerns, enterprise architecture patters (DAOs etc.) the 'effort' in creating an object-oriented PHP based web-application seems to be the same for a Java based one. Here's our _equation_ for estimating the effort (development/delivery time):               ConstructionEffort = f(analysis, design, coding, testing, review, deployment)      We were specifically comparing effort estimates in creating an enterprise application with the following:   1. PHP + CakePHP/CodeIgniter (should we have considered others?)   2. Java + Spring + Restlet  It's an end-to-end application:   1. Client: Javascript/jQuery + HTML/CSS   2. Middle tier/Business Logic - _(Still evaluating PHP/Java)_   3. Database: MySQL The effort estimates of the 1st and 3rd tier are constant and relatively independent of the middle tier's technology. At a high level with an initial breakdown into user stories of the requested features as well as a high-level SWAG on the sheer number of classes/SLOC that would be required for PHP doesn't seem to differ by much from what is required of the same in Java. Is this correct? We are basing our initial estimates on the initial prototyping/coding we've done with PHP - we are currently disregarding fluency with the language as a factor, since that'll be an initial hurdle and not a long term impediment IMHO (we also have sufficient time to become quite fluent with PHP). I'm interested in knowing the programmers' perspective with respect to effort when creating similar applications with either of the languages to justify choosing one over the other. Are we missing something here? It seems we are going against popular belief of PHP being _quicker_ to market (or we being very fluent with Java have our vision clouded). It doesn't seem to have any coding/programming effort saving from what we/ve played around with.


Is possible to write too many asserts?

I am a big fan of writing `assert` checks in C++ code as a way to catch cases during development that cannot possibly happen but do happen because of logic bugs in my program. This is a good practice in general. However, I've noticed that some functions I write (which are part of a complex class) have 5+ asserts which feels like it could potentially be a bad programming practice, in terms of readability and maintainability. I think it's still great, as each one requires me to think about pre- and post- conditions of functions and they really do help catch bugs. However, I just wanted to put this out there to ask if there is a better paradigms for catching logic errors in cases when a large number of checks is necessary. **Emacs comment** : Since Emacs is my IDE of choice, I have it slightly gray out the assert statements which helps reduce the feeling of clutter that they can provide. Here's what I add to my .emacs file:               ; gray out the "assert(...)" wrapper     (add-hook 'c-mode-common-hook       (lambda () (font-lock-add-keywords nil         '(("\\<\\(assert\(.*\);\\)" 1 '(:foreground "#444444") t)))))          ; gray out the stuff inside parenthesis with a slightly lighter color     (add-hook 'c-mode-common-hook       (lambda () (font-lock-add-keywords nil         '(("\\<assert\\(\(.*\);\\)" 1 '(:foreground "#666666") t)))))


Has the MVVM pattern been adopted widely in real world Silverlight projects?

MVVM pattern is a hot word recently and I am planning to learning and refactor my existing project into this pattern. I have no experience and foresight of the potential risk. Have you guys really get lots of benefit from the MVVM Pattern in real-world projects? Is it worth refactoring an existing non-MVVM (mainly using Code-Behind files) into the MVVM pattern?


Explaining how the code you wrote works

I was asked to create for a freelance project a Monopoly game in Java. After finishing it the same guy asked me to create four UML diagrams from which he could understand how the game works. Everything went well this far but his third request presented me with some problems. He now wants me to write for him in about 20-25 pages, how the game's code works, so he can understand it. I have been programming for about a year and I was never asked to do this before. I don't even know where to start to do this, from which portion of the code should I start to explain it? I basically suck at writing. Is there any guide that could help me achive what I need? I've already created the use case diagram sequence diagram, class diagram and activity diagram.


Javadoc usage on real projects

I'm wondering if the Javadoc is using on real projects, what your experience says about it?


C library build system dependencies

This debate has cropped up on a mailing list for a project I'm involved in. Unfortunately we're quite a small bunch at the moment, so I want to ask a wider audience. We're writing a C library (for arbitrary precision arithmetic) and are investigating build systems. Currently we have a bash script in desperate need of work. I believe we can't use autotools etc due to licensing (bsd vs gpl). So I suggested we use a modern scripting language like python or perl. The question is: is having something like perl or python around at build time _an unrealistic dependency_ on Unix-like platforms these days?


Is there a correlation between some software engineering practices and software engineering success stories?

I've been reading the book "The Drunkard's Walk: How Randomness Rules Our Lives" by Leonard Mlodinow and it's a truly enlightening read. The book deals with probabilities and human reasoning. And let's just say, for the record, that while some things sometimes work, there's a chance that the things you thought made it work, are unrelated to what actually made it work. > Probabilities are unintuitive. However, it gave me an idea. There ought to be studies on this already, that have attempted to quantify the results of software engineering endeavors (which of course is a hard problem in itself). And these studies should point to what kind of software engineering practices are really important in terms of quantifiable success. i.e.   * A team that employs TDD is `this` much less likely to have `this` kind of problem.   * A team that employs SOLID principles is `this` much less likely to have `this` kind of problem.   * etc. etc. What I'm looking for here is software engineering practices that show strong correlation between implementation and success. I'm confident that these things exist but that they are hard to come by and that's why I pose this question. What studies or what practices do you know of that have strong correlation between implementation and success (where success is **somewhat arbitrary** but I think you get the idea)? > If we're gonna sell that idea that software engineering is better than > cowboy coding, I think we need proofs.


Are interviews required for software/programming internships?

Do companies interview prospective software or programming interns? Do any companies use video interviews? Thanks.


Wrapping a 3rd party API - Gateway Pattern connections

Given a 3rd party API with a very cumbersome object with many different responsibilities-- we decide to wrap using small, manageable, single- responsibility objects. This is the gateway pattern (I think). So any time you do this there is going to be some kind of "connection" where you have to connect to the resource. Furthermore, calling applications may want to keep a single connection open and use it with multiple objects (those small, manageable, single-responsibility ones we created). What form should this connection take? Should this connection be another object? Should it be passed it to the constructor of the small wrapper objects? Or, should the wrapper objects inherit from a connection object? Or aggregate it? What about the special case where we can have only have only one connection per application?


Studies of open source software adoption

I'm not 100% sure this is approriate here, but I figure the area of study is particular to programmers, since it's open source software. If it's better posted somewhere else then please say so and I will post it there. * * * Can anybody point me in the right direction of any studies on businesses and consumers adopting open source software? Ideally, I'd like some qualitative information on why both parties choose (not) to adopt open source software, but raw numbers are good too. Any relevant experiences and case studies of this from users would be welcome as well.


Why are you choosing XYZ? - Is this valid question in interview?

I am tired of the question from interviewers - Why have you selected 'XYZ' (the interviewer's organization). In today's IT world, does anybody go looking for a COMPANY. I mean what the interviewers are thinking? that somebody from the sky will come searching for their company and desperate to work with them.. I faced the same question multiple times. I dont understand what to answer this. Can anybody help here...


What is the name of this array transformation?

Start with an array of arrays; in this case, they are different lengths in order to demonstrate the technique, but they do not have to be.               [[1,2,3,4], [5,6,7], [8,9,10], [11,12,13,14,15]]      At the other end of the transformation, you have an array of arrays where the first array contains the first element from each of the original arrays, the second array contains the second element from each of the original arrays, and so on.               [[1,5,8,11], [2,6,9,12], [3,7,10,13], [4,14], [15]]      Is there a mathematical or CS term for this operation?


Should I let my users write BnfExpressions to extend my grammar?

## Preface I'm designing a templating language (please skip the don't/why?? speech). One of the major goals of this language is to be extensible. There are 2 main elements in my language. "Tags" and "Directives". Tags, for the most part, map 1-to-1 to HTML tags, with the exception of a few of them which do a bit more. "Directives" are things like conditionals and for/while loops. "Tags" are simple, because they all follow the same structure: `tag_name(arg1=val1, arg2=val2) { content }`. Directives are more complicated because they look like this: `directive(anything-can-go-here) { content }`. ## Question I'm trying to decide how to let users (other devs using the templating language) write their own directive -- i.e., define the "anything can go here" part. I'm using Irony to parse my language. Should I give them the same level of access, and define their own `BnfExpression` (requiring them to learn a bit of Irony/EBNF), or should I just toss them a string (the stuff between `(` and `)`) and let them parse it however they want? ## My Concerns The former is perhaps more powerful and easier to work with (once you know it), but it would also potentially give them too much power (they wouldn't have to stop at the next `)` \-- well, unless I stripped out the inner string first and then basically let them define a sub-grammar to parse only that). Not sure how to approach this. ## More About Tags For reference, users can define "tags" like this:               class ANode : HtmlNode     {         public ANode(AttrDict attrs, params TagNode[] children)             : base("a", attrs, children) { }     }      Would be the most basic example, which just extends the HtmlNode I've already defined. A more complicated one might define some default attributes or do something fancy with the child elements, or generate multiple html tags.


Interviews that include Algorithms and Data Structures

I want to start looking for jobs in great companies and I have four years of enterprise corporations development, three years with C#.NET and alomst one year with Ruby On Rails, JS, etc... But when I look up interview questions from Google, Amazon, Fog Creek, DropBox, etc... they are really targeted at students that are coming fresh out of college and still remember what was Dynamic Programming and Dijkstra algorithms ... but I don't! :( It has been a while for me ... If a I need a sort algorithm I would either Google it or there already is a library and method that does it for me. So what should I do? Do they realize that this guy is not coming from college and will ask more general questions about software architecture or nop! I should go back find my old Data structures book from the storage and read them? In that case wht books and language do you recommend to hone my skills?


Which license should I choose?

I'm working on an engine (I haven't started coding it yet but I like to have everything done as soon as I can, and since I'm unable to start coding it now, I'm working on these small things) and I want to license the code. For now, I'm thinking of leaving the project open-source, but later I might turn it proprietary so I was wondering what would be the best license for an open- source project (it's an offline project, I mean, it's C++/Lua based, not a web project) and also a proprietary license for later, in case I really turn it proprietary (I did search about both types of licenses, but from what I understood I have to make the proprietary license by myself, which would include registering copyright, contracting a laywer, etc. and don't want to waste money on this project, at least not for now). I would like users to have the possibility to modify, use parts of my code and use my whole engine in their projects (for the open-source license, of course the proprietary license will have other rights, but paid) BUT EVER HAVING STATED THE CODE IS COPIED/MODIFIED FROM MY ENGINE, AND IS NOT THEIRS CODE.


Architecting Challenge: How would you write an opensource script installer to run in a browser?

I currently have an installer that works, but I have to repackage the open source apps and hack things together to get the installer to install them. I want to be able to use the apps installation method without having to hack and repackage. So I am thinking about rewriting it. It will allow a user with little to no tech experience install open source apps (ie. WordPress, Joomla, Drupal, et.al.). There are a few requirements I want to meet:   * The installation should run the scripts install process to make sure the database is setup correctly and the passwords use the apps default password encryption processes.    * Ability to track the progress and report back any errors.   * Ability to run upgrades for future releases.   * Ability to remove the application if someone decides they do not want it any longer.   * The only access I will for sure have to the users remote server is via FTP. I have thought about using Selenium. However, if you were challenged to hand spin the code in PHP, how would you do it? **UPDATE FOR CLARIFICATION:** The installer will collect the scripts settings from a form in the browser filled out by the end user. The installation process (that runs in the background and connects over FTP to the users server) will then process the installation. (i.e. SimpleScripts, Installatron, Softaculous, Fantastico, WebPub, etc.) I am trying to figure out how you would design the cleanest simplest install process possible. It needs to create databases, install the application using the scripts install method (as if the user was running it manually), etc. I hope that clarifies the challenge.


Processes: documenting changing spec

A little background: I work at a relatively small (<10 developers) tech company which basically produces a single product, which is constantly evolving and being added to. The product is an off-the-shelf client/server product, where we run the server and the clients are mobile apps running on a variety of platforms (Android, iOS, WinMo, etc.). The bulk of the specification and documentation is maintained in an internal Wiki. Whenever we add a new feature or expand an existing one to the client apps, the process goes more or less like this:   1. A spec. for the change is produced. Generally these specs are very low on detail, often just consisting of a few user stories: "As a user, I want to..."   2. The feature is implemented on a single platform. Which platform often depends on which developer is most free at the time, as different developers specialise in different platforms.   3. Once the feature is more or less completed on the lead platform, it gets ported to the other platforms. Because the initial specification is so general, step 2 usually requires making a lot of the more detailed decisions - file formats, what to do when things go wrong, etc. Decisions are generally made after consultation with the project manager. The problem we have is that there's no real procedure for making sure the decisions made in step 2 actually get documented. In an ideal world I guess responsibility might fall to the project manager, but since he's also a company director he frankly doesn't have the time! My question is: **Can anyone suggest a process (or processes) we could use to ensure these decisions get documented?** It's all very well to say "just update the wiki when decisions get made" but real-world considerations (time pressure, interruptions to deal with user support issues, etc.) often mean that it gets forgotten.


Tracking software piracy to gauge strength of anti-piracy measures

I've been looking up this thread on how software piracy can be prevented. It's got a number of interesting suggestions ranging from using copy protection to providing free versions, and not surprisingly, none of them will satisfy you 100%. It will perhaps be apt to experiment with each of the popular anti-piracy measures to gauge success. Are there reliable surveys that point to the success or failure of such measures? Furthermore, surveys are often biased because of countless factors, and perhaps the software product developer himself should attempt to gauge success or failure of a particular measure. If I decide to resort to the second option, what would you suggest to obtain hard data about software piracy patterns for _my_ specific product?


What is meant by sandboxing?

Sanboxing is listed as one of the many security features in html5 specification . Can someone explain what is meant by sandboxing? Does it relate to HTML only or to JavaScript also?


Designing a Business Rule Engine

I have a requirement where there are 10 Rules to be applied on data in excel. If Rule 1 and Rule 2 fails rest of the rules are not checked. But if Rule 1 and Rule 2 passes the rest of all the Rules should be verified and if any errors found- they should be logged. Is there any design pattern which I can use to keep this Rule Engine flexible for adding these 10 rules and Closed for any additional chains in the Current Rule. I was thinking of something like a Decorator Pattern. Will this help me achieve that?


"Collection Wrapper" pattern - is this common?

A different question of mine had to do with encapsulating member data structures inside classes. In order to understand _this_ question better please read _that_ question and look at the approach discussed. One of the guys who answered that question said that the approach is good, but if I understood him correctly - he said that there should be a class existing just for the purpose of wrapping the collection, instead of an ordinary class offering a number of public methods just to access the member collection. For example, instead of this:               class SomeClass{              // downright exposing the concrete collection.                      Things[] someCollection;             // other stuff omitted              Thing[] getCollection(){return someCollection;}          }      Or this:               class SomeClass{              // encapsulating the collection, but inflating the class' public interface.              Thing[] someCollection;              // class functionality omitted.              public Thing getThing(int index){             return someCollection[index];         }              public int getSize(){             return someCollection.length;         }              public void setThing(int index, Thing thing){             someCollection[index] = thing;         }              public void removeThing(int index){             someCollection[index] = null;         }          }      We'll have this:               // encapsulating the collection - in a different class, dedicated to this.          class SomeClass{         CollectionWrapper someCollection;              CollectionWrapper  getCollection(){return someCollection;}     }          class CollectionWrapper{              Thing[] someCollection;              public Thing getThing(int index){             return someCollection[index];         }              public int getSize(){             return someCollection.length;         }              public void setThing(int index, Thing thing){             someCollection[index] = thing;         }              public void removeThing(int index){             someCollection[index] = null;         }          }      This way, the inner data structure in `SomeClass` can change without affecting client code, and without forcing `SomeClass` to offer a lot of public methods just to access the inner collection. `CollectionWrapper` does this instead. E.g. if the collection changes from an array to a `List`, the internal implementation of `CollectionWrapper` changes, but client code stays the same. Also, the `CollectionWrapper` can hide certain things from the client code - from example, it can disallow mutation to the collection by not having the methods `setThing` and `removeThing`. **This approach to decoupling client code from the concrete data structure seems IMHO pretty good.** Is this approach common? What are it's downfalls? Is this used in practice?


Globalizing geographical information in data design

I am building my database/models/viewmodels right now and can't think of a good variable name to define for the equivalent of a "state" in other countries. I currently have `Country` and `City` which are pretty common.   I know Canada has `Province`s and France has `Department`s instead of states.   What are some ways you guys have abstracted user's locations? I thought about `FirstDegree`, `SecondDegree`, `ThirdDegree` but that is too vague. What are some common field names you have seen in the past?


What is a good way to store geographical data for distance calculations

What would be the best way to store data in a database for geographical calculations? Say I have an `ItemsForSale` table paired to a `Users` table which holds their geo location. I know I can use latitude and longitude to look up items that are within a certain mile radius by using Lambert's formula for long lines or the Haversine formula but I am not sure if there is a better approach for this.


Permutations of an array

I have an array of integers of length 20, filled with fourteen 0s, two 1s, two 2s and two 3s. It is like this: [0,0,0,3,0,2,0,0,3,0,0,0,1,0,2,0,0,1,0,0]. I need a way to list all of its 20!/(14! 2! 2! 2!) permutations, without repetitions. (Note that in the list there are duplicate elements!) I'm just looking for the right idea, it isn't necessary that you write the code. But, if you prefer writing the code, I only understand C and Java. Thanks :)


Do you find languages with indentation requirements cumbersome?

Thoughts on these? Python is one example, and no this is not a stab against Python I like the language. What languages have a indentation requirement?


Are NuGet metadata a good place to exclusively set license for source code?

I've found a library (that I'd like to fork, if it makes any difference). On NuGet, the project file says it's distributed under the MIT license (with a link to the license). However, in the GitHub repository of the project, I don't see any mentions of the MIT license (or any other license) either in the source code files or in a readme. I'm a little concerned about this, since NuGet is a repository for binaries and I'm interested in the source. **Should I assume that the source code is covered under the MIT license, judging only by the NuGet metadata of a package?** Or does this mean that the permissions apply only for the binary and not for the source?


Do you keep your ideas secret? and why?

I believe any programmer has several ideas that she/he considers as innovative or at least valuable. It may be an idea of a new product which will make this world better or a new development approach, etc. But a great idea must be implemented and promoted/advertised. This requires a lot of work (proofs of concept, prototypes, technology previews, etc.) and a lot of money (appropriate advertisement, marketing, etc.). So months later, the idea stays in our heads, but nothing else is done, because it's difficult, long and expensive, sometimes even impossible for a single developer. On the other hand, it would be painful to share our ideas, and see a medium- size company which has enough resources making something useful from it and having success and money. So what do you do with your ideas you can hardly implement or patent? Do you talk freely about them in discussion boards and with other developers? Do you keep them like a precious thing without never talking about them to anybody? If you keep your ideas, why are you doing so? Is it just because you hope that one day, you will be able to implement them and have a huge success, while you know very well by experience that it's an utopia?


How to organize projects in Redmine?

I deployed a Redmine installation yesterday and today I try to fill it with some relevant data. One issue I came across is the organization of projects itself. While I took a look at how Redmine itself uses parts of the software, they unfortunately have only one project set up and I haven’t seen any other examples. I know that this is heavily tied to your workflow, but seeing / reading about some examples would guide me to the right path. We are two guys (a designer & developer, both of us do also other stuff like marketing or paperwork) and we have more than 20 projects that I want to map to Redmine. Less than a handful of projects are active at the same time and they aren’t specifically related. However, we want to see how much time we spent on all projects and also see the overall project situation, i.e. should we start another project or add this or that to the current one or won’t this be doable for such a small team? At the moment I tend to have one of these setups:   1. A company project and all of our real projects organized as subprojects.   2. Separate Redmine projects for each of our projects, and eventually subprojects for broader functionality if needed (sync support for app xyz). The problems I see with the first approach is that the projects aren’t necessarily related to each other. They may share a common framework which is a project for itself, but otherwise they are really separate things. All of them are software projects, so they share common metaphors like Trackers, though. I haven’t seen a way to separate versions. The roadmap would be an overview of the current work situation, but it could get pretty confusing. My biggest fear is that we will have endless drop down lists with unrelated things like versions from other projects. The second approach seems to be saner, but my biggest fear is that we won’t have the general overview. We would have to look at all other roadmaps to plan the current one, we wouldn’t see just one calendar with things to do in all projects. I think the core of the problem is that we have very limited human resources that have to be shared across a lot of projects, but they mustn’t overlap. Any ideas how this can be mapped to Redmine?


Aggressive Auto-Updating?

What do you guys think is best practice regarding auto-updating? Google Chrome for instance seems to auto-update itself as soon as it get's a chance without asking and I'm fine with it. I think most "normal" users benefits from updates being a transparent process. Then again, some more technical users might be miffed if you update their app without permission, as I see it there's 3 options: 1) Have a checkbox when installing that says "allow automatic updates" 2) Just have a preference somewhere that allows you to "disable automatic updates" so that you have to "check for updates manually" I'm leaning towards 2) because 1) feels like it might alienate non-technical users and I'd rather avoid installation queries if possible. Also I'm thinking about making it easy to downgrade if an upgrade (heaven forbid) causes trouble, what are your thoughts? Another question, even if auto-updates are automatically, perhaps they should be announced. If there's new features for example otherwise you might not realize and use them One thing that kinda scares me though is the security implications, someone could theorically hack my server and push out spyware/zombieware to all my customers. It seems that using digital signatures to prevent man-in-the-middle attacks is the least you could do otherwise you might be hooked up to a network that spoofs the address of of update server.


Is it bad practice to include two types of views in the same class?

In my app, I use a widget with a loading spinner to signify that a network request is waiting. On failure, there will be another view which contains a failure message and a "Reload" button. My question is, since both of these views/widgets will ALWAYS be used together (either one or the other will be shown - or neither), should I merge them into a single widget? Would that be bad or good practice? That way I wouldn't have to prepare them both whenever I want to use one of them. The main disadvantage I see is that modularity would be destroyed.


Why do these iOS and OSX framework structures contain a version called 'A'?

I've been looking at development strategies for frameworks and have found a few good resources. However in the structure of frameworks in iOS and OSX I want to know why inside of the versions folder, there is a folder called 'A'?               MyFramework.framework/         MyFramework  -> Versions/Current/MyFramework         Resources    -> Versions/Current/Resources         Versions/             A/                 MyFramework                 Resources/                     English.lproj/                         InfoPlist.strings                     Info.plist             Current  -> A      According to the Apple documentation it seems that multiple versions can be created, however is there a logical or possibly historical reason why the character 'A' is used instead of using something like a date or version number? Sources:   * Apple Developer: Anatomy of Framework Bundles   * Cocoa Tutorial: Creating You Very Own Framework


OOP design question

I'm working on an application written in PHP using OOP principles. The classes in my application usually represent a table in the database; for instance, 'student', 'teacher', 'class', 'schedule', etc. As the application gets more and more complex, I start running into situations where it feels like writing a new query would be more efficient / faster than reusing the lower level objects + methods than I've already written. What's the standard philospohy when it comes to this? Is it handled on a case-by-case basis? Do you **always** reuse your code to prevent repeating yourself, even at the cost of the efficiency gained from one database query?


Allowing enum to express a valid combination of values

Suppose in a manufacturing environment, there are certain stock materials available for use in a product. For example, there are only a few different sizes of copper tube, each having a specific thickness and diameter combination. For the purposes of clean and minimal code as well as the ability to control the available options, is an `enum` a good fit for this combination of data? I was thinking I could make an `enum` with a member for each valid stock item (representing metal, physical measurements, etc.), and then provide extension methods on the `enum` to return the mentioned details. The stocks available for use may change over time, so maybe an `enum` is not the best answer. Is there a better way to express the valid combination of related values? I am using c#.


terminology: Memory leak

When I hear the term _memory leak_ by that I mean a bug in a program that doesn't cause _any_ problems _except_ that it doesn't free memory resource and if it continuously does that it can eat a lot of memory, hurting system performance and in the worst case crash the program (or an other program, if the OS decides to choose to kill that one). But now in this comments section of this question the upvotes made me think whether that's the whole meaning of the term. I previously always saw used it in that meaning. http://stackoverflow.com/questions/7451437/is-this-a-mem-leak-in-main So, would you call something a simple memory leak that crashes a program by some other side-effect or causing a dead-lock by not freeing a lock? **Update** \- Note: unfortunately some admin deleted the comment section there so I cannot refer to that discussion anymore :/ Basically I said that a memory leak is _harmless_ except that it eats up memory (and consequently on the long term in that respect can be harmful, crashing the app/system). They said that's not true, with C++ RAII it can cause serious problems. - Yes, if you don't delete an object with some important code in the destructor that can cause problems, but in my vocabulary that's a major bug and not a memory leak.


Starting on Web Project now - Do we choose HTML5/JS over Silverlight?

we are about to start on a Web Development project (the planning starts early 2011). Do we choose HTML5/JS over Silverlight? Are there any applications which now run on HTML5? Samples? A simple Google Search led me here. Those look great (especially the Star Wars one!), but they are not what you call proper applications as such.


How to represent hard-to-calculate "properties" of "objects" in functional code?

I have a polyline "class" in my Clojure program, which is represented by a vector of points. (It's not really a class or anything.) The polyline's length (in the geometric sense) is something that is often needed for computations. It's also fairly slow to calculate every time it's needed. In OO code, I'd just have the length as a property of the Polyline class. But in functional code, I'm lost. Do I duplicate the OO pattern and make the polyline a map of `{:points points, :length (length points)}`? Do I make a `length` function and `memoize` it? Do I just depend on the compiler to cache the results?


What Are The Best Practices for Managing Version Strings in Google App Engine Apps?

In Google App Engine, you can upload up to 10 different versions on your appspot project. For instance, if I have a project called `example`, the URL would be:               http://example.appspot.com      Each version I upload is given a version string. Possible examples are:   * dev   * 1   * 1_2   * staging   * anystring To access a specific version, I would prefix the domain with the version string, like so:               http://1.example.appspot.com      Of course, if that version is made the "default" version, then I can access it without prefixing with the version string, such as in the original URL at the beginning, http://example.appspot.com. What are the current best practices for managing version strings on Google App Engine Apps, in your experience? Also, once I surpass the max 10 versions and have to start deleting them, what is the suggested practice?


Anyone Been Through the .NET Program with SetFocus?

By day, I'm a PowerBuilder developer. By night, I dream of being a .NET developer. Sure, I can self-teach mostly everything I need, but I also love classroom learning and 'earning' my education. I am considering 'attending' the SetFocus course for .NET development. My hesitations? It's expensive. Anyone? Feel free to tell me its a crazy idea, regardless of the money. I'm interested in your opinions.


Advice for becoming a better programmer

I am a team lead dealing with a programmer with a Bachelors Degree in Computer Science. He has a couple of years of experience and is still a code monkey. Having observed him for quite a while, he is very slow in programming even fizzbuzz style questions. For other stuff, he tries to make do with just tinkering with code or asking for help on programming forums. For scripting stuff he get can barely get by with that, but for our core work of embedded systems using our proprietary toolchains, online forums are not of much help. As a result, he is either very late or incomplete so that I am forced to assign his work to others. When confronted he acknowledges all of this, but he does not know what practical steps he needs take on how to improve. He gets stuck on issues for a long time, being unable to debug. How to develop his skills to the next level, make him a problem solver, develop architecture skills and understand large systems, debugging skills and make him plan his tasks? In all his annual performance reviews he has never rated high. As his team-lead I have to develop a plan of action in consultation with him. Asking him to quit is always the last option but I would like to avoid that.


Is C++ really a bad language for beginners?

I'm learning C++ right now, and it's the first language I'm learning. I keep seeing on stackexchange and other forums (Reddit, etc.) that I should drop C++ and learn a higher level language like Python or Java. The only arguments I see are that "C++ is harder to learn and is more low-level than others." which don't really give a reason NOT to learn it. I want to know if there are any actual reasons for dropping C++ and taking up another, "easier" language. Or if I should keep focusing on it, and just learn others later (which is what I plan on doing).


How did you pick up the art of solving real life problems? Can you shortcut the process?

I have been coding on and off on C and to a certain extent on C++ since my college days(2003), but I never had the opportunity to work with a hard core programming responsibility, which could have taught me "industrial grade coding" better and what is needed really for solving real life problems. To me it looks like I had been coding naive codes, like linked lists, binary trees, and Dijkstra and Kruskal's Algos all these years. Additionally I feel my academic experience just taught me the language not how to solve real life problems. So my question is:   * So how did you pick up the art of solving real life problems?   * Any way to shortcut the process?   * Is it only my education or in general everyone coding education sucked big time?   * How often do you have to learn "new things" to solve a problem in a better way.  For example, though I have used delegates and events for simple windows programming, but my current problem will require a much more in depth knowledge of it, plus I have forgotten most of it. So its as good as new for me. I will have to learn threaded programming and multicore programming. So it gives me an impression-"heck then what did I learn really all these years?"


Is it a "pattern smell" to put getters like "FullName" or "FormattedPhoneNumber" in your model?

I'm working on an ASP.NET MVC app, and I've been getting into the habit of putting what seem like helpful and convenient getters into my model/entity classes. For example:               public class Member     {         public int Id { get; set; }         public string FirstName { get; set; }         public string LastName { get; set; }         public string PhoneNumber { get; set; }              public string FullName         {             get { return FirstName + " " + LastName; }         }              public string FormattedPhoneNumber         {             get { return "(" + PhoneNumber.Substring(0, 3) + ") " + PhoneNumber.Substring(3, 3) + "-" + PhoneNumber.Substring(6); }         }     }      I'm wondering people think about the `FullName` and `FormattedPhoneNumber` getters. They make it very easy to create standardized data formats throughout the app, and they seem to save a lot of repeated code, but it could definitely be argued that data format is something that should be handled in mapping from model to view-model. In fact, I was originally applying these data formats in my service layer where I do my mapping, but it was becoming a burden to constantly have to write formatters then apply them in many different places. E.g., I use "Full Name" in most views, and having to type something like `model.FullName = MappingUtilities.GetFullName(entity.FirstName, entity.LastName);` all over the place seemed a lot less elegant than just typing `model.FullName = entity.FullName` (or, if you use something like AutoMapper, potentially not typing anything at all). So, where do you draw the line when it comes to data formatting. Is it "okay" to do data formatting in your model or is that a "pattern smell"? Note: I definitely do not have any html in my model. I use html helpers for that. I'm strictly talking about formatting or combining data (and especially data that is frequently used).


Is it poor practice to name a property/member the same as the declaring type in C#?

For instance, a class like:               class Dog { } //never mind that there's nothing in it...      and then a property like:               Dog Dog { get; set; }      I've been told that if I can't come up with a more imaginative name for it, then I must use:               Dog DogObject { get; set; }      Any thoughts on how to name these better?


How to bootstrap a FOSS social software project beyond 1 dog eating dog food?

The development target is a facility that provides a particular kind of structural support to open, public discussions. Each separate deployment of the facility is specific to a single topic of discussion. This is important to know, because the plan is to bootstrap the development of the facility by deploying it on the topic of the facility itself; so the developers will be eating their own dog food. The problem is, how should a lone developer go about attracting others to the food bowl? The only answers I have so far (and neither seems good enough) are:   1. Continually ask in public forums for advice on the development problems that arise, such as design or implementation bugs. Maybe someone will jump in and help. (But this is a little bit sneaky and spam-like; and I apologize because I'm doing this right now.)   2. Continually share information in private with experts such as social scientists; specifically new information that happens to cross their paths of expertise. Maybe they'll reciprocate or reply in some other helpful way. (But this seems too slow on its own.) What other strategies are there? * * * I'll post a link to the project later, in case anyone is interested. Some other things you might need to know in the meantime:   * The utility is novel and unique; no other facility serves the same purpose.   * Both the utility and the user base are comparable to web search. Picture a discussion search engine, but more useful.   * There might be commercial potential, but it might also be largely wiped out by a successful, non-commercial, FOSS launch. Please assume the second case.   * A fully functional prototype is already deployed on the topic of the facility itself (as planned) and is open for anyone to use. It was assembled from off-shelf components. No code was written to make it functional, but code will certainly be needed to improve it.   * The facility is viable with only one or two participants, but nothing to write home about. Its utility and attractiveness increase rapidly with scale. It works partly by crowdsourcing and partly by self-organization and self-governance.


What is this (anti?)pattern called? (or how to describe it)

The case where a source-level operator actually describes an operation to take place at some future point, thunking the real operator together with its operands. I don't know if this has any kind of general name, or perhaps it's too low- level a design element to be thought of as a "pattern" at all, but anyway it's an element that is frequently seen in a number of situations:   * If I understand correctly (not a frequent C++ user), Boost::Phoenix does this to represent its lambdas and lazy operations, e.g. overloading + to actually capture the arguments along with the real + function for their type   * Parser combinators in functional languages (or something like Spirit) look like operators on data, but actually build a parser that runs later   * Other EDSLs (in languages with operator overloading) seem to do this a lot, e.g. functional reactive programming libraries tend to invisibly build procedures that will do what the operation looks like it's doing right now   * (Again, if I understand correctly) IO in Haskell builds an imperative computation out of pure components that is then "executed" by dark magic hidden in the language runtime, while looking like it's just executing the functions in-place   * At a simpler level, Greenspunning an embedded mini-Lisp into a C program could be considered the same thing: S-expressions can be built out of calls to C functions, to be run later (this last one would probably usually be considered the antipattern case), letting you look like you're passing "a lambda" to a C function, when you're really passing interpreter data It's obviously not an antipattern in all cases, as in some of those it's the only way to use the tool in question (doing it in C might earn one a beating though). I don't think it's "Greenspunning" or "using an EDSL" by itself, as it can be more generic and widely applicable than that. I don't think it's the Interpreter pattern, although I may not have correctly understood that one: the computation is being built directly by executing host language code (so it effectively exists at compile-time, but usually not as a first-class language construct), rather than parsed out of a string or other runtime loaded data. In all cases, what seems to happen is that an operation looks like it's doing one thing (not necessarily very convincingly, if it's C and you need to write out Add instead of overloading +, but same idea), while actually packaging that action up for later consumption. Something like a "computation builder" pattern? But I haven't found that term in use. I don't have a practical problem to solve here; it's just bugging me that there seems to be a common design element that I can't put a name to. (Question originally posted at StackOverflow, moved by hand)


Is it possible to escape the GPL by deriving the same work from multiple sources?

Suppose you have an arbitrary code base, **C** , possibly composed of multiple programs, none of which fall under a copyleft license. Suppose this code, taken together, does the same job as a nice integrated program, **A** licensed under some copyleft license like the GPL, but that for whatever reason the GPL code is superior (faster, cleaner, less buggy, whatever). Now suppose that for each feature in **C** , you find the equivalent feature in **A** and, through careful step-by-step refactoring, create two chains of patches that converge on a third program, **B**. In other words, you can show step by step, via patches, how to derive any of the three programs from any of the others:               A <--> B <--> C      It seems that through this procedure, you have extracted value from **A** and even created a derived work, but the new work doesn't necessarily resemble **A** , and there is a clear chain of evidence showing that **B** was derived from a different code base entirely. My question is: **Would a " _dialectic_ " implementation like this provide the same legal effect as a traditional "clean room" implementation?** _Note: feel free to replace the licenses of A and C with your most and least favorite options, respectively. The question is about the process in general._


Given that I voluntarily choose not to implement virtual memory in my kernel, how would the memory-management-unit work?

For my basic kernel I refuse to implement the dreaded confusion of virtual memory scheming, so I want only real memory addresses for everything. Some people have argued with me that since virtual memory is hardware supported, and sometimes the MMU hardware is integrated with the CPU, is that a rule that virtual memory is mandatory by hardware-design? I have at least one good reason to not care about virtual memory at this point, being that the real memory I have is plenty (32 GB), and that I don't care to go through trouble and workarounds with virtual addressing and such(and that I honestly don't like the idea, regardless of the fact that it helps in many areas). So if my question wasn't clear, is it possible to write a dedicated kernel and not _at all_ implement virtual memory and use only real addresses for everything, with a MMU? (Some of these low-level programming and hardware-concepts are mind-boggling, even after hours and hours of studying and implementing). PS: I'm guessing the answer to some point is "yes", but hearing someone with more knowledge on the subject would definitely be a good pointer for me and others who read this.


How to solve binary labeling with graph cut?

Many literature references suggest that the _binary labeling problem_ can be converted into a graph cut problem and solved with the max flow/min cut algorithm. I'm trying to understand the formulation given in Xiaowei Zhou's presentation of the reduction. The binary labeling problem consists of partitioning `n` items (here segments of the overlapped regions of two images) into two disjoint sets in a way which minimises an energy function. We can denote the partition as a vector `(x_1, ..., x_n)` whose elements are `0` or `1`; we also have per-item fitness functions `D_i`; and we define a per-item-pair transition function `V_{i,j}` which penalises discontinuities. Then the energy function is given by               E(x_1, ..., x_n) = SUM_p D_p(x_p) + SUM_{p,q} V_{p,q}(x_p, x_q)      In my particular case I have 32 segments, so there are 2^32 possible vectors to evaluate. I could evaluate `E` for each combination, performing 2^32 evaluations, and so get the minimum energy and the combination which achieves it. This is what my intuition suggests. But this is impractical, because the complexity is exponential. Therefore I want to use the graph cut approach, but I don't understand how to formulate the graph. The 32 segments are the nodes of the graph, but what would be the weight of the edges? And what would be the capacity?


Existing buggy code or a brand new one? (From time perspective)

I am facing some issues with a buggy library I currently have and it's used in my current project, I need to finish this project as soon as possible in order to deliver it to our client. However, this library is horrible! Lots of bugs, lots of errors and bad performance, I thought to write my own library to handle what that library handles (GUI/Graphics and some Data manipulation) but I lack time to do it. I have wasted a lot of time repairing this library thus I am very close to my deadline with 85% completion and still lots of bugs I face and fix everyday. Maybe you will ask me the following question: > Why did you use it in the first place if you knew it was buggy? I will answer that question, the reason why is because the buggy library is considered a standard in out company; plus, I am not the only one who thinks that library is buggy, almost all developers hates it! My question is, should I deliver the current project with that library then develop a new library and use it to enhance the project after that deliver it to the client again as an update, or develop the new library and restart the whole project using the new one? and why?


Good principles to explain the use of data objects

I'm in a little need of names clarification. First a brief description of my position. I prepare as debutant giving a junior developer job descriptions, which also provided another perspective on how important communication is, and to put it beyond doubt. Simply; I like to understand what he mean with "Context" and I like to give a adopted description of what a POCO is. Now, this is not the exactly problematic words. We haven't even spoken yet. I describe it more as the semantic problem and focus on data and IoC, because there is the place we're going to met (He = GUI, I'm BL). I give a manual-typed sample just as a reference for naming different part of it. Some terms are local to a Manufacturer or tool and some are used more Generic, which I prefer the latter.               // Poco, Model?     public class Customer     {         public int CustomerId { get; set; }         public string Name { get; set; }     }               // A short sign of repository pattern     public class CustomerContext     {             // Is this a context or even a entity?         List<Customer> cust;        public CustomerContext()        {           cust = new List<Customer>();           cust.Add(new Customer() { CustomerId = 1, Name = "Doe" });           cust.Add(new Customer() { CustomerId = 2, Name = "John" });           cust.Add(new Customer() { CustomerId = 3, Name = "Zelda" });           cust.Add(new Customer() { CustomerId = 4, Name = "Kim" });        }             public IQueryable<Customer> Get()        {           return cust;        }     }      * _What terms fit best? *_ Are 'Customer' a Model (tooked from MVC)? Does we, simply put, mean the same with POCO? What do I call the sample typed data above? Mocks? Simply "Data"? What do I call the object CustomerContext? A repository? A Context? Is it an Entity? Are there other terms that have escaped this scope? It appears common to write about repositories and generics, even though fell into a scope of a manufacturer (where i.e. 'Entity' commonly means Entity Framework). A strong indication of what terms means what (and when), would be of help.


HTTP Request & Response Parameters

1. How are request parameters stored and arranged for a post request if it's not json or xml?   2. Is it possible to send response parameters back in the same way?


Should I use expect or should when writing RSpec specs?

Please can someone explain to me how I should go about deciding whether to use expect or should syntax for my rspec examples. From my understanding we should no longer be using the 'should' syntax. The replacement is to use expect().to or is_expected.to Is this correct? On some really good references, it seems to be common practice to still use should. And these references are being updated consistently. Any help in the correct direction would be appreciated. References (+ others, but excluded)   https://github.com/thoughtbot/shoulda-matchers   https://www.railstutorial.org/book


ASP.NET deployment/maintenance best practices

I have been in the web development industry for around 5 years now, always working in an open source environment. Mostly apache, mysql, and php with a little bit of ruby, using git for version control. But recently took up a job where development is entirely C# ASP.NET MVC. While I was able to pick up the language etc fairly easily, the other members of my team (with a lot more MS Development experience than me) all have a different way of thinking when it comes to publishing and deployment of the final site, and particularly future changes. The mentality with the other developers is that once a site has been published it is final. No more changes can be made to the site, when I have asked the reasons behind this, the answers have been it is too dangerous, time consuming or difficult. From my past experience, updating a site is simply a case of uploading the changed files, which is usually quite quick if it was a little change, or putting the site in maintenance mode while the update occurs. We recently published an MVC Site, and the business contacted us to update some of the text and add a link to a new pdf document. The rest of my team were quick to say that this should not be done because the site is now live and should not be modified. Is there something I have missed by not being 'brought up' a Microsoft developer? What are the argument against making modifications to a live web application in production and is this mindset unique to .NET developers? I genuinely would like to understand this mindset and whether it is justified in a Microsoft development environment, or if this is just an older way of thinking. _NOTE: We use TFS for version control and use publish profiles to determine where the site gets deployed (UAT or Production)_


Building a template engine - starting point

We're building a Django-based project with a template/generator component. This component will be separate from the project as such and can be Django/Python, Node, Java or whatever works. The idea is to generate questions based on a pattern. For eg., I would want to generate questions like "What is 2 + 3", "What is 5 + 8" based on the pattern "What is X + Y ; where X,Y < 10". In this sense, it's like a template engine. The templates will contain references to objects with properties that are defined in the DB, say, a Bus. For eg, it could be something like > [object type="vehicle" weight="heavy"] and it would have to pull a random object from the DB fulfilling the criteria : type="vehicle" weight="heavy" (bus/truck/jet) and then substitute that tag with an image, say, of a Bus. Also it would have to be able to handle some processing. Eg: > What is [X type="integer" lte="10"] + [Y type="integer" lte="10"] > > [option X+Y correct_ans="true"] > > [option X-Y correct_ans="false"] > > [option X+y+1 correct_ans="false"] The engine would be expected to fill in a random integer value <= 10 for X and Y and show radioboxes for each of the options. Would also have to store the fact that the first option is the correct answer. Does it to make sense to write something from the scratch? Or is it better to use an existing templating system (like Django's own templating system) as a starting point? Any suggestions on how I can approach this? edit : Clarification of use case


Leading an offshore team

I'm in a position where I am leading two teams of 4. Both teams are located in India. I am on the west coast of the U.S. I'm finding leading remote teams challenging: First, their command of the English language is weak. Second, I'm having difficultly understanding them through their accents. Third is timing, we are 12 hours apart. We use Skype to communicate. I have a month to get the project done. We've burned through a week just setting up the environments. At this point I'm considering working their hours, 11p PDT to 7a PDT, to get them up to speed, so that I can get the project off the ground. A 12 hour lag time is too much. I'm looking for steps I can take to be successful at leading an offshore team. **Update** The offshore team's primary task is coding, of course, most coding tasks do involve some design work. The offshore team's are composed of one lead, 2 mid level (4 to 5 years) developers and a junior (~2 years) developer. The project is classic waterfall. We've handed the offshore team a business and a technical design document. We are trying to manage the offshore in an agile way. We have daily conference calls with them and I'm requiring the teams to send me a daily scrum in the form of an email answering the following questions:   1. What did I do today?   2. What am I going to do tomorrow?   3. What do I need from Chuck so I can do my job tomorrow? There is some ambiguity in the tasks. The intent was to give them enough direction for them to develop the task with out writing the code for them. I don't have a travel budget. I am using Fogbugz to track the tasks. Each task has been entered into Fogbugz and given a priority. Each team member has access to FogBugz and can choose what task they wish to complete. _Related question_ : What can we do to improve the way outsourcing/offshoring works? **Update 2** I've decided that I can not talk to the team once a day. I must work with them. Starting tonight I've started working the same hours they are. This makes me available to them when they have questions. It also allows me to gain their trust and respect. **Update 3** The project was completed and delivered on time. The key factor was me working the same time as the offshore team. If that had not occurred I'm confident we would have failed. I managed two offshore teams. One of the teams under preformed and I fired them taking on the work myself. Things that lead to success was: Communication, understand their culture and how they communicate. Build rapport with them. A couple of the workers I keep in touch a year after the project completed. Meetings, we met at the beginning of their day so any questions or blocked tasks could be addressed. At the end of the day a daily summary was send out by the worker describing their day and if they encountered any issues. Ideally we could resolve their issues by the start of their next day. Questions, ask questions. Most cases information is not volunteered. Be visible. Being online, available and reachable help fostered the team's commitment to the project. I was not just the daily email. Make it easy. Internally we had a complex QA system in which bugs where tracked. It was complex and hard to use. I paid the $$ for a fogbugz account for each of the team members. Most of the team had used FogBugz and understood the workflow. Daily I would update the fogbugz with new bugs and update the QA system from Fogbugz. **Stackoverflow question** Leading an offshore team


What can we do to improve the way outsourcing/offshoring works?

These days one only gets to hear the anti-outsourcing argument citing failed projects, lost jobs, cultural differences, communication issues and so on. The success stories, cost savings, shared cultural experiences often get conveniently ignored. What can programmers from both sides of the globe do as a community to improve the way outsourcing works and to make it more meaningful and relevant? Please suggest constructive ideas/experiences rather than letting this be another opportunity for ranting.


What kind of metrics, if any, can be collected from requirements development?

We elicit requirements from our product stakeholders by creating and refining user stories in monthly sprint planning meetings. This includes defining use cases, acceptance criteria, and identifying constraints, and the final result is a sprint backlog of user stories. The high-level customer requirements are refined into lower-level product requirements through design reviews among the development team throughout the sprint. The design reviews result in UML diagrams, software interfaces, and, in general, a human language description of various software requirements. We are increasing our metric-awareness as an organization so that we can better identify potential areas of process improvement (and so that we can eventually be appraised at CMMI level 3). What kind of useful metrics are there to collect in the elicitation and refinement of customer requirements?


Standards of unit testing output

Simple question, what's more common / standard / won't make future developers look at me cross-eyed for unit testing: Displaying just the errors, or reporting every passed test?


How much functional programming expertise can programmers be expected to have?

I'm coding in a non-functional language with functional mechanisms (C# to be specific, but you could substitute, say C++ and use function pointers, or what have you) on a small team. It's my habit to use functional techniques -- passing delegates (objects representing functions) as arguments, using closures, occasional anonymous functions, etc -- and I try to document this better than I think a reasonable programmer would need them documented. Looking at code I see online and on Stack Exchange communities, I think my style is pretty normal among C# developers. Our team, however, isn't sophisticated in these techniques and I end up having to explain (and defend) myself -- my high level of documentation is actually used as evidence by them that I shouldn't code the way I do for the sake of readability. Now, given the make-up of my team, I understand that I might just give up the good fight here and code to their standards, understanding its better for the team. Does anyone have successful experience using empirical studies, accreditation criteria or best practices lists published by respectable sources that suggest that programmers today have more experience in these functional programming idioms, and that, therefore, we don't need to shy away from them for purposes of maintainability?


Big Data: Can it be pre-processed?

My question is about "big data". Basically, big data involves the analysis of a large amount of data to make meaningful insights from it. I would like to know: Whether or not large amounts of data can be pre-processed? (like say for example you are running some matching service for people, so you take all the information you have on the people and you process it at a certain point for use later on) **If pre-processing is possible, how would you normally go about doing this?** * * * To help narrow the scope of my question, please look at this hypothetical scenario. > Say I have a customer database and my company is a global retailer that is > using some type of points system to reward the shoppers (for arguments sake, > the points are tallied up on a type of electronic card or mobile app). > > So based on my rewards system, I am now able to fully aware of exactly what > a shopper is purchasing and when they normally make purchases of recurring > items. > > My database is growing all the time with this information and I would now > like to make recommendations (or send notifications) to shoppers about > special offers of products they buy or related products that may interest > them, when they enter 1 of the stores. > > Instead of processing all the accumulated data when a shopper enters the > store, I would like to continually process the data-stream as the data comes > in (meaning from previous shopping experiences), so that when it comes time > to make a recommendation (for the next time a shopper walks into the store), > it is simply a matter of retrieving the recommendations and providing a list > of it to the shopper. > > With this method in mind, I can easily space out my CPU-intensive tasks, > instead of say: processing all customer data on a busy day when foot-traffic > is at peak volumes. By asking how I would do this, I would be referring to common methods available for achieving this. This can include any special databases or programming techniques or even specialized software that can carry out these timed calculations that can "pre-process" the data at specific times, in order to balance out CPU-intensive tasks. You can consider the customer-recommendation scenario as the "situation". It is the best example scenario I could think of that would explain why "pre- processing" (or calculating the recommendations at specific times) would make sense.


Can anyone point me to some examples / reading material that outline updating the dom automatically?

Basically I would like to know how apps such as hotmail receive emails in realtime, without making periodic checks on the server - I've sent an email to myself from outlook with hotmail open and saw this in the console a couple of seconds later - GET http://sn108w.snt108.mail.live.com/mail/messageshelper.mvc the contents of which is the html to update, but I'd like to know what listens for the get request which presumably fires some javascript to update the dom? My question isn't specific to hotmails methodolgy in fact far from it as they will be working on the .NET platform whereas my proficiencies (if you can call them that!) are in the LAMP stack but any reading material on the subject would be great, thanks!


How to write camel case for words like "phonenumber", "motorcycle", "wavelength", etc

I am having a problem in understanding how to apply camelCase syntax to some of my variable names. For example, how should I correctly write a word like "phonenumber" in camel case? Is it `phoneNumber` or `phonenumber`? Similarly with "username", is it `username` or `userName`? I think it doesn't look right with camel case like `motorCycle`, `passWord`, `sunDay`, `setUp` or `waveLength` since these are just one word each. I think that could be why it's called `hashMap` but also `hashtable` in camel case without the capital in the last case because hashtable is one word while hash map is two words. But if the motorcycle has a color then would it be `motorcycleColor` since a word is concatenated? Is that correct or should it be `phoneNUmber`, `waveLength`, `sunBlock` and even `sunDay` for the Sunday of the week? Why for instance is the method called `getISOCountries` while it says `HttpHeaders` e.g. it's not clear what becomes lowercase if we have a method like `String camelCaseString = dog.toCamelCase()` or `interface CamelCase`.


When does freelancing become a start-up?

In one of my previous question in this Q&A site, someone suggested me that freelancing is not for everyone. I gave a thought over it and came to a conclusion that it is correct. While it may be a choice of veterans and experts in their own fields in some countries, it is like a rescue boat option in few countries, where there is fierce competition. I am confused on when to use the term freelancing and when to use the term start-up. I may be a freelancer with my name on my business cards, whereas, I may be a freelancer with a one-man start-up, with my firm's name on my business card. I registered my start-up legally but still, it is a one-man show. It is a one- man company. Is it still freelancing? In that case, should I print my firm's name on business card or wait till I get a handful of hired employees? When does the label of freelancing get removed for someone who plans for a start-up?


What version control system is typically used in Java Enterprise development?

There are many vcs available. Which of them are typically used in JavaEE world?


What to do when coding begins to feel boring, like it is all just more of the same?

I started programming at the age of 6 on a Commodore 64. Now I'm 28, and I have to complete 4 courses from a first degree in Computer Science. I'm starting to get bored with writing code after all these years. I've taken a course in Computer Science in theoretical computer languages and 10 years of C system coding in network security field and I just don't get any stimulation from writing code. I can write code in C, C++, Python or whatever language you want, but I can't get excited about what I'm doing. I can't feel any challenge. I've written multi-threaded code, HTTPS MITM proxy and a WSGI application without the need of any specific algorithms skill. I feel that all this new stuff is all the same, with simpler (or more) abstractions or automation in it, but it all sounds the same to me. Over and over again. The computable language is all Turing computable, so coding is only a replication of a similar pattern in this subset of a partial function. In my everyday work I'm feeling bored even with searching for bugs, or doing benchmarks on code, or fixing the problem with the library X,Y,Z. I'm a very curious person. I always get stimulated by something. But I can't even when I look at great code. I feel more comfortable in how the things work. **Is it time to make an advance in my career? Or to get more challenging stuff in Computer Science? Maybe get a major degree in CS?** I've started to read my first book on project management "Peopleware" and I'm getting more interested in the software development lifecycle. What do you suggest to do? Perhaps trying to get into Google or Microsoft or Apple like some friends of mine have done. Or perhaps a more managerial career path. I have also tried to find a good book about communication rules and "people personality" to prepare me for the possibility of getting into management. Any suggestions? P.S: I have a lot of interest, **i'm not depressed** :) i love mountain, trekking, take photo shoot and i'm a sport climber, i love to swim and sport in general, sometimes i do running, actually I'm reading book about my country (Italy) story from AC to today and i love trips (this summer i made 4000Km to see a lot of place in Spain and climb in it, all over in only 3 week, not a holiday but a marathon, 24 km of trekking made my hernia injury .. :)))) ), i love theater and life in general * * * Thanks to all, thinking about all the answer give to me the opportunity to make my path more clear. For a summary purpose we can generalize about the most voted up answer. First of all all the people vote-up the **necessity** to made our work a support of your life and not the only reason to stay in life (this is not my case), so, if you only reason of life if working you come fast to a really depressive situation. As peopleware say, Vienna don't waiting for you :) After this reminder people suggest to:     * increase technical complexity I'm actually working on to increase challenge and get less bored about it.   * change the field of expertise to a non technical field trying to become a manager or make some carer advance in a non technical fields related to your work.   * change the field of expertise in another kind of technical challenge, are you a system programmer ? try to get less bored developing about application for human so you can feel more comfortable viewing people using your useful software   * make some advance in your computer science degree in your academic path For my purpose the right answer is to advance in computer science, for my feeling i think programming is not the only computer science way to get and i think i can feel better getting other path in computer science different from software engineering carer. Thanks to all.


What is it called when a website URL replaces WWW with something else, and what purpose does it serve?

What is it called when a website has another word in place of where `www` usually goes? For example, `images.google.com` vs `google.com/images`. I know the latter is a file on the server that the browser downloads, but what exactly is the purpose of the former? It would be helpful to know what this is called.


Pros and cons of an HTML/JavaScript only web app

I come from an ASP.NET forms background and have found server side coding very powerful in the past. More recently, however, I have been wanting to phase out the server side code of the front-end and replace it with pure HTML/JavaScript, which accesses the data through JSON webservices. I have no real experience in this, and so I would like to hear whether this is a tried and tested model. Also, what are the pitfalls surrounding it? I find ASP.NET user controls very useful, so I would like to keep the theory behind it by storing markup templates in separate HTML files on the server. These will be retrieved and used through jQuery AJAX and the jQuery HTML templates plugin respectively. Any input will be extremely appreciated. P.S. Sorry for the noob question, but is this type of Web architecture what is referred to as web-2.0 or am I completely off-track?


Could applications build by Xamarin be possibly banned by Apple for selling on app store?

Consider having restricted man resources and thinking about using Xamarin studio for building cross platform application. Will you be afraid of Apple trying to ban all applications NOT developed by xCode? I mean in future. It is obviously not banned now. I am just asking this because I heard this on a meeting today as argument of not using Xamarin studio. I am not an expert in this area but very curious because it sounds odd. The application should be banned because of some kind of generated code which is always there when building app using Xamarin.


Egoless programming, is it possible or even desirable

After reading this question; Why are so many programmers arrogant It does bring a related question to my mind. Is it possible to have egoless programming or is it even desirable? As a profession we do seem to want to show off the latest gizmo, technique or say “look at this awesome piece of code I’ve written”. Yet we can get very defensive when asked to submit items of work for code reviews or get negative comments from other programmers (hearing the term WTF, has never been a good sign). Can we as a profession be able to sit down and analyse a piece of code, data or architecture for its merits or constraints and a calm and respetful manner, without causing offence or antagonising our colleagues, or are we just the archetypal Dilbert character, raging against the system?


Number Game Algorithm

Problem Link - http://www.iarcs.org.in/inoi/2011/zco2011/zco2011-1b.php The task is to find the maximum score you can get in the game. Such problems, based on games, where you have to simulate, predict the result, or obtain the maximum possible score always seem to puzzle me. I can do it with recursion by considering two cases - first number picked or last number picked, each of which again branches into two states similarly, and so on... which finally can yield the max possible result. But it's a very time-inefficient approach, since time increases exponentially, due to the large test cases. What is the most pragmatic approach to the problem, and to such problems in general?


Consultant in a firm that doesn't understand the tech!

I got the job as a Consultant in a firm that has 3 other programmers. My job is to rewrite all the old system in Java, Spring etc but the staff programmers only know perl and the manager does not know any programming. I am trying to get them to understand that I have 6 projects to rewrite here but no one has design docs or spec. the staff programmers never had to write any documents. Plus I cant get the manager to understand the new java tech stuff.. he keeps asking some of the staff for views on things but the staff don't know it or understand it. Where do I go from here to make the manager understand that the staff programmers or someone has to write a design document so I know what to build. or if I have to write the documents how do I get the information?


Examples of when we'll use interpreted language over compiled language?

I understand the differences between interpreted and compiled languages, but if someone could provide some examples of situations when one is likely to use interpreted languages over compiled languages, as well as situations when one is likely to use compiled languages over interpreted languages, it'd be really helpful.


How to effectively put code live

What are the general strategies to employ when attempting to ensure that a module of code will function correctly on the live system? A common problem we have at our software house is that we typically deploy solutions to a remote client's server, which hasn't got any software-development-related software installed on it. When problems (inevitably) arise in the deployed software, we get annoyed clients telling us to fix the issue, but since we can't remotely debug the code, we get locked into a cycle of effectively having to guess whether our code will work before we deploy it, and then repeating the cycle when the deployed code has issues. Furthermore, due to the remoteness of the client, it's typically not possible to get a full working test copy of their system set up on our end, so we end up developing against approximations of their system on our end. This makes our debugging and code planning on the development side significantly less effective, because when we deploy we don't know precisely what variable between our test system and the live system is causing problems with our code. So far, I've implemented a basic error logger in all deployed code that captures the stack trace, exception details, method, class, namespace, parameters and additional messages and error codes at each exception, but this really just speeds up the process of fixing that specific error. I've also tried writing individual tests for specific subsections of modules as executables and running them on the client system, but for modules that are tens of thousands of lines long, this usually just isn't feasible without grinding all development to a halt. I'm trying to get a strategy in place which would help us better avoid the exceptions in the first place, but I'm stuck on the fact that:   * We don't have (and typically can't get) a working test system that accurately models the live system, e.g. an image of the live system, if we do have it then it's months out of date   * We can't install remote debugging software on the live server   * The client typically has no dedicated test server, so any deployments have to go straight to live   * Having no access to a copy of the live system means that we can't write effective unit tests which actually model the conditions the code will run under on the client side If it helps, the code is typically C# running under .NET 3.5. How to better tackle this issue?


Dealing with coworkers when developing, need advice

I developed our current project architecture and started developing it on my own _(reaching something like,`revision 40`)_. We're developing a simple subway routing framework and my design seemed to be done extremely well - _several main models, corresponding views, main logic and data structures were modeled "as they should be" and fully separated from rendering, algorithmic part was also implemented apart from the main models and had a minor number of intersection points._ I would call that design scalable, customizable, easy-to-implement, interacting mostly based on the "black box interaction" and, well, very nice. **Now, what was done:**   * I started some implementations of the corresponding interfaces, ported some convenient libraries and wrote implementation stubs for some application parts.   * I had the document describing coding style and examples of that coding style usage (my own written code).   * I forced the usage of more or less modern `C++` development techniques, including `no-delete` code (wrapped via smart pointers) and etc.   * I documented the purpose of concrete interface implementations and how they should be used.   * Unit tests _(mostly, integration tests, because there wasn't a lot of "actual" code)_ and a set of mocks for all the core abstractions.  * * * _**I was absent for 12 days**._ * * * **What do we have now (the project was developed by 4 other members of the team):**   * 3 different coding styles all over the project _(I guess, two of them agreed to use the same style :)_ , same applies to the naming of our abstractions _(e.g`CommonPathData.h`, `SubwaySchemeStructures.h`)_, which are basically headers declaring some data structures.   * Absolute lack of documentation for the recently implemented parts.   * What I could recently call a `single-purpose-abstraction` now handles at least 2 different types of events, has tight coupling with other parts and so on.   * Half of the used interfaces now contain member variables `(sic!)`.   * Raw pointer usage almost everywhere.   * Unit tests disabled, because "`(Rev.57) They are unnecessary for this project`".   * ... _(that's probably not everything)_. Commit history shows that my design was interpreted as an overkill and people started combining it with personal bicycles and reimplemented wheels and then had problems **integrating** code chunks. Now - the project still does only a small amount of what it has to do, we have severe integration problems, I assume some memory leaks. * * * **Is there anything possible to do in this case?** I do realize that all my efforts didn't have any benefit, but the deadline is pretty soon and we have to do something. **Did someone have a similar situation?** Basically I thought that a good (well, I did everything that I could) start for the project would probably lead to something nice, however, I understand that I'm wrong. Any advice would be appreciated, sorry for my bad english.


Where should I store my user session data?

Should I store only the user's session id along with the data in a table, or should I store the user's session id in a table and access an array of data from the user's session id? and why? What is more efficient? I will not be generating any reports.


Where are all the functional programming design patterns?

OO programming literature is full of design patterns. Most books on object oriented programming dedicate a chapter or two to design patterns like factories and decorators. So what are the equivalent patterns in functional languages and why hasn't anyone written a book about them yet? Is there something special about functional languages that obviates the need for design patterns?


Where can I find accessible bug/issue databases with complete revision history

I'm performing some research and analysis on bug/issue tracking databases and more specifically on how programmers and teams of programmers actually interact with them. What I'm looking for involves understanding how those databases change over time. So what I **don't** need for example: is a database of all the bugs of some open source project as the bugs exist today. What I do need is a complete set of revision history for every issue/bug in the database. This would enable me to pick a specific datetime and say here were the list of all the issues/bugs that existed at that moment in time. Anyway know of some publicly accessible issue/bug databases that expose this revision data? Ideally, the revision would look something like this (shown for a single bug, with two revisions)                ISSUEID  PRI  SEV  ASSIGNEDTO  MODIFIEDON      VALIDUNTIL      1        2    2    mel         apr-1-2010:5pm  apr-1-2010:6pm      1        2    3    steve       apr-1-2010:6pm  NULL


Layering buttons when a number needs to be pressed more than once during an equation?

I am very new to HTML5 (and web coding in general), and I am trying to create an interactive calculator. I will try to explain this as clearly as I can. The basic idea is that the user will use pre-set equations to add numbers with the calculator. All of the buttons on the calculator will have an animated 'push down' effect, but the buttons that need to be pressed to perform the equation will light up one at a time after each successive button is pressed. I'm getting stuck developing this when a number needs to be pressed more than once during an equation... i.e. 257+6732. - notice that the # 7 is used twice. Here are my two ideas (both have failed):   1. In this example the #7 button would need to preform two functions (1st. light up the 'plus' button on the first click, and 2nd. light with the "three' button on the second click). I know that coding the button to perform two functions this way is possible, however, the button can ONLY be active at correct points in equation. During the remainder of the equation clicking the #7 button will not preform any function, and will only give an animated push down effect.  OR   1. The #7 button could be duplicated and on the first click the top button disappears. The 2nd #7 button would then stay hidden until the appropriate time during the equation. Again, the #7 button would have a grayed out appearance and only give an animated push down effect while the button is not in use. Can anyone shed some light on this for me? I'm pulling my hair out over this. The entire design is complete and things look fantastic, but the value of this project is adding up to a POS until I can work out the coding.


User story does not fit in a sprint

> **Possible Duplicate:**   >  Scrum: how to handle backlog-items that are longer than one sprint I have a project with complex user stories which take way longer to implement than spring length. For example: user story sounds like this : > "User is able to receive a report at 10:00 am daily" But behind the scenes, it requires around 2.5 month of development so it does not fit in our two weeks sprints. Could you share the best practices for this case?


Structuring Visual Studio folders

If I'm doing a website, I end up with folders like "Controllers, Views, Models, Extensions, and Helpers". If I'm doing a DLL library I end up with folders reflecting the namespaces of my classes. If I write a desktop app, I end up with "Presentation and models" where models is subdivided further by namespaces. My question is, where is a common place to put classes that aren't necessarily part of your logic or model? For instance, if I find some code to convert XML to some arbitrary format, I usually put it in a static class and drop it in a folder called utilities. That's easy, but when I get into something that borders on domain logic that converts from XML into a domain specific language, where do I draw the line? That's a pretty specific case, but I run into tons of these where I'm torn on putting it in the Utilities folder, the helpers folder etc. **These are all folders I use, but hopefully the concept is clear, I just don't know how to organize my code when it isn't clear domain logic.**


What are the drawbacks when designing a class?

When I read the book Effective Java chapter 4, I met some sentences but I can't think them out :   1. What is the implementation when designing a class , why subclass will rely on the implementation detail of superclass?   2. Why will inheritance break encapsulation?


How does unit testing work?

I am trying to make my code more robust and I have been reading about unit testing, but I find it very hard to find an actual useful use. For instance, the Wikipedia example:               public class TestAdder {         public void testSum() {             Adder adder = new AdderImpl();             assert(adder.add(1, 1) == 2);             assert(adder.add(1, 2) == 3);             assert(adder.add(2, 2) == 4);             assert(adder.add(0, 0) == 0);             assert(adder.add(-1, -2) == -3);             assert(adder.add(-1, 1) == 0);             assert(adder.add(1234, 988) == 2222);         }     }      I feel that this test is totally useless, because you are required to manually compute the wanted result and test it, I feel like a better unit test here would be               assert(adder.add(a, b) == (a+b));      but then this is just coding the function itself in the test. Can someone provide me with an example where unit testing is actually useful? FYI I am currently coding mostly "procedural" functions that take ~10 booleans and a few ints and give me an int result based on this, I feel like the only unit testing I could do would be to simply re-code the algorithm in the test. edit: I should also have precised this is while porting (possibly badly designed) ruby code (that I didn't make)


PHP passing parameters to a function

I want to pass a parameter to a function as below for clarity. It doesn't give any error. But is this a bad practice. Do I have to avoid this.               test('','','',$d='text','');          function test($a, $b, $c, $d, $e){          }


"Half of everything you know will be obsolete in 18-24 months" = ( True, or False? )

Just ran across this, and wondering if anyone has a way to prove or disprove this statement: > Something to keep in mind ... what's the half-life of knowledge in high > tech? It tracks with Moore's Law: half of everything you know will be > obsolete in 18-24 months. **SOURCE:** Within answer by **Craig Trader** to this question " **What is the single most effective thing you did to improve your programming skills?** "


Research paper on distributed computing - Advice?

I am writing my first research paper on distributed storage systems. We also have a prototype working (partially). The project was a complete implementation based project where we envisage to take this project a step further and do some future development. So, my questions are:   1\. How should I go about creating the "skeleton" or the outline of the paper? Any pointers.   2\. I understand, benchmarks and some working stats of the systems is important, but what is the breakup? How much content should be dedicated to theoretical algorithms (which we implemented, did not create new ones) and the benchmark data.   3\. What format (IEEE, ACM etc) should I select and why? PS: The project does not really concentrates on creating something new and unique, but it's aim to create an app which can be used by students and researchers to help understand the field of study better. Performance is not an objective for us, since there are alot of open source implementation (production quality) of the same domain. Think of Kaffe for JVM, that's what we are building for distributed storage systems.


Separately tracking software failures and faults

I've recently finished reading a couple of Gerald Weinberg books on Quality Software Management. In them, he strongly recommends that organizations distinguish between software **failures** (which we would call bugs) and software **faults** , i.e. coding errors. He also recommends than an organization keeps separately track of failures and faults, linking one or more of the former to one of the latter. The specific terms he uses are **System Trouble Incident** for a failure report, and **System Fault Analysis** for the work that leads to the discovery of a fault. I've searched for any further references to these terms on the internet but didn't find anything. Does anyone work in an organization where failures and faults are recorded separately? And if yes, are there any tools out there that will let you do this seamlessly, and let you link failures to faults? Is it worth the trouble?


Fastest way to set up a JSON server on my local machine

I am a front-end developer. For many experiements I do I need to have a server that talks JSON with my client side app. Normally that server is a simple server that response to my POSTs and GETs. For example I need to setup a server that saves, modifies and read data from a "library" database like this:   * `POST /books` create a book   * `GET /book/:id` gets a book and so on... What is the fastest to set up and easiest technology stack for database and server in this case? I am open to use Ruby, Nodejs and anything that do the job fast and easy. Is there any framework (on any language) that do stuff like this for me?


Using submitted code in a commercial product

I have made a product which I have used the GPL licence, and am now getting pull requests from other authors. The product also has a less restrictive commercial license available for purchase. Can I include the submitted code with the commercial licensed product?


My UML class diagram is too complicated, what should I do?

Classes have 10-20 links with one another and you can't see anything in that mess of a diagram Unfortunately we finished coding already and if we change the class diagram we have to redo the whole thing


Why the loops are avoided in Kruskal's algorithm?

I read Kruskal's algorithm as it's presented on Wikipedia. There, it says that it's an algorithm in graph theory that finds a minimum spanning tree for a connected weighted graph. But while going through the examples that illustrate this algorithm I am unable to understand why the _loops are avoided_ by marking some of the edges in red. What is the reason for this?