Does using Creative Commons No-Derivatives license conflict with GitHub terms?

When a software project wants to use Creative Commons Attribution- NonCommercial-NoDerivs 3.0 Unported License that denies making derivatives, does it conflict GitHub terms of service clause F.1 that says: > By setting your repositories to be viewed publicly, you agree to allow > others to view and fork your repositories. Eg. is forking (allowed by GitHub) the same as making derivatives (denied by CC). A fork has an owner, has its own download links, has separate history from the original repo etc. and any other feature you might expect from a "derivative". I know that using CC for a software project is not the brightest idea but some are still doing this and I wonder if it is even allowed by the GitHub terms. IANAL is OK, I just want to see some opinions about it


Why is cleverness considered harmful in programming by some people?

I've noticed a lot of questions lately relating to different abstraction techniques, and answers saying basically that the techniques in question are "too clever." I would think that part of our jobs as programmers is to determine the best solutions to the problems we are given to solve, and cleverness is helpful in doing that. So my question is: are the people who think certain abstraction techniques are too clever opposed to cleverness _per se_ , or is there some other reason for the objection? EDIT: This parser combinator is an example of what I would consider to be clever code. I downloaded this and looked it over for about half an hour. Then I stepped through the macro expansion on paper and saw the light. Now that I understand it, it seems much more elegant than the Haskell parser combinator.


Should I pass array or pointer?

I am writing a C++ library (but prefer C style interface functions) and one of the function returns array of floats. I am not sure if I should pass pointer or fixed array to get this data?               // in the library header file     #define MAX_ITEMS_SIZE   1000          int getData(float * data, int &size );      or               int getData(float (&data)[MAX_ITEMS_SIZE], int & size )      If I am passing the pointer, the client should allocate MAX_ITEMS_SIZE for it. Is that a reasonable and fair expectations? Passing it as array forces the client to pass the max memory required. Which one is better? Some more background, the MAX_ITEMS_SIZE is the maximum number of floats that can be returned. In reality the array will contain less items which is filled in the size parameter. The function returns int which is error code where zero means no error. My overall goal is how to return the data which is array of floats in easy to understand and reliable way. Even though I am using C++, I would like to stick with C interface functions so the library can be used more widely.


How to provide a ubiquitous object without including it in every parameter list

I'm writing a small C++ class, **Block** , to transform serialized data into a memory structure, and supply the structured data to callers through several accessor methods. I've tried to keep its scope specific and limited. The users of the class are very low-level - they, too, are very narrow in their focus and have as few external dependencies as possible. This is how I've been taught to engineer things if at all possible. By minimizing dependencies and creeping featurism, it's easier to unit test, and easier to reuse. The problem is that my class depends upon someone else's class, **Metadata**. It, too, does one very specific thing: it reads data that defines the characteristics of the data stream I'll be transforming from a database table and passes it to me. His class checks for mySQL errors, which should be rare, and logs any errors to a **Log** object. This **Log** object appears in all of our company's applications. Instantiating it is a big deal - it wants Job numbers, it wants a lot of configuration information from the database that's normally put there in production by account managers using a GUI. You have to do a lot of work before your program can instantiate the Log. Yet this tiny, low-level class ( **Metadata** ) with one tiny task wants it to be passed in, by me. My object certainly has no business instantiating the **Log** , so I have to take it as a parameter from whoever calls me. And so forth, up the calling hierarchy. I can understand why management wants a class to encapsulate and standardize message logging. But the need for it to be passed to, and through, just about every method is extremely ugly, and makes testing and reuse much more difficult. This kind of problem must be fairly common. How can this be done without cluttering up the signature of every method you write? Is this a legitimate case for Globals? Is there some kind of Object Oriented approach? And, is this a God object?


CSS Classes for semantics vs. styles in general cases

The W3C spec on the `class` attribute says > There are no additional restrictions on the tokens authors can use in the > class attribute, but authors are encouraged to use values that describe the > nature of the content, rather than values that describe the desired > presentation of the content. Reference I work on a massive website that has many disparate pages. We have a default stylesheet that is shared across practically all pages. I find it useful to have CSS rulesets such as these:               .center { text-align: center; }     .red { color: red; }      However, these classes do not semantically describe content. I'm sure you can understand that there are an enumerable number of cases where I need to center text or color it red, and each of these specific instances may have nothing to do with one another. For example, the class `warning` may be useful in one spot, but in another it may just be `aside`. I wouldn't necessarily want _all_ warnings to be red either. I realize that this is a hyper-technical question, but I do want the hyper- technical answer. Is there any correct way to reconcile having general style rules that express no semantics with the HTML spec? Is this a case for _shudder_ inline styles?


Should I continue using procedural php code or move to a framework

I haven't done any serious web development stuff since last year because of family/time issues. I need to get back into it because it's my career choice and I'll be finished with my associates degree soon. I decided to revamp a previous website I helped the owner build. After deciding what to change, I couldn't make up my mind if I should continue with writing procedural code or move to a framework. I know without a doubt I can do it with procedural code but I'm undecided between it. I guess I'm looking for a second opinion, what would you do if you were in a similar situation?


How to publish paid Android apps if you're not from US/UK

I was pretty excited while creating one of my apps but as it turns out you can't actually sign up for Google Checkout if you don't live either in the USA or in the UK. And since Google Checkout is the only way Android Market will pay you, all my efforts seem to be going in vain. So because I live in India, I can't sell my apps. I tried contacting Google by various means on this, but haven't got any response so far. I tried searching the web as well just to find out that one can't be paid via any other way. I am pretty sure that many people here might have gone through the same problem. How did you solve it? I have a PayPal account and an AdSense account as well. Can they help in any way? And if nothing works out, how am I supposed to be selling my app?


Abstracting out a module or using the Module Singleton directly?

I am working on a module which is dependent on other module for some functionality. Now the dependent module provides a lot of functionality and I need only few of them, hence got the idea to create an abstraction of the same in my module which is again be a singleton only. My question is when to abstract out and when to use the modules singleton class directly? Is there any guidelines for the same? Or its depend upon project to project?


Renaming long named method in C#

I'm working on a project where exist one method with title               string ValidateNewPasswordExpireCurrentPasswordAndCreateNewPassword(...)      I'm sure the method name must be changed. But can't found good and descriptive alternative. Also I can't separate method in multiple methods, like ValidateNewPassword(), ExpireCurrentPassword() and CreateNewPassword(). How can I rename the method and the same time to not lose self describing ability ?


Deploying v Releasing

So there's this desktop application. And I am wanting to inform it's users that a new version has been released. Is it more correct to say that a new version of a desktop application has been 'released' or 'deployed' (as with a web app)?


Release as open source after granting usage rights?

I have written software and have granted usage rights to different companies per contract. Is it possible to change the software licence to an open source licence afterwards? At what circumstances is this impossible and how will this affect the current contracts? Like one of the companies is allowed to modify and resale the software. If I change to GPL are they forced to change to GPL, too?


Does this justify goto statements?

I came across this question a second ago, and I'm pulling some of the material off of there: Is there a name for the 'break n' construct? This appears to be a needlessly complex way for people to have to instruct the program to break out of a double-nested for loop:               for (i = 0; i < 10; i++) {         bool broken = false;         for (j = 10; j > 0; j--) {             if (j == i) {                 broken = true;                 break;             }         }         if (broken)             break;     }      I know textbooks like to say goto statements are the devil, and I'm not fond of them at all myself, but does this justify an exception to the rule? I'm looking for answers that deal with n-nested for loops. **NOTE:** Whether you answer yes, no, or somewhere in between, completely close-minded answers are **not** welcome. Especially if the answer is no, then provide a good, legitimate reason why (which is not too far from Stack Exchange regulations anyway).


Transparently adding a database interface layer

I am currently looking for ways to optimize an application that is consuming unacceptable amounts of memory. The process basically takes input and parses it into a tree. The tree is currently stored in memory. For an average input, it may consume 100 MB to 2 GB of memory. For larger inputs, it may consume up to 6 GB, which is more than what most of our machines can handle if we wanted to test it locally. We are afraid there will be even larger inputs in the future, and so it's time to find a more scalable solution. Rather than storing everything in memory, I would like to move the tree, or parts of the tree, into external storage. Benchmarking the effects of not storing certain parts of the tree in memory has resulted in a 90% reduction in memory consumption. We have a framework (well, just our own library) that allows us to work with the tree using a set of standard getter and accessor methods. We use standardized methods for creating, reading, updating, and deleting nodes. Our parsers typically interact directly with nodes. For example, a sample method might say               // Takes some data and updates the tree with new data     private void managePerson(String id) {            // this returns a node with the given ID, or creates one if it doesn't exist yet       // and returns a reference to it       NodePerson node = getPerson(id)             // add or update some attributes       node.age.set(25)       node.name.set("John")            // add some points to the existing value       int points = node.points.get()       node.points.set(points + 5)     }      Given this information, I am thinking of using a database. However, I would also like to be able to implement the changes transparently so as not to affect a decade's worth of code that relies on the tree. What can I use that will allow me to get data out into a database while allowing developers to get a reference to an object (eg: a person node) and treat it like any other object without any knowledge of where and how the tree is stored internally? It would also be nice if the solution tried to optimize the amount of queries that are made. For example, instead of inserting 10000 person nodes one at a time, it would somehow figure out a way to batch insert it. This is meant to be temporary storage: once the parsing is complete, all of the data can be discarded as we are serializing the data in a file (again, based on practices that have been implemented years ago. This can be changed, but we don't have plans for that yet)


