tagged [language-agnostic]

Database, Table and Column Naming Conventions?

Database, Table and Column Naming Conventions? Whenever I design a database, I always wonder if there is a best way of naming an item in my database. Quite often I ask myself the following questions: ...

What are bitwise shift (bit-shift) operators and how do they work?

What are bitwise shift (bit-shift) operators and how do they work? I've been attempting to learn C in my spare time, and other languages (C#, Java, etc.) have the same concept (and often the same oper...

When do you design the GUI first and the backend code later, or vice versa?

When do you design the GUI first and the backend code later, or vice versa? When I'm working on a project, sometimes I'll design the GUI first and then write the backend code to make it work, but othe...

9 Oct at 09:51

Way to go from recursion to iteration

Way to go from recursion to iteration I've used recursion quite a lot on my many years of programming to solve simple problems, but I'm fully aware that sometimes you need iteration due to memory/spee...

What is the difference between value types and primitive types?

What is the difference between value types and primitive types? Reading a book about C# I noticed that sometimes is mentioned value type and sometimes primitive type for some data type (e.g. int, doub...

15 Nov at 08:29

When to use unsigned values over signed ones?

When to use unsigned values over signed ones? When is it appropriate to use an unsigned variable over a signed one? What about in a `for` loop? I hear a lot of opinions about this and I wanted to see ...

7 Jul at 15:23

how to always round up to the next integer

