comparison

php operator <>

can someone explain this one to me? a link to something in the php manual even?? i can't find anything: if ($_SERVER['SERVER_PORT'] <> 443) { doSomething(); } ...

How is "20" and 20 considered equal in JavaScript?

I understand that using the "===" compares type, so running the following code results in "not equal" because it's comparing a number type to a string type. var a = 20; var b = "20"; if (a === b) { alert("They are equal"); } else { alert("They are not equal"); } But I dont understand how using the "==" to compa...

What should these comparisons return?

I've got an application that's using string.compare(string,string) to sort some values. The thing I can't figure out is why "1022" compares as less than "10-23" and "10-23" compares as less than "1024". Is there something specific to the value of "-" that causes this result? Will that overload of string.compare give the same result wi...

Search multiple list for missing entries

I have 3 lists, I will make them simple here. list of letters A B C list of numbers 1 2 3 Mixed A,1 A,2 B,2 B,3 C,1 C,3 I need to know what is missing: A,3 B,1 C,2 The list of letters has about 85 entries and the list of numbers has about 500 entries. The mixed list has about 75,000...

Should I install SQL Server 2008 on my DEV machine?

I'm wondering if I'll have trouble installing SQL Server 2008 on my development machine whilst our production server is 2005? E.g. is something change so that my 2005 databases/sps/functions/views will not work correctly or other issues I should think about? Would like to do this just to test drive the new SQL Server but still be able t...

Do you prefer verbose or shorthand languages

As the title of this post states. Would you prefer to use a language that is verbose or more shorthand? So would you prefer this: Dim myvar as string = "hello world" or this string myvar = "hello world" I know I just compared C# to VB but you get my drift, another example would be powershell where you can use the % sign to mean fo...

Java 6 language compared with C# 3.0 language

There exists a very good talk about C# vs. Java where H.Mössenböck compares the two languages. That's from 2003, C# 2.0 compared with Java 1.5. Can be found in German here: http://dotnet.jku.at/ What good resources exist, where actual language versions are compared? Or maybe post a comparison right here? My interests are: Advantages/...

What are the strongest features of Memcached?

In particular what strengths does it have over caching features of Asp.net ...

LINQ Distinct operator, ignore case?

Given the following simple example: List<string> list = new List<string>() { "One", "Two", "Three", "three", "Four", "Five" }; CaseInsensitiveComparer ignoreCaseComparer = new CaseInsensitiveComparer(); var distinctList = list.Distinct(ignoreCaseComparer as IEqualityComparer<string>).ToList(); It appears the CaseInsensit...

Differences between C++ and C#/.Net

If asked, how would you describe the differences between C++ and C#/.Net ...

Sorting algorithm for a non-comparison based sort problem?

I am currently faced with a difficult sorting problem. I have a collection of events that need to be sorted against each other (a comparison sort) and against their relative position in the list. In the simplest terms I have list of events that each have a priority (integer), a duration (seconds), and an earliest occurrence time that th...

How do I sync the results of a Web service with a DB?

I am looking for a way to quickly compare the state of a database table with the results of a Web service call. I need to make sure that all records returned by the Web service call exist in the database, and any records in the database that are no longer in the Web service response are removed from the table. I have to problems to sol...

What is the best way to compare XML files for equality?

I'm using .NET 2.0, and a recent code change has invalidated my previous Assert.AreEqual call (which compared two strings of XML). Only one element of the XML is actually different in the new codebase, so my hope is that a comparison of all the other elements will give me the result I want. The comparison needs to be done programmatica...

c++ enum to unsigned int comparison

I found this in the code I'm working on at the moment and thought it was the cause of some problems I'm having. In a header somewhere: enum SpecificIndexes{ //snip INVALID_INDEX = -1 }; Then later - initialization: nextIndex = INVALID_INDEX; and use if(nextIndex != INVALID_INDEX) { //do stuff } Debugging the code, t...

Python "is" operator behaves unexpectedly with integers

Why does the following behave unexpectedly in Python? >>> a = 256 >>> b = 256 >>> a is b True # this is an expected result >>> a = 257 >>> b = 257 >>> a is b False # what happened here? why is this False? >>> 257 is 257 True # yet the literal numbers compare properly I am using Python 2.5.2. Trying some di...

JavaScript Libraries - Side-by-Side Comparisons

Microsoft recently announced that they were endorsing jQuery as an "officially" supported JavaScript library. I certainly wouldn't argue that jQuery is a fantastic framework to work with. In fact, I just bought the book. But I'm curious to know why. Specifically, I'm interested to know whether or not we web developers can expect jQue...

Can anyone quantify performance differences between C++ and Java?

Java was initially slow before the JIT but today performance is pretty close to C++. I want to know if someone has done measurable performance comparisons between the two languages? Where does Java fall short when compared to C++? Java provides many productivity gains to developers so they can write applications much quicker because o...

Is Flex ready for prime time?

I'm working on a project that currently has zero users but we would like to scale up to potentially hundreds. Currently we are running on a MySQL database with AMFPHP interacting with Flex. We used Flex because of its robust graphic features (important to this project) and because the initial developer (not me) already knew ActionScrip...

How do you sort a generic list in C# and allow NULL items to appear first in the list?

I have a generic list of objects in C#, for example sake, here's what the object might be. public class Thing { public string Name { get; set; } public DateTime EditDate { get; set; } } var things = new List<Thing>(); Now I want to call: thing.Sort((t1, t2) => t1.EditDate.CompareTo(t2.EditDate)); However, some of my EditDa...

How do I do a case insensitive string comparison in Python?

What's the best way to do case insensitive string comparison in Python? I would like to encapsulate comparison of a regular strings to a repository string using in a very simple and pythonic way. I also would like to have ability to look up values in a dict hashed by strings using regular python strings. Much obliged for advice. ...