many (3,728)


performance - What is the fastest way to get the value of π?

performance - What is the fastest way to get the value of π?

I'm looking for the fastest way to obtain the value of π, as a personal challenge. More specifically, I'm using ways that don't involve using#define constants like M_PI,or hard-coding the number in. T…


Unit tests for deep cloning

Let's say I have a complex.NET class, with lots of arrays and other class object members. I need to be able to generate a deep clone of this object-so I write a Clone() method, and implement it w…


language agnostic - What is the prefered style for single decision and action statements?

In the case of languages that support single decision and action without brackets, such as the following example: if(var== true) doSomething(); What is the preferred way of writing this? Shoul…


What are the advantages of using a single database for EACH client?

In a database-centric application that is designed for multiple clients, I've always thought it was "better" to use a single database for ALL clients-associating records with proper indexes and keys.…



Reserved Keyword in Enumeration in C#

I would like to use as and is as members of an enumeration. I know that this is possible in VB.NET to write it like this: Public Enum Test[as]=1[is]=2 End Enum How do I write the equiva…


JavaScript and Threads

Is there some way to do multi-threading in JavaScript?…


multithreading - How do you minimize the number of threads used in a tcp server application?

I am looking for any strategies people use when implementing server applications that service client TCP(or UDP) requests: design patterns, implementation techniques, best practices, etc. Let's assu…


How do I change the number of open files limit in Linux?

When running my application I sometimes get an error about too many files open. Running ulimit-a reports that the limit is 1024. How do I increase the limit above 1024? Edit ulimit-n 2048 results…


language agnostic - Should a function have only one return statement?

Are there good reasons why it's a better practice to have only one return statement in a function? Or is it okay to return from a function as soon as it is logically correct to do so, meaning there m…


How do I calculate PI in C#?

How can I calculate the value of PI using C#? I was thinking it would be through a recursive function, if so, what would it look like and are there any math equations to back it up? I'm not too fussy…




how one example multiple with relationship key too java can