how to always round up to the next integer i am trying to find total pages in building a pager on a website (so i want the result to be an integer. i get a list of records and i want to split into 10 ...

31 Jan at 00:29

How to parse relative time?

How to parse relative time? This question is the other side of the question asking, "[How do I calculate relative time?](https://stackoverflow.com/questions/11/how-do-i-calculate-relative-time)". Give...

22 Apr at 16:0

Interface vs Base class

Interface vs Base class When should I use an interface and when should I use a base class? Should it always be an interface if I don't want to actually define a base implementation of the methods? If ...

What is the difference between concurrent programming and parallel programming?

What is the difference between concurrent programming and parallel programming? What is the difference between concurrent programming and parallel programing? I asked google but didn't find anything t...

Why are function pointers not considered object oriented?

Why are function pointers not considered object oriented? In the C# language specifications it explicitly states: > Delegates are similar to the concept of function pointers found in some other lang...

20 Apr at 17:45

Resources for getting started with web development?

Resources for getting started with web development? Let's say I woke up today and wanted to create a clone of StackOverflow.com, and reap the financial windfall of millions $0.02 ad clicks. Where do I...

6 May at 20:26

How to minimize bugs invoked by programmer's manual input?

How to minimize bugs invoked by programmer's manual input? Sometimes all we have to work with manual input, not relying on Intellisense - with components, XML, other declarative things, strings, dynam...

28 Aug at 07:15

Why shouldn't I use "Hungarian Notation"?

Why shouldn't I use "Hungarian Notation"? I know what Hungarian refers to - giving information about a variable, parameter, or type as a prefix to its name. Everyone seems to be rabidly against it, ev...

How do libraries in different programming languages handle Date & Time, Timestamps & Durations, Leapseconds & -years, DSTs & Timezones, ...?

How do libraries in different programming languages handle Date & Time, Timestamps & Durations, Leapseconds & -years, DSTs & Timezones, ...? Is there a standard body or a specific normative way how ti...

23 Sep at 07:47

Is a double really unsuitable for money?

Is a double really unsuitable for money? I always tell in c# a variable of type double is not suitable for money. All weird things could happen. But I can't seem to create an example to demonstrate so...

25 Nov at 10:52

Difference between Hashing a Password and Encrypting it

Difference between Hashing a Password and Encrypting it The current top-voted to [this question](https://stackoverflow.com/questions/325862/what-are-the-most-common-security-mistakes-programmers-make)...

Why are const parameters not allowed in C#?

Why are const parameters not allowed in C#? It looks strange especially for C++ developers. In C++ we used to mark a parameter as `const` in order to be sure that its state will not be changed in the ...

15 Jan at 12:35

Should I throw on null parameters in private/internal methods?

Should I throw on null parameters in private/internal methods? I'm writing a library that has several public classes and methods, as well as several private or internal classes and methods that the li...

Good Practice: Loop And If statement

Good Practice: Loop And If statement [https://codereview.stackexchange.com/questions/1747/good-practice-loop-and-if-statement](https://codereview.stackexchange.com/questions/1747/good-practice-loop-an...

13 Apr at 12:40

Getting parts of a URL (Regex)

Getting parts of a URL (Regex) Given the URL (single line): [http://test.example.com/dir/subdir/file.html](http://test.example.com/dir/subdir/file.html) How can I extract the following parts using reg...

13 Jan at 11:34

C# logic order and compiler behavior

C# logic order and compiler behavior In C#, (and feel free to answer for other languages), what order does the runtime evaluate a logic statement? Example: Which statement does the runtime evaluate fi...

Shortest distance between a point and a line segment

Shortest distance between a point and a line segment I need a basic function to find the shortest distance between a point and a line segment. Feel free to write the solution in any language you want;...

Why are relational set-based queries better than cursors?

Why are relational set-based queries better than cursors? When writing database queries in something like TSQL or PLSQL, we often have a choice of iterating over rows with a cursor to accomplish the t...

Simple Deadlock Examples

Simple Deadlock Examples I would like to explain threading deadlocks to newbies. I have seen many examples for deadlocks in the past, some using code and some using illustrations (like the famous [4 c...

What is a good Hash Function?

What is a good Hash Function? What is a good Hash function? I saw a lot of hash function and applications in my data structures courses in college, but I mostly got that it's pretty hard to make a goo...

2 Sep at 12:5

Free text search integrated with code coverage

Free text search integrated with code coverage Is there any tool which will allow me to perform a free text search over a system's code, but only over the code which was actually executed during a par...

Converting RGB to grayscale/intensity

Converting RGB to grayscale/intensity When converting from RGB to grayscale, it is said that specific weights to channels R, G, and B ought to be applied. These weights are: 0.2989, 0.5870, 0.1140. It...

Followup: "Sorting" colors by distinctiveness

Followup: "Sorting" colors by distinctiveness [Original Question](https://stackoverflow.com/questions/180/function-for-creating-color-wheels) If you are given N maximally distant colors (and some asso...

23 May at 12:26

Private vs Protected - Visibility Good-Practice Concern

Private vs Protected - Visibility Good-Practice Concern I've been searching and I know the theoretic difference. - - - That's all fine and well, the question is, what's the difference between them? Wh...

23 Aug at 16:31

What is the preferred method for handling unexpected enum values?

What is the preferred method for handling unexpected enum values? Suppose we have a method that accepts a value of an enumeration. After this method checks that the value is valid, it `switch`es over ...

6 Mar at 18:38

Best way to display default image if specified image file is not found?

Best way to display default image if specified image file is not found? I've got your average e-Commerce app, I store ITEM_IMAGE_NAME in the database, and sometimes managers MISSPELL the image name. T...

28 Oct at 09:19

Smaller SpreadsheetML files through Excel 2007

Smaller SpreadsheetML files through Excel 2007 I have a SpreadsheetML file that I am generating server-side. Such files are rather large, in contrast to Excel 2007 files, which make use of zip. So, I ...

7 Aug at 18:22

Getting the closest string match

Getting the closest string match I need a way to compare multiple strings to a test string and return the string that closely resembles it: (If I did this correctly) The closest st

What is wrong with using DateTime.Now. as main part of Unique ID?

What is wrong with using DateTime.Now. as main part of Unique ID? I used to use `RNGCryptoServiceProvider` to generate string-based Order ID's, but, there were 4 instances where `ABCDEFGHIJKLMNOPQRSTU...

Array versus linked-list

Array versus linked-list Why would someone want to use a linked-list over an array? Coding a linked-list is, no doubt, a bit more work than using an array and one may wonder what would justify the add...

How many parameters are too many?

How many parameters are too many? Routines can have parameters, that's no news. You can define as many parameters as you may need, but too many of them will make your routine difficult to understand a...

15 Nov at 14:27

Should I avoid do/while and favour while?

Should I avoid do/while and favour while? > [Test loops at the top or bottom? (while vs. do while)](https://stackoverflow.com/questions/224059/test-loops-at-the-top-or-bottom-while-vs-do-while) [Whi...

23 May at 10:33

What technology problems arise from creating a markup language for email?

What technology problems arise from creating a markup language for email? I am wondering what technology problems arise from associating a markup language to email? Without examining the language let ...

What does it mean to "program to an interface"?

What does it mean to "program to an interface"? I have seen this mentioned a few times and I am not clear on what it means. When and why would you do this? I know what interfaces do, but the fact I am...

22 Jan at 03:45

Do you use 1-3 letters variables EVERYWHERE?

Do you use 1-3 letters variables EVERYWHERE? I notice, in C# i use very short variable names EVERYWHERE. My code is polluted with I dont know if this is bad or ok. I can certain

OOP: Where to stop Abstracting

OOP: Where to stop Abstracting Where do you draw the line to stop making abstractions and to start writing sane code? There are tons of examples of 'enterprise code' such as the dozen-file "FizzBuzz" ...

20 Oct at 10:11

How do you mock a Sealed class?

How do you mock a Sealed class? [Mocking sealed classes](http://www.google.com/search?q=how%20to%20mock%20sealed%20class) can be quite a pain. I currently favor an [Adapter pattern](http://en.wikipedi...

How to display local time of the browser in a web app

How to display local time of the browser in a web app I am writing a web app and I would like to display timestamps on the page in the user's localtime. There seems to be several ways to do this but i...

20 Oct at 07:7

What's the difference between an argument and a parameter?

What's the difference between an argument and a parameter? When verbally talking about methods, I'm never sure whether to use the word or or something else. Either way the other people know what I mea...

Modelling an elevator using Object-Oriented Analysis and Design

Modelling an elevator using Object-Oriented Analysis and Design There are a set of questions that seem to be commonly-used in interviews and classes when it comes to object-oriented design and analysi...

Looking for examples of "real" uses of continuations

Looking for examples of "real" uses of continuations I'm trying to grasp the concept of continuations and I found several small teaching examples like this one from the [Wikipedia article](http://en.w...

How to robustly, but minimally, distribute items across a peer-to-peer system

How to robustly, but minimally, distribute items across a peer-to-peer system If one has a peer-to-peer system that can be queried, one would like to - - - - Given these requirements: 1. Are there any...

Project Euler Question 3 Help

Project Euler Question 3 Help I'm trying to work through Project Euler and I'm hitting a barrier on problem 03. I have an algorithm that works for smaller numbers, but problem 3 uses a very, very larg...

22 Jan at 16:17

Using pen strokes with fuzzy tolerance algorithm as encryption key

Using pen strokes with fuzzy tolerance algorithm as encryption key How can I encrypt/decrypt with fuzzy tolerance? I want to be able to use a Stroke on an InkCanvas as key for my encryption but when d...