language-agnostic

Most Unpleasant Programming Task You've Had to Do

What is the most unpleasant programming task you've ever had to do? This could be an assignment from a job, or a project or homework assignment for a class. Dimensions of unpleasantness can include annoying, boring, tedious, being uncreative, requiring no thought but lots of menial coding. ...

What is the best way to tell an excellent programmer in a job interview?

In the setting of an interview: What is the best way to reliably identify when somebody is an excellent programmer. By this I mean he is one of those that is 10-15 times more efficient / rapid / better than his peers towards the lower end of the spectrum. Many of us have heard of the FizzBuzz Problem as a way to weed out the weak ones...

How do you share configuration information or business rules between languages

I'm looking for best practices for using the same data in different places without repeating yourself - this could include configuration or business rules. Example 1. Data validation rules where you want to validate on the client using javascript, but you want to make sure by validating on the server. Example 2. Database access where y...

What is a "Unit"?

In the context of unit testing, what is a "unit"? ...

How do you come up with names for your namespaces?

I'll preface this by saying that I usually work in C#/.Net. Normally, I use a naming scheme that puts common, reusable components into a namespace that reflects our organization and project-specific components into a namespace tied to the project. One of the reasons I do this is that I sometimes share my components with others outside ...

How to Report Bugs the Smart Way

I want to write (or find) a guide to effective bug reporting in a style similar to ESR's How To Ask Questions The Smart Way What are your top tips for effective bug reports? ...

UML : Internal class in a class diagram

In a class diagram, is there a way of specifying that a class is an internal class of another class ? Or is it considered as a pure implementation choice ? ...

What are the best uses for each programming language?

I come from a web developer background, so I'm fairly familiar with PHP and JavaScript, but I'd eventually like to branch out into other languages. At this point, I don't have a particular direction or platform that I'm leaning toward as far as learning a new language or what I would use it for, but I would like to learn a little bit mor...

Worst "muscle memory" keyboard shortcut?

What's the worst shortcut you have in your "muscle memory"? For example, mine is CTRL-L: compiles the current object in Sybase Powerbuilder, but deletes the current line in Visual Studio. ...

How to determine path from noisy X, Y data

I have an unsorted list of noisy X, Y points. They do, however, form a path through the world. I would like an algorithm to draw an approximation of this data using line segments. This is similar to how you would use a line -fitting algorithm to pick an approximation of linear data. My problem is only harder because the path bends and w...

Which open source project would you recommend contributing to?

What open source projects would you recommend as a good place for a starting open source developer? Factors that I think would be important are some obvious ones like well written code and a community that is helpful to newbies. But it might be nice if the code base is such that I can start hacking some small problems without really unde...

When should I optimize?

They say "Premature optimization is the root of all evil".. so what's the best point in time for optimization? ...

How to convince my boss to do refactoring?

Hi All, We (developers) think we should do large grand refactoring in our project, because: With long time (more than 1 year) bug fixing too much hard code/hard logic been involved. Pickup one piece of code, nobody in this big team can confidentially tell you what will happen if you change that, because code are sticked together. We a...

Which coding style you use for ternary operator?

I keep it in single line, if it's short. Lately I've been using this style for longer or nested ternary operator expressions. A contrived example: $value = ( $a == $b ) ? 'true value # 1' : ( $a == $c ) ? 'true value # 2' : 'false value'; Personally which style you use, or find ...

Calculating a 2D Vector's Cross Product

From wikipedia: the cross product is a binary operation on two vectors in a three-dimensional Euclidean space that results in another vector which is perpendicular to the plane containing the two input vectors. Given that the definition requires at least three dimensions, how does one calculate the cross product of two 2d vectors?...

Are there open source CAPTCHA solutions available?

I'm in the process of adding CAPTCHA validation to one of my websites and need to know what open source solutions exist. Please note strengths and weaknesses and what platform they work with. I'm primarily interested in ASP.NET solutions but feel free to include PHP, Java, etc. ...

Case (or switch) in a for loop or for loop in a case (or switch)?

Can it be known in general whether or not placing a case within a for loop will result in bad assembly. I'm interested mainly in Delphi, but this is an interesting programming question, both in terms of style and performance. Here are my codez! case ResultList.CompareType of TextCompareType: begin LastGoodIndex := -1; ...

Learning/Implementing Design Patterns (For Newbies)

I'm a confused newbie and hobbyist programmer trying to get a grip on this, so forgive me if my question is a little off or doesn't make much sense. I see a lot of questions on SO revolving around the use of design patterns, and I'm wondering if anyone has a good resources for learning about, and implementing design patterns? I understa...

What are "first class" objects?

When are objects or something else said to be "first class" in a given programming language, and why? In what do they differ from languages where they are not? EDIT. When one says "everything is an object" (like in Python), does he indeed mean that "everything is first-class"? ...

Algorithm to find if two sets intersect

Let's say I have two arrays: int ArrayA[] = {5, 17, 150, 230, 285}; int ArrayB[] = {7, 11, 57, 110, 230, 250}; Both arrays are sorted and can be any size. I am looking for an efficient algorithm to find if the arrays contain any duplicated elements between them. I just want a true/false answer, I don't care which element is sh...