comparison

Programming Languages Comparison: when to choose C, C++, C#, Java, PHP, Python, Perl, Delphi, ...

I have to build a new webapp. My simple question is: How can I choose my programming language according to my needs? Someone can help me building a Programming Language Comparison? ...

Is MEF Microsoft's version of Lua?

I see parallels between MEF and Lua. Both allow you to register methods and deploy as you need. Are both MEF and Lua forms of IoC / Dependency Injection? ...

Should we compare floating point numbers for equality against a *relative* error?

So far I've seen many posts dealing with equality of floating point numbers. The standard answer to a question like "how should we decide if x and y are equal?" is abs(x - y) < epsilon where epsilon is a fixed, small constant. This is because the "operands" x and y are often the results of some computation where a rounding error is in...

Thorough use of 'if' statements or 'try/catch' blocks?

Give me some of your thoughts on which is a better coding practice/makes more efficient code/looks prettier/whatever: Increasing and improving your ability to use if statements to anticipate and catch potential problems? Or simply making good use of try/catch in general? Let's say this is for Java (if it matters). Edit: I'm presentl...

C# decimal.compare vs. > or <

What would be the benefit of using decimal.compare vs. just using a > or < to compare to variables? ...

Equality comparison -- any saner way?

How do I implement this equality comparison is a sane java way? boolean x = (a == b) || (a.equals(b)) I want to make sure the content of both objects is equal but null is also ok, i.e. both can be null and are thus equal. Update: just to be clear, I have to implement this comparison several times and don't want to copy&paste this...

Is Django Development faster than ASP.NET for small/medium-size apps?

This is one of the things I've been hearing in Django VS ASP.NET discussion. I personally find it hard to believe but I never tried Django. So my question is: assuming that I am equally familiar with both python and the .NET framework but I do not know anything about Django or ASP.NET (with Visual Studio), is Django faster than ASP.NET ...

Efficient algorithm for comparing XML nodes

Hi, I want to determine whether to different child nodes within an XML document are equal or not. Two nodes should be considered equal if they have the same set of attributes and child notes and all child notes are equal, too (i.e. the whole sub tree should be equal). The input document might be very large (up to 60MB, more than a 1000...

Functional programming: state vs. reassignment

I need help getting my head around the difference between my current OOP notion of state, and the way it would be done in a functional language like Haskell or Clojure. To use a hackneyed example, let's say we're dealing with simplified bank account objects/structs/whatever. In an OOP language, I'd have some class holding a reference ...

C# vs Java generics

I have heard that the Java implementation of Generics is not as good as the C# implementation. In that the syntax looks similar, what is it that is substandard about the Java implementation, or is it a religious point of view? ...

What's quicker at resolving, DataSet.Tables or Dictionary<string, Tables>

I am creating a mock database for import export tests (of the algorithm reading and writing complex data structures to our database, not just to test IO operations), and am trying to decide whether to use a DataSet to store the mock tables (by table name) in the faux-database, or Dictionary() In terms of retrieving a datatable by name, ...

Python - doctest vs. unittest

I'm trying to get started with unit testing in Python and I was wondering if someone could inform me of the advantages and disadvantages of doctest and unittest. What conditions would you use each for? ...

Comparing generic fields

I have some generic types, like the following: public struct Tuple<T1, T2> { ... } public struct Tuple<T1, T2, T3> { ... } etc. These should in theory be able to compare themselves against other values of the same type, so that I can write the following type of code: List<Tuple<Type, String>> l = new List<Tuple<Type, String>>(); l.Ad...

How do *you* use XML within the world of web applications?

Background I'm researching the efficiency of messaging within contemporary web applications, examining the use of alternatives to XML. This is a university project whose results will be released publicly - the greater the participation of the community, the greater the value of the results that are given back. I need as many real-life e...

Differences between System V and Posix semaphores.

What are the trade-offs between using a System V and a Posix semaphore? ...

Which common features of desktop applications do most web applications miss?

Stackoverflow User Luke wrote in this answer: The boundaries between desktop and web applications have really blurred. Whilst once upon a time the nature of developing for the web was totally different to developing for the desktop, nowadays you find the same concepts [...] cropping up in both. Since I am continually lo...

How do you compare DateTime objects using a specified tolerance in C#?

By default C# compares DateTime objects to the 100ns tick. However, my database returns DateTime values to the nearest millisecond. What's the best way to compare two DateTime objects in C# using a specified tolerance? Edit: I'm dealing with a truncation issue, not a rounding issue. As Joe points out below, a rounding issue would introd...

Emacs equivalent of Vim's command history (for typed in Meta-x commands)

Question: For typed in commands invoked via M-x I am having difficulty understanding how Emacs allows recalling and rerunning the commands. The command-history works quite differently from Vim. It puts the commands in a buffer rather than the "minibuffer". Is there a way to get something similar to Vim's approach (i.e., previously typed...

How can I ignore accents when comparing strings in Perl?

I have this quiz application where I match what people type with the right answer. For now, what I do is basically that : if ($input =~ /$answer/i) { print "you won"; } It's nice, as if the answer is "fish" the user can type "a fish" and be counted a good answer. The problem I'm facing is that, well, my users as I are french, an...

What does System.Collections.Generic.Dictionary<T,T>.Equals actually do?

I ran into this today when unit testing a generic dictionary. System.Collections.Generic.Dictionary<int, string> actual, expected; actual = new System.Collections.Generic.Dictionary<int, string> { { 1, "foo" }, { 2, "bar" } }; expected = new System.Collections.Generic.Dictionary<int, string> { { 1, "foo" }, { 2, "bar" } }; Assert.AreEqu...