Frustration with useless error messages
DHawthorne
Posts: 4,584
in AMX Hardware
The following is a snippet of a device log in one of my systems:
Note lines 703 and 704. I left the surrounding lines in to show there are no errors before or after. Clearly, I have an array indexing error, but I absolutely cannot find it from that information. Nothing is obviously malfunctioning, and the source code has 26 module files and 28 include files. The error message doesn't even tell me so much as the name of the array with the problem. The line number data is equally useless, as it doesn't tell me which module the error is in (it's not the master code, that line resolves to a structure declaration). If it did, it wouldn't account for code inserted by includes, making it that much harder to find. I am extremely frustrated with this; I'm just waiting for this error to bite me in the butt, and I have absolutely no way of tracking it down. My log is echoing all panel page flips, as well as wakeup and sleep notifications; it's not associated with an action on any of the panels. I don't even know if it's my error or an error in a module downloaded from AMX (to say nothing of which module).696: 11-30-2005 WED 13:50:35 Interpreter
CIpEvent::OffLine 0:7:1
697: 11-30-2005 WED 13:50:35 Interpreter
Exiting TCP Read thread - closing this socket for local port 7
698: 11-30-2005 WED 13:50:35 Interpreter
CIpEvent::OnLine 0:7:1
699: 11-30-2005 WED 13:50:34 SocketManager
Connected Successfully
700: 11-30-2005 WED 13:50:31 Interpreter
CIpEvent::OffLine 0:7:1
701: 11-30-2005 WED 13:50:31 Interpreter
Exiting TCP Read thread - closing this socket for local port 7
702: 11-30-2005 WED 13:50:31 Interpreter
GetNumber - Error 1 Tk=0x0000
703: 11-30-2005 WED 13:50:31 Interpreter
DoNumberExpression - Error 2 Tk=0x2008 Line=249
704: 11-30-2005 WED 13:50:31 Interpreter
Ref Error ? Index 0 Line=249
705: 11-30-2005 WED 13:50:31 Interpreter
CIpEvent::OnLine 0:7:1
706: 11-30-2005 WED 13:50:30 SocketManager
Connected Successfully
707: 11-30-2005 WED 13:50:28 Interpreter
CIpEvent::OffLine 0:7:1
708: 11-30-2005 WED 13:50:27 Interpreter
Exiting TCP Read thread - closing this socket for local port 7
709: 11-30-2005 WED 13:50:26 Interpreter
CIpEvent::OnLine 0:7:1
0
Comments
have you an internet connection ? or did you use the max without internet connection ?
AFAIK the Open/Close issue was a protocol need on the IMS/MMS servers, and is still done wth the new products.
I try to find out if the least bit of a CHAR is 0 or 1 and I would like to do so for all bits. As I am not so familiar with shift operators, I tried like this:
IF((1 & MID_STRING(myString,4,1))==1)
IF((2 & MID_STRING(myString,4,1))==2)
and so on.
I get the following errors at runtime:
DoNumberExpression - Error 2 Tk=0x2010 Line=345
GetNumber - Error 1 Tk=0x0000
anyone knows these???
Not tried in a master, but maybe it's a problem of MID_STRING, which gives you a String of length 1 instead a single char, so you cand do a BAND.
Some kind of conserverative solution....
IF(myString[4] BAND $01) {} // bit 0
IF(myString[4] BAND $02) {} // bit 1
IF(myString[4] BAND $04) {} // bit 2
IF(myString[4] BAND $08) {} // bit 3
IF(myString[4] BAND $10) {} // bit 4
IF(myString[4] BAND $20) {} // bit 5
IF(myString[4] BAND $40) {} // bit 6
IF(myString[4] BAND $80) {} // bit 7
Pushing button 1 will produce the following output:
Line 1 :: Bit 0 is NOT set in the number $AA - 07:09:33
Line 2 :: Bit 1 IS set in the number $AA - 07:09:33
Line 3 :: Bit 2 is NOT set in the number $AA - 07:09:33
Line 4 :: Bit 3 IS set in the number $AA - 07:09:33
Line 5 :: Bit 4 is NOT set in the number $AA - 07:09:33
Line 6 :: Bit 5 IS set in the number $AA - 07:09:33
Line 7 :: Bit 6 is NOT set in the number $AA - 07:09:33
Line 8 :: Bit 7 IS set in the number $AA - 07:09:33
I personally feel AMX has slipped on the development of NS2 and put way too much emphasis on VA. If I had to guess, the major money makers probably use NS2 and not VA, and it seems they (AMX) have forgotten where they should put their emphasis. I understand helping out the little guys or making it easier to develop systems - but hey, what about us?
Note: These are my views and opinions only and has nothing to do with the company I work for.
1<<bit takes the number 1 and shifts the bits to the left ?bit? number of times. Every time you shift to the left it multiplies the number by 2 (or 2 to the bit power).
In this function we want to create a mask that only has the bit in question set (we will use it to 0 out all of the bits of the number being tested except for the bit we want to check) and do a bitwise AND against the number and see if that?s equal to the mask. If it is then that means the bit is set. It?s probably easier to explain with an example and we might as well use the one I posted.
We start with a number. In this case we?ll test $AA and see if the least significant bit (bit 0) is set.
$AA = 10101010
We call the function as pass in $AA as the number and 0 as the bit.
1 = 00000001
1<<0 says take the number 1 and shift the bits to the left 0 number of times (or 2 to the 0 power which is 1 ? anything to the 0 power is 1)
00000001<<0 = 00000001
Now we do a bitwise AND with the number that was passed in and our mask and in this case the result = 0
10101010
00000001
00000000
00000000 <> 00000001 (1<<0) so that means that bit 0 is not set and the function returns 0.
Now let?s call the function again with $AA and test to see if bit 3 is set (the 4th bit from the right). We create our mask by shifting the bits to the left 3 times.
00000001<<3 = 00001000 (2 raised to the 3rd power = 8)
Now we do a bitwise AND with the number that was passed in and our mask:
10101010
00001000
00001000
And here we see that the bitwise AND of the number and the mask equals the mask so that means the bit is set and the function returns 1.
I?m not sure if I muddied the wasters further. It?s much easier to explain this on a chalkboard then typing it out. I did my best.
Damn - I like that a lot. Sure beats building an index of "powers of 2" ahead of time.
Of course, I'm so anal-retentive that I'd add an extra set of parens or two. I'm probably the only one that this makes a difference too though... For some reason I feel the need to see a boolean comparison set up as if it were in an "IF" statement.
- Chip
From what I've read, VA isn't even at a point where it can replace NS in terms of control system building software. But getting back to the point, error messages should be a lot more helpful. I never want to see "Major error occurred during code generation" again.
And I apologize to all for the Thread Drift... I just saaw something that I did not understand and wanted to ask about it.