greater (1,065)


.net - Replacement for for… if array iteration

.net - Replacement for for… if array iteration

I love list comprehensions in Python, because they concisely represent a transformation of a list. However, in other languages, I frequently find myself writing something along the lines of: foreach…


c++ - What is the most effective way for float and double comparison?

What would be the most efficient way to compare two double or two float values? Simply doing this is not correct: bool CompareDoubles1(double A, double B){return A== B;}But something like: bool Compar…


Differences in string compare methods in C#

Comparing string in C# is pretty simple. In fact there are several ways to do it. I have listed some in the block below. What I am curious about are the differences between them and when one should…



Best way to convert DateTime to “n Hours Ago” in SQL

I wrote a SQL function to convert a datetime value in SQL to a friendlier "n Hours Ago" or "n Days Ago" etc type of message. And I was wondering if there was a better way to do it.(Yes I know "don'…


regex - Regular Expression to match valid dates

I'm trying to write a regular expression that validates a date. The regex needs to match the following M/D/YYYY MM/DD/YYYY Single digit months can start with a leading zero(eg: 03/12/2008) Single d…


C# switch: case not falling through to other cases limitation

This question is kind of an add-on to this question In C#, a switch case cannot fall through to other cases, this causes a compilation error. In this case I am just adding some number to the month t…


unix - How do I get the find command to print out the file size with the file name?

If I issue the find command as follows: $ find.-name*.ear It prints out:./dir1/dir2/earFile1.ear./dir1/dir2/earFile2.ear./dir1/dir3/earFile1.ear What I want to 'print' to the command line is…


c# - Multiple cases in switch statement

Is there a way to fall through multiple case statements without stating case value: repeatedly? I know this works: switch(value){case 1: case 2: case 3://do some stuff break;…


How do I use calculated value date in Sharepoint lists field to find a date+30 days?

I have a list I've built in Sharepoint, where one of the fields is a date that the user enters. I want to add another field, which is a calculated value field that needs to be the date provided by th…


WPF Datatrigger not firing when expected

I have the following XAML:<TextBlock Text="{Binding ElementName=EditListBox, Path=SelectedItems.Count}" Margin="0,0,5,0"/><TextBlock Text="items selected"><TextBlock.Style><Style…




than how compare string with date not multiple equal value