Recommended .NET / C# coding standards?

What coding standards do you think are important for .NET / C# projects? This could be anything from dealing with curly braces and spacing and pedantry like that. Or it could be more fundamental questions such as what namespaces in the .NET Framework to avoid, best practices with config files, etc. Try to avoid creating a post that is simply the corollary to another. For example, it would be fine to have one post focusing on curly braces. We don't need two to support one style vs. the other. The idea is not to vote for your pet standard, but rather to flesh out what should be thought about when creating standards.


Naming Convention for Private / Public Fields

I read the following on the MSDN: > Use Pascal casing for all public member, type, and namespace names > consisting of multiple words. > > Note that this rule does not apply to instance fields. For reasons that are > detailed in the Member Design Guidelines, you should not use public instance > fields. > > Use camel casing for parameter names. * * * Well it says it does not apply to instance fields so what applies to instance fields? I know I should not use them, but if I do, what is the correct convention? I guess it would be Pascal, but I'm not sure about it...


Developing a search algorithm

I want to create a basic search engine, and I want you to give me some ideas how to filter out the best results for my visitors. I have three fields regarding a product the user can search in:   1. Title   2. Category   3. Description I came up with these ideas and I ask you to either competently criticize them or add to them.   1. If the search term occurs in all three fields it should be among the first results.   2. If it is in two of the fields it is below the results of 1.   3. Combine the amount of occurences and output a value in per cent. For instance if in all fields together the term clock appeared 50 times and in all fields together there are 200 words, then the per cent value is 50/200*100 = 25%. Another product entry amounts to say 20% so product one having 25% is listed before product two having 20%.


Function calls to calls in windows api

I am a beginner programmer who is learning C. I find it hard to grasp the whole programming concept, thus I have questions. When programming in Windows, how does Windows communicate with the programs that run on it? A question I have been pondering about is how when you incorporate a function call which is in another memory location on the disk or memory (not a function you yourself wrote and is included in the compilation), especially the Windows API, does the compiler know where the function location is so when the program is run it can call that function? For example, a very simple program that displays a window which reads hello world. You would have to call Windows API functions to achieve such features as creating the window, its size, colors and so on... So basically what I am struggling to grasp is how the programs I write communicate with the platform, framework they are run on(generally windows for Windows API). Apart from clarification on this one above, I would love a resource that explains this concept further.


Moving from Winforms to WPF

I am a long time experienced **Windows Forms** developer, but now it's time to **move to WPF** because a new WPF project is comming soon to me and I have only a short lead time to prepare myself to learn WPF. What is the best way for a experienced Winforms devleoper? Can you give me some hints and recommendations to learn WPF in a very short time! Are there simple sample WPF solutions and short (video) **tutorials**? Which **books** do you recommend? Is www.windowsclient.net a good starting point? Are there alternatives to the official Microsoft site?


Learning graphical design as a developer

I'm mostly a developer and have been offered a job as webmaster. It's likely that I'll be asked to make some cosmetic changes to a website every now and then. Has anyone made this transition? If so, how did things go? Also, are there any good online sources to get up to speed on how things are done today?


Catching typos or other errors in web-based scripting languages

