Questions tagged [error-checking]

151 questions
299
votes
5 answers

What is the canonical way to check for errors using the CUDA runtime API?

Looking through the answers and comments on CUDA questions, and in the CUDA tag wiki, I see it is often suggested that the return status of every API call should checked for errors. The API documentation contains functions like cudaGetLastError,…
talonmies
  • 70,661
  • 34
  • 192
  • 269
28
votes
9 answers

How to generate a verification code/number?

I'm working on an application where users have to make a call and type a verification number with the keypad of their phone. I would like to be able to detect if the number they type is correct or not. The phone system does not have access to a list…
Costo
  • 5,940
  • 8
  • 33
  • 35
16
votes
1 answer

How to execute error checking on multiple PHP files simultaneously?

I have an svn server that I checkout the repository in my computer. The main repositiry has about 2k files 3rd party generic code classes custom classes I have made changes to lots of files (mainly php) and I want to make sure they are all valid…
aki
  • 1,241
  • 2
  • 13
  • 43
9
votes
1 answer

Passing size as argument VS assuming shape in Fortran procedures

I'm trying to decide which one of these two options would be the best: subroutine sqtrace( Msize, Matrix, Value ) integer, intent(in) :: Msize real*8, intent(in) :: Matrix(Msize, Msize) real*8, intent(out) :: Value …
Nordico
  • 1,226
  • 2
  • 15
  • 31
9
votes
5 answers

How can I use VBA to ignore green triangle error in range without looping cell by cell?

I have some large data sets that I am automating and distributing. I want to eliminate the little green triangles that warn the user about numbers stored as text. I have used the following code but it's VERY slow on massive sheets. …
Johnson Jason
  • 671
  • 1
  • 13
  • 29
8
votes
5 answers

What algorithm to use to calculate a check digit?

What algorithm to use to calculate a check digit for a list of digits? The length of the list is between 8 and 12 digits. see also: How to generate a verification code/number?
Piotr Dobrogost
  • 41,292
  • 40
  • 236
  • 366
7
votes
1 answer

How to ensure that all arguments are provided in Apache Commons CLI?

I don't see a standard way of checking if all Options are provided in a String[] input to apache's CLI library . That is - my options are all REUIRED at the command line, otherwise, i want an exception to throw. Im trying the following as a…
jayunit100
  • 17,388
  • 22
  • 92
  • 167
7
votes
1 answer

Xcode. Question about syntax error checking

Xcode looked at this line and did not complain. Project built, code crashed at runtime. NSString *randomName = [NSString stringWithFormat:@"%@, %@, %@", [randomAjectiveList objectAtIndex:ajectiveIndex], …
James Raitsev
  • 92,517
  • 154
  • 335
  • 470
7
votes
5 answers

Gray code in .NET

Is there a built in Gray code datatype anywhere in the .NET framework? Or conversion utility between Gray and binary? I could do it myself, but if the wheel has already been invented...
tbischel
  • 6,337
  • 11
  • 51
  • 73
7
votes
2 answers

Being extremely pedantic with the way your code is compiled

I would like to find out which is the most extreme error checking flag combination for g++ (4.7). We are not using the new C++11 specification, since we need to cross compile the code with older compilers, and these older compilers (mostly g++ 4.0)…
Ferenc Deak
  • 34,348
  • 17
  • 99
  • 167
6
votes
2 answers

Any reason to use a run-time assert instead of compile-time assert?

While reviewing Visual C++ codebase I found a following strange thing. A run-time assert (which is check the condition and throw an exception if the condition is violated) was used in a case when the condition could be evaluated at compile…
sharptooth
  • 167,383
  • 100
  • 513
  • 979
6
votes
1 answer

Prolog error arguments

I'm wondering how to go about adding error checking in Prolog. For instance I have a program that will find how long a list is: listlen([],0). listlen([_|T],N) :- listlen(T,X), N is X+1. How would I print out an error like "The 1st argument…
Asia x3
  • 606
  • 2
  • 16
  • 37
6
votes
4 answers

Creating an empty directory (NSIS)

How can I do it by NSIS 2.46? I know this is probably a dumb question, but how the heck do I create an empty directory and check for errors? I do so: ClearErrors CreateDirectory $R1 ${If} ${Errors} DetailPrint "failed" MessageBox…
6
votes
5 answers

Error checking overkill?

What error checking do you do? What error checking is actually necessary? Do we really need to check if a file has saved successfully? Shouldn't it always work if it's tested and works ok from day one? I find myself error checking for every little…
James
  • 273
  • 2
  • 12
5
votes
4 answers

Checking if an array is 'right' (C++)

A right array Let's assume we have an array with an N length, made of capital letters A, B, and C. We call the array 'a right array' if between every two C letters which come one after another in the array, there are more A letters than B…
N.T.
  • 99
  • 6
1
2 3
10 11