My background is mainly strongly typed languages (java, c++, c#). Having recently gotten back to a bit of javascript, I found it a bit annoying that if I misspell something by accident (for example I'll type 'myvar' instead of 'myVar') my entire script crashes. The browser itself most of the time doesn't even tell me I have an error, my program will just be blank, etc. Then I have to hunt down my code line by line and find the error which is very time consuming. In the languages I am used to the compiler lets me know if I made a typo. My question to you is, how do you overcome this issue in scripting (javascript)? Can you give me some tips? (this question is mainly aimed at people that have also come from a strongly typed language). Note: I mainly use the terminal/VIM ... this is mainly b/c I like terminal and I SSH alot too


How do I set up my "personal" library?

Through SO/P.SE browsing, I've been picking up useful pieces of Python code (e.g. a Mutable memoizer, an efficient prime generator) that I'd like to stick into one spot to have available should I need it in future projects. What are some best practices for how a "personal" code library of reusable classes/functions/modules should be set up? For example, do I just drop it all into one module? Or should I model it after the standard library, even though some modules may have 1 class/function in them?


Advantages of a left to right language syntax

I've been watching an interview with Herb Sutter on Channel9 and he mentioned at the end of the video that left to right language syntax would be on the top on his whishlist for a future C++ standard(although he acknowledges that modifying C++ in that way would pretty much make for a completely different beast). Apart from:   * more understandable by humans, clearer to the naked eye;e.g.              //C syntax          /*pointer to function taking a pointer to function(which takes 2 integers as           arguments and returns an int), and an int as arguments and returning an int*/          int (*fp)(int (*ff)(int x, int y), int b)          //Go analogous syntax which is left to write          f func(func(int,int) int, int) int        * easier to parse(leads to better tool support as mentioned in the video - e.g. code refactoring)  what other advantages are there with a "left to right" syntax in a programming language. I know only of Pascal and Go employing that kind of syntax(and Go does not even go the full way as I understand from this blog post from which I took also the examples) Would it be feasible to have a systems programming language with that kind of syntax?


Equidistant polygons

Consider these polygons: ![Consider these polygons](http://i.stack.imgur.com/jSeLV.png) For reasons of simplicity I only consider triangles or polygons with 4 vertices. These shapes are specified by the vertices, the output of the program should be modified vertices. I am trying to find an algorithm to create a space between the polygons, the colored area depicts the space: ![polygons with space](http://i.stack.imgur.com/yQD6h.png) I have tried these things:   * scaling each polygon around it's center of gravity    * scaling the bounding box of each polygon None of those worked. I am thinking of an algorithm to modify the corner points of each polygon to create the equidistant space. What would be a feasible algorithm for this problem?


Business Logic vs Presentation/View Logic

I often question myself of where to put the logic that organize the data to a view that is not necessarily a business logic in a 3-layered architecture (DAO, Business, View). I'll put an example to be clearer: I have a UI in my aplication that shows pending tickets and answered tickets in two different tabs. To get the data from the database, I make a single query. Since there is no business logic, I'm returning the whole list to the Controller (View) and separating it in two lists to pass to the view template. Should I be separating this in the business layer? Or is it correct to separate in the controller, since the logic is attached to that single UI?


Pros/Cons for a Data Structure covering multiple databases?

I'm about to extend a system containing two separate systems. Or domains, if we see the system as a domain level. **Today** One domain is used internally. The other is public, which means it is more exposed to whatever can happen "out there". Services of some kind (few options apply) perform operations between the two separate systems. The public and internal system have separated database storages, and are not related to each other. Let's call the domains client and store. **Tomorrow** I'm into a new application that will have lots of more user-specific information at the client domain. The design may be comparable to a 'private database' that has a facebook-account-link as a key. This compares to a database that held user actions, but had no user specific data (such as address, date of birth, email and so on), just a key to the Facebook-server. On the other side, the STORE database (compared to Facebook-server in this case) doesn't know anything about the user actions. **Goal** Approximately 85-90% of the queries will be within their own domain (client if client, store if store). Though, there are some situations where the client need to get data from the STORE database and the STORE needs to create/handle users in the CLIENT database. **Questions out from my head**   * Is this a good way to go?   * Pros/cons? Orphans? Database Performance? Problematic .NET coding?   * Principles of the choice for the boundaries of data? .. and other things you may know or think of   **An example of structure** ..dbStore.Users   * userid (PK)   * name   * dateOfBirth   * emailAddress -> Wallet (another table) ..dbStore.Wallet   * walletid (PK)   * userid   * createddate -> BankAccount (another table, not typed) ..dbClient.users   * storeUserId (unique, non-inc) <\-- corresponds to dbStore.User, no restraint   * accessLevel   * lastLoggedIn   * serviceXxEnabled   * udpAccessKey ..dbClient.action   * actionid (PK)   * isSomething   * someDate   * anythingElse ..dbClient.installation   * installationid (PK)   * userid We won't collect bank-account information, it just to give a picture of the data structure and its importance in keeping it in separate systems. I hope this Q is comprehensible enough.


Why should I care about micro performance and efficency?

Many questions and answers on the C/C++ pages, specifically or indirectly discuss micro performance issues (such is the overhead of an indirect vs direct vs inline function), or using an O(N2) vs O(N _log_ N) algorithm on a 100 item list. I always code with no concern about micro performance, and little concern about macro performance, focusing on easy to maintain, reliable code, unless or until I know I have a problem. My question is why is it that a large number of programmers care so much? Is it really an issue for most developers, have I just been lucky enough to not to have to worry too much about it, or am I a bad programmer?


Aren't there compilers better at telling the programmer what's wrong in a code?

I have worked a little while with the Microsoft compiler from Visual C++ but I worked a long time with G++, and I remember often having bad times understanding what was wrong in my code with the former. Beside binary code generation and optimisation, I think this is a very important feature of a C++ compiler: giving the programmer a clue that makes him understand as fast as possible what is wrong with his/her code. I can understand some programmers understand programming as some sort of "competition" to make less errors, but to me that's a counter productive opinion. I once tried Clang compiler for C from the LLVM thingie, I didn't use it for a long time, but I was impressed on how explicit and easy to understand the error messages were. What are your experiences, and how do you think this matters ? Some WIP of C++ Clang: http://clang.llvm.org/cxx_status.html


Creating a Performance Model for a Legacy product

I've been given the task for creating a performance model for a legacy product. The product is about 10 years old and has never had any performance requirements or performance models before. Generally whats happened in the past is a customer will complain that a particular feature is slow or they are not getting the throughput that they want/need and the developers will investigate and see if any more performance can be squeezed out the code for the feature. Since the product doesn't have any hard measurements and metrics for past versions I fell all I can do is create baselines for the current version and go from there. Other developers sometimes _notice_ that memory usage is really high and ask why. Also, I am new to the product so I don't know all the feature points (which there are hundreds to thousands) and the performance cost of running each. The program is an ASP.NET/.NET 2.0 webapp on IIS 6. I've started looking into performance counters and the CLR Profiler to start getting measurements. I've also read the following docs: Measuring ASP.NET Performance Improving ASP.NET Performance So my question is: **How can I create a performance model for a legacy product that I am new too and hasn't had a performance model/requirement in the past?**


What is the ideal learning path to building Android apps with Scala, without prior Java experience

Unfortunately, there are not currently any books on the subject of 'Learn Android Development with Scala', which would be the ideal solution. I'm guessing that I'll need to pick up at least 3 books here, one for each topic. However, I have no idea what order to read them in, whether to read them simultaneously, what parts of the Java book I can safely skip, etc. What is the best path for me to get started building Android apps using Scala?


Should user input of a contact form be validated?

On software company websites I visit the first time, I often open the "Contact us" page and try to submit the contact form with all fields empty. I am just curios if they validate the user input. If it is just submitted or only validated poorly (e.g. only Javascript validation), I often hear myself thinking > Oh, look how sloppy they are! Can't even validate user input. That calls > itself a software company? No, I don't think I want to buy any software > services of them. A friend of mine has such a "sloppy" contact form. You can submit a completely empty form. I asked him why he does not validate user input, and he said: > Look, I want that customers can contact me. They should enter any > information they want. If they only want to enter a message and leave the > other fields empty, why should I care? They enter the relevant information > anyway. I do not want to add any barriers when contacting me. I did not ask him how many empty messages he gets, though. However, what is the better option now? Both arguments (check how company handles user input vs. not adding any barriers in contacting) seem to make sense for me. I want that the user can easily contact me, but still has the impression that I am precise when programming webpages.


Building a sequential list in languages with cons/linked lists

In languages where cons lists are a major datatype, it is very easy to create a list from last to first by prepending items. When doing processing from some input file, however, one is most likely to encounter items in first to last order. Do languages like these typically recurse?               (define (parse file)       ...       (cons datum (parse file)))      Use append operations at each step? Build the list in reverse order and then reverse it? Is there some canonical design pattern that can solve the problem that input is typically going to be in the reverse order of the way the list is constructed?


Globally important concepts to understand?

I have a history of web development using LAMP + html/css (though I admit the LAMP aspect isn't in great depth) and would like to follow the career path of software developer, so I'm currently learning C, after which I'll look at C++. **I was wondering if anybody could give me a list of subject area's within computer programming as a whole that are important to fully understand, right through to a 'senior' level of career progression?** Obviously I know it's the mindset and knowing when to use various techniques that makes a good programmer, but you have to start somewhere! By topic areas I mean for examples:   * Data types   * Variables   * Functions   * OO   * etc. Many thanks.


How does a web browser save passwords?

How do current web browsers (or mobile mail clients and any software in general) save user passwords? All answers about storing passwords say we should store only hashes, not the password themselves. But I'm having a hard time searching the web trying to find the best techniques to store passwords when we know we will need them in plain text later on — without storing them in plain text, without using a weak encryption (known key) and without asking the user for a master password. Any ideas?


Improving performance for web scraping code

I have a website in which the code scrapes other websites for getting the accurate data. While the code works good but there a decent lag in performance because the code firsts downloads the html stream from various sites(some times 9 websites), extracts the relative part and then renders the html page. What should I do to get an optimal performance. Should I change from shared hosting (godaddy) to my own server or it has nothing to do with my hosting and I need to make changes to my code?


What are the pressures of being a software engineer?

I am thinking about a career in software engineering, but before I look for work I wanted to get an idea of what to expect particularly with pressure. This will be my first programming job (so I am looking for entry level), so I am not yet mature as a programmer yet. My question is what is the pressure like in these jobs? How high can the pressure get? If your boss gives you an assignment and it's due in two weeks but it takes you 3 will you get fired, because your unable to perform? Are you given time to learn more about the technology, develop your coding skills and grow, or are you expected to know it already and blaze through the project? If you have trouble with code are you expected to handle it yourself and work independently, or are you able to ask others for help if you are stuck? Are you expected to put in a lot of late nights to meet the deadlines? I know that this can depend on the company as well, but I just wanted some professional insight to the possible pressures of being a software developer/programmer etc. I also know that other jobs have pressure too! I just would like to know the pressure unique to software engineering. The reason I ask this question is because I had a bad experience programming once and I wanted to know if most of these jobs are the same. If software engineering/developing/programming is tough pressure that I don't want to handle are there other types of development like web development, system admin, etc that are less pressure that I can get into and still code? Thanks for reading and I look forward to hearing everyone's thoughts.


How can I prevent users from merging origin/X into Y in git?

Is it possible to force git to only merge remote tracking branches into the corresponding local branch? E.g. assume origin/X tracks X on origin and corresponds to local X and the same for origin/Y and Y. I want to prevent users to do `git checkout Y; git merge origin/X`. Is it possible? How? **Edit:** To make it clear: The workflow is not the problem. People try to merge the wrong branches because they forgot to checkout the correct branch before merging. It is not about "offenders" or pushing to the central repo. It's just people forgetting at which branch they are. The last "incident" was literally: > "I should commit and push real quick before I leave. > > git add .   >  git commit -am 'Feature Y'   >  git push origin > > Whoops, whats that. It tells me to merge branch origin/X first. OK whatevs. > > git merge origin/X > > Whoops, whats that now. Lots of merge conflicts. What have I done. I better > call somebody..." The user was working in branch Y and did not understand what the `git push origin` was saying. It told it that origin/X needed merging and that's what he did, because he wanted to "push real quick". In the case above branch X was one commit ahead of the local X, so pushing all branches yielded the "needs merging" error. I adjusted the "workflow" now to always push a branch explicitly, e.g. `git push origin Y` instead of just `git push origin`, but that's not curing the problem. It should (usually) not be allowed without a warning to merge origin/X with Y. For merging feature branches X and Y can be merged.


How should I choose the right documentation for my team?

I've asked this question a few days ago about how much documentation should be made and now I realize I may have been asking only half of the question. My goal is to promote some sort of documentation in order to increase continuous knowledge inside the team. My team is working mainly on server-side services which extends proprietary devices which are distributed locally (national not global) In addition we supply APIs and administration web apps to those services. **What would be the best types of documentation for my team?** **Should we focus on DFDs, sequence diagrams, class diagrams, just plain text... ?** **Are some documentation methodologies better for specific industries or are there some which are just a waste of time?** _I fear this last question would be put down as too subjective, but I do hope there are some standard answers for this question, similarly to when someone asks about good OOP techniques and gets directed to design patterns and SOLID principles._


Ubiquitous Language and Custom types

Note that my question is referring to those attributes that even on their own already represent a _concept_ ( ie on their own provide a _cohesive meaning_ ). Thus such attribute needs no additional functional support and as such is _self-contained_. I'm also well-aware that even with _self-contained_ attributes the _custom types_ may prove beneficial ( for example, they give the ability to add new behavior later, when business requirements change ). Thus, my question focuses only on whether _custom types_ for _self-contained_ attributes really enrich Ubiquitous Language **UL** a) I've read that in most cases, even simple, _self-contained_ attributes should have custom, more descriptive types rather than _basic value types_ ( _double, string_ ... ), because among other things, _descriptive types_ add to the **UL** , while the use of _basic types_ instead weakens the language. I understand the importance of **UL** , but how does having a _basic type_ for a _self-contained_ attribute weaken the language, since with _self-contained_ attributes the name of the attribute already adequately describes the _concept_ and thus contributes to the **UL** vocabulary? For example, the term `person_age` already adequately explains the concept of _quantifying the number of years a person has_ :               class Person     {            string person_age;     }      so what could we possibly gain by also introducing the term `ThingAge` to the **UL** :               class person     {           ThingAge person_age;      }      thanks


Entity Framework Joining Tables With Ranged Foreign Key Relationships

I'm not sure if "Ranged Foreign Key Relationship" is an actual term or if I just made it up, but this is what I am talking about: AgeGroup Table               int MinAge { get; set; }     int MaxAge { get; set; }     string Description { get; set; }      Customer Table               public int CustomerID { get; set; }     public string Name { get; set; }`     public int Age { get; set; }     public virtual AgeGroup AgeGroup { get; set; }      Given the above two tables, how can I join them using the (EntityFramework, DataAnnontations, DbContext) and be able to access `Customer.AgeGroup.Description`? Consider the following example data: AgeGroup               MinAge MaxAge Description     0      12     Youngin     13     19     Teenager     20     29     Twenties     30     39     Thirties     40     9999   Old      Customer               CustomerID Name        Age     345        Joe Smith   17     493        Cobaltikus  31     631        Jane Doe    29      How can I relate these? Cobaltikus has an Age of 31. There is no corresponding AgeGroup record with 31. The corresponding AgeGroup record is the one with MinAge = 30 and MaxAge = 39. I can do this easily in SQL, but how do you do it with EntityFramework?               SELECT       AgeGroup.Description          FROM       Customer,       AgeGroup          WHERE       Customer.CustomerID = 493       AND AgeGroup.MinAge <= Customer.Age       AND AgeGroup.MaxAge >= Customer.Age


Using XML field Vs. creating a table for unstable organization

I am in the middle of design an application to issue and store invoices for an organization. The problem is the organization is not stable at all. There are many types of invoices and they may increase and change. First, I tried to use tables in my DAL, one table to store invoices, one for invoice fields, and one for invoice field values. The problem was, this way needs Reflection to detect fields later, and this may slow the application when invoice contains plenty items. Second, I tried to keep core of invoice data as two tables: invoices and invoice items. Other fields are fully catchable from other tables. I mean, Business Layer should provide different results per invoice type. It should choose the right queries, and process the results according to the type of invoice. Two problems with this solution are:   1. I still have lots of join between other tables when I want to show an invoice, for per invoice item. I should recalculate everything every time for every invoice item.   2. What if the invoice items table doesn’t support a new type of invoice? Then I probably should add a new table to store that kind of invoices items.   3. My client asked me to keep all data related to an invoice, they do not want me to recalculate it every time. They want something like a snapshot of related data at the time invoice is creating. Now, what I’m think can I use the benefit of XML in table? I can save the invoice, with whatever fields as xml.   * I can save the different version of their invoices.   * On changes, I only update my Business.dll and no DAL change required.   * Linq to XML is not slow. What do you suggest?


How does the new google maps make buildings and cityscapes 3D?

Anyone who's seen the new Google maps has no doubt taken note of the incredible amount of three-dimensional detail in select American cities such as Boston, New York, Chicago, and San Francisco. They've even modeled the trees, bridges and some of the boats in the harbor! Minor architectural details are present. It's crazy. Looking at it up close, I've found there's a rectangular area around each of those cities, and anything within them is 3Dified, but it cuts off hard and fast at the edge, even if it's in the middle of a building. The edge of the rectangle is where the 3D stops. This leads me to think it's being done algorithmically (which would make sense, given the scale of the project, how many trees and buildings and details there are), and yet I can't imagine how that's possible. How could an algorithm model all these things without extensive data on their shapes and contours? How could it model the individual wires of a bridge, or the statues in a park? It _must_ be done by hand, and yet how could it be for so much detail! Does anyone have any insight on this?


Can I use MongoDB for a commercial web based service?

Can I use MongoDB as the database for providing a paid service? MongoDB is licensed under the AGPL, but the drivers I'm using are MIT licensed. Do I have to buy a commercial license for MongoDB or can I use it as a backend for my app?


I, perhaps, made a _wrong_ choice of going with a `Component-based Framework` like JSF for an internet facing, high traffic web application. Development with JSF has although been easier but what I fear now is whether JSF would allow me that scalability & performance with all it fundamental problems & issues. State saving in a high traffic web app, does that make sense at all!? How do I tune up my JSF app now to make it perform better under heavy load? I am already trying to reduce the state / component tree by reducing the no of components on page. What are other things I can tune up to make JSF app perform better ?


Are COM objects a form of IPC?

In Pro C# 2008 it is stated > Using constructs such as AppIDs, stubs, proxies, and the COM runtime > environment, programmers can avoid the need to work with raw sockets, RPC > calls, and other low-level details. It then demonstrates a VB6 call where a COM object is instantiated by passing in the AppId. Then, a method call is performed on said object. Does this mean COM allows IPC directly with objects? Is this secure? Why does .NET disallow this behavior?


Why is Twitto not secure?

I've come across Twitto, which basically is a web framework that fits in a tweet. It is so short that I can post the code here :               require __DIR__.'/c.php';     if (!is_callable($c = @$_GET['c'] ?: function() { echo 'Woah!'; }))       throw new Exception('Error');     $c();      It basically searches for a file named c.php and calls whatever function in that files that is the same name as `$_GET['c']`. On the project's website, there is a big red banner at the bottom of the page that reads : > » TWITTO IS NOT SECURE, DON'T USE IT FOR YOUR NEXT WEBSITE « I am no PHP guru, but to me it looks like if you take all the precautions you normally take with a standard PHP site (sanitizing user input, etc), it should be secure enough ? What is wrong with this tiny framework ? EDIT : I understand why this framework is not secure AS-IS, but with the proper bootstrapping and validation checks and everything inside the function you call, it should be just as secure as any other framework ?


Developing only for 64 bit servers a bad idea?

In an attempt to solve one problem I encountered another. I would like to have an easy and memorable way of creating unique error numbers, across projects and across developers. The scheme I came up with was to use the initials of the developer, find their position in the alphabet, and append the date and time. Example: lets say the developer Mark Elliot Zuckerberg (initials MEZ) writes code that throws an exception on Feb 8th 2014 at 12:54AM. The error code would be: 8526020820140054 This works brilliantly on 64 bit machines, but the resulting integer is too large for 32 bit computers. Does that make this a bad idea? How common are 32 bit servers, and do we expect them to slowly disappear completely?


Open Source Cloud Computing

Recently I realized that the most popular social platforms on the net are in the hand of just a few companies, Google, Twitter, Facebook, to name just a few. Taking into account the world changing power of these frameworks I am looking for a non-profit, democratic alternatives to these sites. (Mozilla is a non-profit project, however it could not thrive without the backing of Google.) In my imagination, the ideal approach (see explanation below) would be a distributed approach as used in file sharing programs or tools like seti@home. Every user willing to take part in the project would have to install software on his or her computer to act as a node in the network that would make up a social space similar to Google+, Facebook or Twitter but with a non-commercial approach. This approach could also be used for a "democratic" cloud to store data. Is anyone aware of projects that go in this direction? * * * I call it "ideal approach" for a couple of reasons. No need for big server farms or hardware maintaining costs. Invulnerability against most hack attack because it's distributed and there is no central node. Just some I could think of right now.


introducing pointers to a large software project

I have a fairly large software project written in `c++`. In there, there is a `class foo` which represents a structure (by which i don't mean the programmers struct) in which `foo`-objects can be part of a `foo`-object. Here's `class foo` in simplest form:               class Foo     {         private:             std::vector<unsigned int> indices;         public:             void addFooIndex(unsigned int);             unsigned int getFooIndex(unsigned int);     };      Every `foo`-object is currently stored in an object of `class bar`.               class Bar     {         private:             std::vector<Foo> foos;         public:             void addFoo(Foo);             std::vector<Foo> getFoos();     }      So if a `foo`-object should represent a structure with a "inner" foo-object, I currently do               Foo foo;     Foo innerFoo;     foo.addFooIndex(bar.getFoos().size() - 1);     bar.addFoo(innerFoo);      And to get it, I obviously use:               Foo foo;     for ( unsigned int i = 0; i < foo.getFooIndices().size(); ++i )     {         Foo inner_foo;         assert( foo.getFooIndices().at(i) < bar.getFoos().size() );         inner_foo = bar.getFoos().at(foo.getFooIndices().at(i));     }      So this is not a problem. It just works. But it's not the most elegant solution. I now want to make the inner `foo`s to be "more connected" with the `foo`-object. It would be obviously to change `class foo` to:               class Foo     {         private:             std::vector<Foo*> foo_pointers;         public:             void addFooPointer(Foo*);             std::vector<Foo*> getFooPointers();     };      So now, for my question: How to gently change this basic class without messing up the whole code? Is there a "clean way"?


How to structure unit testing of huge libraries?

I am writing unit tests for a library written in Qt/C++. The library is rather big, with lots of functionalities. I have a separate `unitTest` folder which I have my `UnitTest.cpp` in there. Having all test case / unit tests in the same file, makes it one very big `.cpp` file. I was wondering what is the best approach to unit test huge libraries. Should I have different `UnitTest.cpp` files in different folder? Like one for every class? or every name space?


Difference between daemon and child thread?

As per my knowledge daemon thread is a thread that runs in background(low priority thread) and also a child thread runs in the background when the parent thread runs foreground so where does the difference lie between a child and a daemon thread? It's in case of java and can you explain referring to other languages too.


Is abusing Application.UnhandledException for login redirection okay?

I'm programming a windows phone 7 app which needs authentication for news-like read access. I use Application.UnhandledException to handle (my) `AuthFailedException`, which can be thrown from any page, and navigate to a login page. To mimic a modal dialog, I do the following:   1. I attach a `BackKeyPress` event handler to clear the back stack, effectively causing the app to exit.    2. On login, I invoke the actual go-back behavior to get back to the previous page, which threw the `AuthFailedException` (all in the view model via proper dependency injection). This feels dirty, but at least a little better than what hacks might be neccessary otherwise... Any advice on how to improve the situation?


Choosing the language to build an app in based on hiring market vs performance and maintainability

I'm facing a choice of whether to start building Haskell components for a certain production app that is all done in Ruby. I'm leaning toward Haskell for several reasons, primarily speed (compiled Haskell is like 4-8x faster), greater transparency (via Haskell type system), and safer refactorability (type system). I've written a few open source and production programs in Haskell already and enjoy writing it very much. Feasibility is not an issue. I've played around with the Haskell Snap web framework and database libraries like PostgreSQL.Simple and am satisfied that rewriting a Rails app and various backend programs with Haskell is feasible. The real issue is hiring programmers when we need to scale the dev team, or eventually handing off the programming responsibilities altogether. It's a lot easier to find programmers in Ruby than in Haskell. On the other hand, the Haskell community seems to be growing, and it's not too hard to train programmers to modify parts of a Haskell program if you approach it as a DSL (much like Ruby on Rails). The Haskell type system also seems to promise much safer collaboration than dynamic Ruby does. In his essay "Beating the Averages" (http://www.paulgraham.com/avg.html), Paul Graham argues that using a superior language can be a decisive advantage. But when does it make sense to forgo using a superior language in order to make it easier to add programmers to your team?


Building a tool to fix compiler errors automagically

When a program doesn't compile, error messages are sometimes esoteric. Often a simple Google search leading to a site like stack exchange solves the problem. Now why can't we automate this? How about a Siri for coding? By Siri, I mean an intelligent personal assistant. Not talking about speech recognition here. I wonder if there is anybody out there (startups/ research labs) building a cool product like this. It will cut down debugging time drastically.


Do these specific tables need surrogate keys?

## Background I have this tables               +-------------------------+  +------------------------+     |Airport                  |  |Country                 |     |-------------------------|  |------------------------|     |airport_code string (PK) |  |country_code string (PK)|     |address string           |  |name string             |     |name  string             |  +------------------------+     +-------------------------+          +-------------------------+     |Currency                 |     |-------------------------|     |currency_code string (PK)|     |name string              |     +-------------------------+      **airport_code** is the IATA (International Air Transport Association ) airport code, you can see them in your luggage tags when you travel by plane. ![enter image description here](http://i.stack.imgur.com/rPnue.png) **country_code** is the ISO 3166-1 A3 standard country code, you can see them in the olympics. ![enter image description here](http://i.stack.imgur.com/EpjiB.png) **currency_code** is the IS0 417 standard 3-chars currency code, you can see them in international currency exchange display boards. ![enter image description here](http://i.stack.imgur.com/YD3GW.png) ## Questions **Are these natural PKs good enough ?** **Is using world respected standards, which are accepted by whole industries good enough for PKs ?** **Do this tables need surrogates no matter what ?**


Is it possible to release something with proprietary dependencies under Apache2 licence?

If I write code with proprietary dependencies, can I release my own code under the Apache licence? An example of this would be a plugin for a proprietary framework.


Surviving MATLAB and R as a Hardcore Programmer

I love programming in languages that seem geared towards hardcore programmers. (My favorites are Python and D.) MATLAB is geared towards engineers and R is geared towards statisticians, and it seems like these languages were designed for people who aren't hardcore programmers and don't think like hardcore programmers. I always find them somewhat awkward to use, and to some extent I can't put my finger on why. Here are some issues I have managed to identify:   * (Both): The extreme emphasis on vectors and matrices to the extent that there are no true primitives.   * (Both): The difficulty of basic string manipulation.   * (Both): Lack of or awkwardness in support for basic data structures like hash tables and "real", i.e. type-parametric and nestable, arrays.   * (Both): They're really, really slow even by interpreted language standards, unless you bend over backwards to vectorize your code.   * (Both): They seem to not be designed to interact with the outside world. For example, both are fairly bulky programs that take a while to launch and seem to not be designed to make simple text filter programs easy to write. Furthermore, the lack of good string processing makes file I/O in anything but very standard forms near impossible.   * (Both): Object orientation seems to have a very bolted-on feel. Yes, you can do it, but it doesn't feel much more idiomatic than OO in C.   * (Both): No obvious, simple way to get a reference type. No pointers or class references. For example, I have no idea how you roll your own linked list in either of these languages.   * (MATLAB): You can't put multiple top level functions in a single file, encouraging very long functions and cut-and-paste coding.   * (MATLAB): Integers apparently don't exist as a first class type.   * (R): The basic builtin data structures seem way too high level and poorly documented, and never seem to do quite what I expect given my experience with similar but lower level data structures.   * (R): The documentation is spread all over the place and virtually impossible to browse or search. Even D, which is often knocked for bad documentation and is still fairly alpha-ish, is substantially better as far as I can tell.   * (R): At least as far as I'm aware, there's no good IDE for it. Again, even D, a fairly alpha-ish language with a small community, does better. In general, I also feel like MATLAB and R could be easily replaced by plain old libraries in more general-purpose languages, if sufficiently comprehensive libraries existed. This is especially true in newer general purpose languages that include lots of features for library writers. Why do R and MATLAB seem so weird to me? Are there any other major issues that you've noticed that may make these languages come off as strange to hardcore programmers? When their use is necessary, what are some good survival tips? Edit: I'm seeing one issue from some of the answers I've gotten. I have a strong personal preference, when I analyze data, to have **one** script that incorporates the whole pipeline. This implies that a general purpose language needs to be used. I hate having to write a script to "clean up" the data and spit it out, then another to read it back in a completely different environment, etc. I find the friction of using MATLAB/R for some of my work and a completely different language with a completely different address space and way of thinking for the rest to be a huge source of friction. Furthermore, I know there are glue layers that exist, but they always seem to be horribly complicated and a source of friction.


Can we technically un-blur images?

Since there is an algorithm to blur images, so that part of it cannot be recognised, can we reverse the algorithm and unblur part of than image? Is there a program that already does that, is that even possible, even in a near future?


Can I use the test suite from an open source project to verify that my own 'compatible library' is compatible?

The question Is it illegal to rewrite every line of an open source project in a slightly different way, and use it in a closed source project? makes me wonder what would be considered a _clean-room implementation_ in the era of open source projects. Hypothetically, if I were to develop a library which duplicates the _publicly documented_ interface of an open-source library, without ever looking at the source code for that library, could that code ever be considered a derivative work? Obviously it would need the same _class hierarchy_ and _method signatures_ , so that it could be a drop-in replacement - could that in itself, be enough to provoke a copyright claim? What about if I used the test suite of the open source project to verify whether my _clean_ implementation behaved in the same way as the original library? Would using the test suite be enough to _dirty_ my _clean_ code? As should be expected from a question like this, I am not looking for specific legal advice, but looking to document experiences people may have had with this sort of issue.


How do I comply to GPL in case of Appliance?

We are developing an enterprise network appliance which has got some GPL softwares like linux and apache and some others with APL license. But the core of the service is proprietary software and access is provided only via a web interface. My query is what all I need to do in order to comply with GPL license in this scenario. Would providing a list of Third party softwares used in the appliance in the web interface be sufficient?


I'm 10 months out of school and I lost my first programming job last week. I personally know a lot about different stuff - just look at my StackOverflow account, but I don't feel I have the professional experience necessary to ask more in salary. For example, I was told they were looking for a mid-level person at $75k/year. I told him I wasn't sure where I fell. He asked me where I could fall, so I said I was worth only $50k/year - which was close to my last salary. The guy told me I wasn't what they were looking for. How do I not undersell myself when looking for a job, while remaining honest?


Help/suggestions for Parallel assembly line scheduling (Dynamic programming)

I am working on a problem similar to the assembly line scheduling by dynamic programming.The issue is that unlike the classic problem where we have predefined stations now I only have information which task should run before which other(could be more than one) tasks. I have to find out which tasks to put on which line to minimize the total time taken by the production.So obviously if the tasks are on a single line then they are executing in serial fashion and hence are slower. So I have following issues   1. How do I create time based levels/lines as I don't have a sequence of all tasks? I only know which task comes before which(one or many) tasks. Time based levels are necessary as I have to minimize the time (which would happen when the tasks are executed in parallel).   2. How do I determine the optimal order of tasks to minimize time? As several tasks would be waiting for a single task, I have to minimize this time as well.   3. Like the original problem, communication between different lines would also have a cost. I have to determine whether this communication cost is worth moving the task to a separate line(from its communicating task) **tl;dr** : A parallel version of the assembly line scheduling (Dynamic programming) where all lines could be busy at the same time and I don't have any station numbering/ordering. I just know which tasks should be executed before which. I have to decide which tasks to put on the same line and which tasks to put on the different lines (given the communication time when tasks are on different lines) to minimize the production time.


Code duplication with no obvious abstraction

Have you ever encountered a case of code duplication where, upon looking at the lines of code, you couldn't fit a thematic abstraction to it that faithfully describes its role in the logic? And what did you do to address it? It is code duplication, so ideally we need to do some refractoring, like for example making it its own function. But since the code doesn't have a good abstraction to describe it the result would be a strange function that we can't even figure out a good name for, and whose role in the logic is not obvious just from looking at it. That, to me, hurts the clarity of the code. We can preserve clarity and leave it as it is but then we hurt maintainability. What do you think is the best way to address something like this?


What kind of questions and processes do you ask yourself and follow when designing software?

I've read books on design, I troll the internet for articles on best practices and software design principles. However, I always seem to struggle to put into practice the kind of suggestions and techniques supplied. My question is. What kind of things do you ask yourself when you are designing an application/class/method location/property location etc that helps ensure you come up with something that is, although not perhaps perfect, is good enough that you are happy with the result. For example, when trying to decide between putting a property on an object how do you decide whether the code that might use that object should be part of the class that contains it or exposed so other classes can use it. i.e. how do you decide who owns and responsible for a certain logic/property. I realise there are things like SOLID that you can apply, but I'm looking for techniques and thought processes people often go though in order to get to the end design that applies these principles. NOTE: I'm not looking at getting links to books or internet articles necessarily as these I look at quite regularly. I'm really after peoples read world practices on how they go about day to day resolving class and application design issues they come across. Thanks alot.


Are there technical reasons for an immediate update following a fresh download/install?

I've had this happen in all sorts of software products: You purchase a software product, download it, install it, and then after the install, the program immediately begins downloading an update or a patch. Ideally, I would imagine that the download package would somehow be linked to the product's repository so that stable releases could be pushed to the product site rather than having to force the user to wait through an update after install. Are there any technical reasons for the install/update process or is it just a case of poor deployment infrastructure on the part of a lot of companies?


Choosing a JavaScript Asynch-Loader

I’ve been looking at various asynchronous resource-loaders and I’m not sure which one to use yet. Where I work we have disparate group-efforts whose class-modules may use different versions of jQuery (etc). As such, nested dependencies may differ, as well. I have no control over this, so this means I need to dynamically load resources which may use alternate versions of the same library. **As such, here are my requirements:**     1. Load JavaScript and CSS resource files asynchronously.   2. Manage dependency-order and nested-dependencies across versions.   3. Detect if a resource is already loaded.   4. Must allow for cross-domain loading (CDN's)   5. (optional) Allow us to unload a resource. **I’ve been looking at:**     * Curl   * RequireJS   * JavaScriptMVC   * LABjs I might be able to fake these requirements myself by loading versions into properly-namespaced variables & using an array to track what is already loaded...but (hopefully) someone has already invented this. **So my questions are:**     * Which ones do you use? And why?   * Are there others that my satisfy my requirements fully?   * Which do you find most eloquent and easiest to work with? And why? **UPDATE:**   For those interested, I tried all the AMD libraries above (and more). In the end, I went with RequireJS. It's just cleaner and easier overall...and I'm glad to be using it.


Why does Facebook use hash in the URL...sometimes?

I've noticed that Facebook SOMETIMES uses a hash in the url. For example, when I'm on my home page, and then I click my profile page, the URL quickly changes to:               facebook.com/#_________      followed by some other stuff. before quickly loading to:               facebook.com/profileName      It doesn't always do this. What's going on here?


Is state pattern a good solution for implementing UI changes for Landscape and Portrait modes?

For our iOS app, a lot of complicated UI logic depends on the interface orientation of the ViewController. This conditional logic is present in a lot of places. Can it be segregated into different states in form of objects?


What is a good workflow for a C++ beginner?

I desire to become a more serious scientific C++ programmer. To do so, I need a consistent style of workflow (e.g., coding, test-driven development, etc.). My question is simply what sort of workflow should I consider? I am familiar with Linux and Mac, and prefer to use free tools like cppcheck, valgrind, g++, etc. I prefer to use Qt and Boost within my programming toolbox, and I am considering using mock objects (either Google Mock or MockPP) within the TDD. I typically use vim for my editor. In essence, should I do something like the following: > TDD -> code -> cppcheck -> valgrind -> debug -> repeat until ready to use > profilers and coverage mechanisms or, should I pursue some other way? I realize that the opinions will vary, and I also understand that I must first take the time to think through the process and document my thoughts whether written or UML before coding, and I also know that I should document the code as I step write the code. Any and all thoughts will be appreciated.


Is 4-5 years the “Midlife Crisis” for a programming career?

I’ve been programming C# professionally for a bit over 4 years now. For the past 4 years I’ve worked for a few small/medium companies ranging from “web/ads agencies”, small industry specific software shops to a small startup. I've been mainly doing "business apps" that involves using high-level programming languages (garbage collected) and my overall experience was that all of the works I’ve done could have been more professional. A lot of the things were done incorrectly (in a rush) mainly due to cost factor that people always wanted something “now” and with the smallest amount of spendable money. I kept on thinking maybe if I could work for a bigger companies or a company that’s better suited for programmers, or somewhere that's got the money and time to really build something longer term and more maintainable I may have enjoyed more in my career. I’ve never had a “mentor” that guided me through my 4 years career. I am pretty much blog / google / self taught programmer other than my bachelor IT degree. I’ve also observed another issue that most so called “senior” programmer in “my working environment” are really not that senior skill wise. They are “senior” only because they’ve been a long time programmer, but the code they write or the decisions they make are absolutely rubbish! They don't want to learn, they don't want to be better they just want to get paid and do what they've told to do which make sense and most of us are like that. Maybe that’s why they are where they are now. But I don’t want to become like them I want to be better. I’ve run into a mental state that I no longer intend to be a programmer for my future career. I started to think maybe there are better things out there to work on. The more blogs I read, the more “best practices” I’ve tried the more I feel I am drifting away from “my reality”. But I am not a great programmer otherwise I don't think I am where I am now. I think 4-5 years is a stage that can be a step forward career wise or a step out of where you are. I just wanted to hear what other have to say about what I’ve mentioned above and whether you’ve experienced similar situation in your past programming career and how you dealt with it. Thanks.


using "IS" is better or checking for "NOT NULL"

In C#.NET language: This style of coding is recommended or the one below it?                       if (sheet.Models.Data is GroupDataModel)             {                 GroupDataModel gdm = (GroupDataModel)sheet.Models.Data;                 Group group = gdm.GetGroup(sheet.ActiveCell.Row.Index);                    if (group!=null && controller != null)                 {                     controller.CheckApplicationState();                 }             }      or this one:                       var gdm = sheet.Models.Data as GroupDataModel;             if (gdm != null)             {                 Group group = gdm.GetGroup(sheet.ActiveCell.Row.Index);                    if (@group!=null && controller != null)                 {                     controller.CheckApplicationState();                 }             }


WinRT for 'desktop' apps

So I'm reading up about the differences between the old and the new APIs, and I can't find whether the new WinRT API will provide for desktop apps, so far it seems its only available to write Metro apps - ie the full screen, 'phone style' apps. Does this mean that I can write a WinRT-based app and it will be invoked from a desktop but display like other Metro apps (eg IE) and I won't be able to write an old-style desktop app that runs in the old-style desktop? What does this mean for server side apps? I imagine WinRT would be the API of choice for servers, now that Windows Server comes with an optional GUI, so I imagine that if I can write a windows-less app using WinRT for the server, I should be able to write the same for the client too? (and if that's the case, surely I could connect a non-Metro UI to it)


Run coded UI tests on different projects

With little or none previous experience of testing, I'm looking into adding automated testing to a continuous integration process of SharePoint applications. I've learned how this can be achieved using coded UI tests that are run before deployment and during the build and I've used Selenium with Java before, where we didn't record any scenarios but instead wrote tests by hand, identifying elements in the GUI and asserting results. With this little experience, I have a few questions about UI testing.   1. Is it possible to write test methods that can be applied on several different applications, such as testing buttons etc. or is this something that has to be written for each project, since the results of button click may vary? I assume that this would require following a specific standard .   2. Are there any UI testing methods that can be generalized and applied to all projects that go through a certain build, or is the same here that all UI tests must be written specifically for that application?


Should exceptions do things other than tell the user something went wrong?

I created a general class that accepts a string when it is constructed, and it spits out that string when a user calls what(). This is all it does; on throw, it returns the initializing string.               class Exception_As {       private:           std::string message       public:           Exception_As(const std::string& message) { // constructor             this->message ="EXCEPTION: " +message;         }              virtual const char* what() const throw() {             return message.c_str();         }     }      How I use my custom exception class:               bool check_range(           const std::vector<std::string>& list,         const unsigned& idx_start,  // where to start checking         const unsigned& idx_end,    // where to stop checking         const std::string& key     ) {         if ( idx_start > idx_end ) {             throw Exception_As("check_range: start index > end index: now fix it! :D");         }              ... rest of code     } // end of check_range      How a user would use check_range:               // some other user code using my check_range     void main() {         try {             ... set up variables                  my_hero_qualified = check_range(semi_finalists, third_place, first_place, my_hero);             ...rest of code         }              catch (const Exception_As& e) {             std::cout << e.what() << std::endl;         }     }      If the try/catch was not there, it would abort the program because of the thrown Exception_As. If it was there, the user would be notified that "check_range: start index > end index: now fix it! :D". For me, sure beats writing tons of BadEvent1Exception, BadEvent2Exception, etc classes. I can see I'm being lazy with this method, and yeah, I can't do anything fancy like modify values based on exceptions or morph an object's state; but if you just entered unexpected territory, who knows if you're handling it correctly? May as well just end it so you can fix what's up and develop properly. So, question: if all exceptions do is break the program on unexpected circumstances, won't a single exception class that returns the problem be enough? ...Or should exceptions be doing other things anyway? If not, why create so many classes of Exceptions that have different names, sure, but from what I've seen, only report that something went wrong.


How to divide OO project into packages?

I'm a hobbyist programmer working on my own projects. I use Java. Until recently my average project was only 1000 LoC. My latest project however is bigger and is starting to exceed 1500 LoC. I estimate it will reach about 2000. I've never organized my classes into packages. All of them were always in the default package and it worked fine. However as my projects grow and the amount of classes gets bigger, I'm starting to feel unorganized. My question is: how exactly does one divide his/her classes into packages? What I mean is, by what criteria do you divide classes? **Is it by the 'part' of the app?** Aka GUI classes in one package, business logic in the other, networking, etc.? **Or maybe high-level classes versus lower level classes?** Aka classes that do concrete, specific work in packages of their own, and 'architectural' classes that tie it all together in their own packages? **Or maybe you simply divide by the criteria of 'what feels right and organized' specifically to you?** For example, I'm working on an app that makes music. It is basically divided into two main systems: the system that makes the music, and the system that displays the GUI and controls the other system (i.e. a button press in that system activates the other system). The music-creation system is also divided into two systems: for creating melodies and for creating chord progressions. And the chord-progression generation part, among other things contains a group of classes that serve as interchangable algorithms for a Strategy pattern involved (i.e. classes used for a specific implementation detail). There are of course higher-level and lower-level classes involved in every system. For example the progression-generation system contains a `ProgressionGenerator` class, which is high-level and ties the entire system together. It also has a `Chord` class which is far more low level (i.e. takes care of playing specific notes). The way I would organize this into classes is like so: The music-creation system into one package, the GUI system that controls the other system into another package. Than the melody-creation into a subpackage of the music-creation pakcage and the progression-creation into a different subpackage. And inside the progression-creation subpackage, another subpackage contataing the classes used for that Strategy pattern involved somewhere in that system. **Does this sound like a good approach for organizing things into packagages? By what criteria do you divide the classes into packages? By 'what feels right', or by more technical terms?**


Moving from one man project to team project in the future. What should I be doing now in preparation and what can wait?

To elaborate I am interested in knowing what people think you need to put in place while still a one man project (team source control, documentation, builds etc) and what things don't need to be done until that point when the second person comes onto the project. Anyone with any experience of moving through this scenario, their insights will be appreciated.


"Software features that can't be demonstrated by automated tests simply don't exist"-- Is it too extreme a statement?

Kent Beck famously said that > Software features that can't be demonstrated by automated tests simply don't > exist But is this too extreme? I mean, I can't demonstrate that my UI really works, the screen pixel is correct in automated tests. So my features don't exist?


Script/tool to import series of snapshots, each being a new edition, into GIT, populating source tree?

I've developed code locally and taken a fairly regular snapshot whenever I reach a significant point in development, e.g. a working build. So I have a long-ish list of about 40 folders, each folder being a snapshot e.g. in ascending date YYYYMMDD order, e.g.:-   1. 20100523    2. 20100614   3. 20100721   4. 20100722   5. 20100809   6. 20100901   7. 20101001   8. 20101003   9. 20101104   10. 20101119   11. 20101203   12. 20101218   13. 20110102 I'm looking for a script to import each of these snapshots into GIT. The end result being that the latest code is the same as the last snapshot, and other editions are accessible and are as numbered. Some other requirements:   * that the latest edition is not cumulative of the previous snapshots, i.e., files that appeared in older snapshots but which don't appear in later ones (e.g. due to refactoring etc.) should not appear in the latest edition of the code.   * meanwhile, there should be continuity between _files_ that _do_ persist between snapshots. I would like GIT to know that there are previous editions of these files and not treat them as brand new files within each edition. Some background about my aim:   * I need to formally revision control this work rather than keep local private snapshot copies.   * I plan to release this work as open source, so version controlling would be highly recommended   * I am evaluating some of the current popular version control systems (Subversion and GIT) BUT I _definitely_ need a working solution in GIT as well as subversion. I'm _not_ looking to be persuaded to use one particular tool, I need a solution for each tool I am considering. (I haved posted an answer separately for each tool so separate camps of folks who have expertise in GIT and Subversion will be able to give focused answers on one or the other). The same but separate question for Subversion: Script/tool to import series of snapshots, each being a new revision, into Subversion, populating source tree?


Javascript - Avoiding variable redundancy in nested for loops

**Please bear with me, I could only explain the problem in the comments of the code snippet below. Please read through them carefully. Question at the end:** I usually tend to name the variables used in `for` loops with `i`, like this:                for (var i = 0; i < arr.length; i++){           // do some COMPLEX operations here      }      This looks fairly simple; but when I'm at it I may require nested for loops within the above `for` loop. So, introducing the complexity now:                for (var i = 0; i < arr.length; i++) {           // do some           // VERY           // COMPLEX           // operations           // here                for (var i = 0; i < javascript_object.list.length; i++) {               // I may have inadvertently forgot of the variable 'i' was been used earlier               for (var j = 0; j < javascript_object.list[i].another_list.length; j++) {                   // Perform more complex operations here               }           }                this.getReports(arr[i]) // the value of this i              // which I now think refer to the first for loop might have been changed              // in second for loop and may lead to dangerous results!       }      How to avoid this from happening? How could the variables be named carefully so that it wouldn't clash with other variables being declared elsewhere?


How does Mercurial determine which changesets I need when I pull?

This is a question about the internal workings of Mercurial. I vaguely remember a fellow programmer explaining to me how mercurial works out which changesets differ between two repositories and that it had a speedy solution to the problem. Does anyone know how this works or can point me towards a document describing the details?


Testing ASP.NET .aspx and .ascx code behind files

I am wondering how to test .aspx.cs and .ascx.cs code behind. Can I use unit testing and if so how? Are there alternatives that will help test the functions in the code behind files? I don't know how to mock the page or control. I would like to try to apply tdd methodology but I don't know how to unit test the code behind. Do you setup tests for the code behind or move the code to alternate files that are easier to test. Is moving the code out of the code behind a better practice? Also, how would you go about unit testing the code behind files?


How granular should a command be in a CQ[R]S model?

I'm considering a project to migrate part of our WCF-based SOA over to a service bus model (probably nServiceBus) and using some basic pub-sub to achieve Command-Query Separation. I'm not new to SOA, or even to service bus models, but I confess that until recently my concept of "separation" was limited to run-of-the-mill database mirroring and replication. Still, I'm attracted to the idea because it seems to provide all the benefits of an eventually-consistent system while sidestepping many of the obvious drawbacks (most notably the lack of proper transactional support). I've read a lot on the subject from Udi Dahan who is basically _the_ guru on ESB architectures (at least in the Microsoft world), but one thing he says really puzzles me: > As we get larger entities with more fields on them, we also get more actors > working with those same entities, and the higher the likelihood that > something will touch some attribute of them at any given time, increasing > the number of concurrency conflicts. > > [...] > > A core element of CQRS is rethinking the design of the user interface to > enable us to capture our users’ intent such that making a customer preferred > is a different unit of work for the user than indicating that the customer > has moved or that they’ve gotten married. Using an Excel-like UI for data > changes doesn’t capture intent, as we saw above. > > \-- Udi Dahan, Clarified CQRS From the perspective described in the quotation, it's hard to argue with that logic. But it seems to go against the grain with respect to SOAs. An SOA (and really services in general) are supposed to deal with _coarse-grained messages_ so as to minimize network chatter - among many other benefits. I realize that network chatter is less of an issue when you've got highly- distributed systems with good message queuing and none of the baggage of RPC, but it doesn't seem wise to dismiss the issue entirely. Udi almost seems to be saying that _every attribute change_ (i.e. field update) ought to be its own command, which is hard to imagine in the context of one user potentially updating hundreds or thousands of combined entities and attributes as it often is with a traditional web service. One batch update in SQL Server may take a fraction of a second given a good highly-parameterized query, table-valued parameter or bulk insert to a staging table; processing all of these updates one at a time is slow, slow, _slow_ , and OLTP database hardware is the most expensive of all to scale up/out. Is there some way to reconcile these competing concerns? Am I thinking about it the wrong way? Does this problem have a well-known solution in the CQS/ESB world? If not, then how does one decide what the "right level" of granularity in a Command should be? Is there some "standard" one can use as a starting point - sort of like 3NF in databases - and only deviate when careful profiling suggests a potentially significant performance benefit? Or is this possibly one of those things that, despite several strong opinions being expressed by various experts, is really just a matter of opinion?


Algorithm for Testing interoperability

I am writing a php script that carries out a task. One input is a list of options that I need to test for interoperability. If the options are `A B C` then I need to test every combination, but I only keep the options that are compatible ("left to right") and throw away the ones that are not to get a final Result (R).   * A is compatible with B? -> Result   * R with C? -> R rather than:   * A is compatible with B?    * A with B?    * A with C?  The options might be provided in any order but I don't want to bother with the cost of sorting them first. My "left to right" rules imply that the first valid option found dictates compatibility going forward. So `A B C` could mean a different R than `B A C`. Also The options might be interspersed with invalid options. For example `A 0 C` The way I am solving this right now is as follows:   * I stored a predefined list `l` of possible option names with details about the option. Each option has the following static details:      * information about which options it is compatible with ** (starring this as we'll come back to it)     * details about how to implement it     * an index number, `i` ( by definition of it's storage) `l` might look like this (written as JSON for readability here):               { A : { "description"    : "some text to help out",             "index"          : 0,             "conflict"       : (1 << 1 | 1 << 3),             "implementation" : doA()           },       B : { "description"    : "some text to help out",             "index"          : 1,             "conflict"       : (1 << 0 ),             "implementation" : doA()           },     ...     }      When I'm given a list of options the algorithm is this:   * while options      * if option `o` is in the list `l`       * then keep it and find it's index `i` and compatibility "mask" `l[i][m]`       * update the aggregate compatibility "score" `m`       * update the aggregate conflict "score" `c`     * else throw it away for an given `l[i]` it's `m` (`l[i][m]`) is always an integer that represents an item's known compatibility with other items. It is not an array, but rather `m = 1 << i(X) | 1 << i(Y) | 1 << i(Z)` where it is compatible with `X` via it's index, meaning "index of X". So we can rewrite the algorithm more specifically as (still pseudo-code):               for options as o         _m = 1 << l[o][i]         _c = l[o][c]         if( !( _m & c )  && !( m & _c ) )             m |= _m             c |= _c      I'm pretty happy with it right now but since I'm new to using binary operations in a practical way I'm **uncertain as to it's re-use, especially maintenance with a large number of options**. Right now the biggest challenge is that when a new option is added I have to go through all the options to determine if its compatible and update the conflict values. If I get more than a couple of dozen options I may have to use option groups where anything in group must be fully compatible with that group but other groups might be compatible with this group and not share the same compatibility with other groups. I'm also concerned with **readability** for whomever comes after me. Implemented differently, the conflict values might just be a list of items `[A, C, ...]`. But that seems like extra overhead to me and even though conflict values are integers, the raw form of the conflict values directly lists those index values it is in conflict with. e.g. `1 << 1 | 1 << 3` means it is in conflict with whatever is at index 1 and and whatever is at index 3. So I hope that mitigates some of the readability issues. The good things that I see are:   * should be fairly performant   * easy to test new options. I have methods that will give you a sanity check of any options you ask about giving compatibility and conflict lists.    * good for debugging. I simply spit out a combined strategy number into a log and in a compact form I can see what the compatibility choices made were. Small enough I can even put that info into a terse production log as a "code value" **Thoughts?** +1 if you like it. Answers /comments if you have constructive criticism or feedback please side note: To be honest I don't really care about performance here because the task only happens once a day in the middle of the night, but I'm interested in the problem itself and I'm sure this will help me become a better programmer.


Domain Name Lookup

I'm trying to automate the process of sending many domain name lookup requests. I tried to do this by sending for example http request to domain registry site like Whois.net, but I notice they block you after several attempts. others like networksolutions adds token to the page to avoid automated requests. Is there any ideas please? I'm using Java.


What is the difference between system analysis and system requirement analysis

Are "system analysis" and "system requirement analysis" the same thing? I think system system analysis is broader term and system requirement analysis is part of it. Is this correct?


Adding ordered nodes to tree in arbitrary order

I have a database of nodes. Each node can have exactly one parent, but any number of children. Some nodes may be stored with no parent, but at run time, I can create a default "root" node to be the parent of these. First off, what is this data structure called? I think it's just a "tree," but I want to make sure I'm using the correct terminology. Another issue I'm running into is finding an efficient way to create the tree. The nodes can be retrieved from the database in any order, so when I add a node to the tree, its parent may not be in the tree yet. This means that when I add a node, I have to check whether any existing nodes have parents and then add the parent in the appropriate spot. I've searched a lot online, but most talk about trees just refers to "binary trees," and even then I can't even find any good examples of constructing the tree in code -- it's usually working with an existing tree. Are there any examples of efficient ways to build this tree (whatever it may be called)? Language doesn't matter, but I'll be using php.


Two different user story forms, are both correct?

**Just ran across this user story form:**               "As a <user role>, I can <activity> so that <business value>"      (source-1 and source-2) **which to me seems different than what I believe to be the "standard" one:**               "As a <role>, I want <goal/desire>, so that <benefit>"      (source-1 and source-2) (Meaning that I'd believe "I can" would be in the "benefit/value" statement, not the "goal" statement. For example, "So that I can [...].") **Are both right, or is one flawed, and why?**


Is it possible to share oAuth Session?

We are working on a project that includes a web server and a mobile application, we need to access the user's private data (facebook, twitter ...) from the web server by requesting from the user to authenticate our app using the mobile. I managed to access the user's private data from the mobile easily after the user has authenticated the app. now how can I propagate/share this privilege with the server, so that the server can access the user data anytime and work on it ? A typical use case for example:   * user install our mobile app.   * user registers for a direct messages counter service (dummy service).   * user authenticate our app to access his twitter account on the mobile.   * server starts daily pinging the twitter apis and get some data about the user.   * server publish the results to the mobile app. is this scenario possible ? if so where should I be looking to make it happen ?


What is the future for ASP.NET Membership Providers?

While working on a new project with MVC3, a DI framework (Ninject), and unit tests (NUnit) paired with mocks (Moq), I found setting up the Membership Provider felt a bit "awkward". I've run into tasks that seem disproportionally hard, just as others have: injecting a repository to the provider, creating unit tests, and mocking the provider. This led me to a SO question on alternatives to the standard Membership provider (in turn linking to another interesting question on whether to roll your own authentication system), which didn't get as much attention as the votes on the question would warrant. So I'm finally left with **the question** : _Does anyone know what the future for Authentication in ASP.NET is? Or more specifically: did Microsoft provide any (official) insights on their direction for authentication?_ I couldn't find any blog posts from MS employees/teams. The only real related thing I could find was this highly upvoted ASP.NET uservoice ticket which doesn't seem to have any official response.


Is it better to teach conditional loops or iterative loops first?

I've seen tutorials and textbooks that teach conditional loops (while) first and I've seen others that teach iterative (for) loops first. Have there been any studies done as to which produces better results as far as student learning or is it a matter of personal taste?


Host an MVC 3 with Razor syntax app on old server

I just started a new job, I have to create a web app for them and host it on their intranet on an Windows 2003 R2 server with SQL server 2008. As said in the question, I'll work on a MCV3 with Razor syntax application. I know that it won't work easily or even not work at all. On a recent server you have to install something more (I don't remember the name) for the Razor to be understood. What about on this old server? Will I get it to work or should I tell them to buy a more up to date server?


How can I explain object-oriented programming to someone who's only coded in Fortran 77?

My mother did her college thesis in Fortran, and now (over a decade later) needs to learn c++ for fluids simulations. She is able to understand all of the procedural programming, but no matter how hard I try to explain objects to her, it doesn't stick. (I do a lot of work with Java, so I know how objects work) I think I might be explaining it in too high-level ways, so it isn't really making sense to someone who's never worked with them at all and grew up in the age of purely procedural programming. Is there any simple way I can explain them to her that will help her understand?


Do you count a Masters in CS as a negative?

In my experience interviewing developers I feel like candidates who've achieved a Masters in Comp Sci tend to be **worse** programmers on average that those who don't have a Masters. Is that just me, or have others noticed this phenomenon? If so, why would that be the case? **UPDATE** I appreciate the thoughtful comments. I think I should have been clearer in the comparison I'm making. Given two candidates who graduated from college around the same time, someone who went on to gain a Masters seems on average to be a worse programmer than someone who spent all their time in industry.


Data Transfer Best Practices

At my company we have some vendors that we transfer data to and from. Sometimes the data is pulled into our local SQL database for business reporting. Other times we pull data from one vendor, transform it, and then transfer it to another vendor's FTP server. The guy I replaced has a couple of generic SFTP Push/Pull console applications that transfer data to/from these vendors. Then he has other applications that do the data imports to the SQL database or transforms the data and leaves it out in a directory to be pushed to the vendor. Every once in a while we will have problems with these processes not finding the file needed and I have to go back and run these manually to load the data. It seems to me that it would be more reliable if these processes just did their own FTP push/pull functions so we don't run into scheduling problems. Are there any standard practices that I can implement that would be more reliable or do I need to just _tweak_ what I have now? I'm in a Windows/.NET environment by the way.


Are Interfaces with Java 8 Virtual Extension Methods the Same Thing as Mixins?

This post describes a new feature in Java 8 called virtual extension methods (formerly called default methods, or defender methods). In the example provided, an interface has one method, which is implemented by a class. Then a second method is added, but instead of forcing the class to immediately implement the interface's new method, a "virtual extension method" is created within the interface as an implementation of this new method, thus the class doesn't need to implement the new method right away. But say that the programmer decides to create a virtual extension method in an interface and never plans to have subclasses implement its own version. Wouldn't that be a mixin? It seems like one to me, but I've never heard it referred to as such. Is there some fundamental difference that I'm not understanding?


How does Google store search trends in backend?

Google trends shows what query has been searched how many times and some other properties of the said query. But how is this data stored in a database? Storing a new row for every search does not seem right. They also tell the query on a time graph, so they must have some way to look for individual searches made by users, but the number of queries they get every day, it does not feel right that they would store every search in a database row along with a time-stamp. This does not apply to just Google trends or Google in general but any other big site that gets awful number of queries and then has tools to see them in depth. I am not an expert on this but I am interested to know some high level structure of how things work behind the scenes.


I would like to contribute my time for free to a Ruby open source project, what are some beginner friendly Ruby projects?

I think I am at a point where I can truly contribute to a Ruby open source project, can you suggest one or more that would be open to having a true beginner contribute. This would be my first group project where I would like to be 'mentored' or something similar by a more experienced coder. I would be able to work in my free-time and for free.