danio
@danio
Best posts made by danio
Latest posts made by danio
-
RE: The MythTV protocol
@bobday said:
Next, ANNounce your intention to get a file:43 ANN FileTransfer Desktop[]:[]/some_file.png
You will get a string in response along these lines:25 OK[]:[]20[]:[]0[]:[]13987
This means that your transfer id is 20 and the file is 13987 bytes long.
You must re-send the ANNounce message to be able to read from the server:21 ANN Monitor Desktop 0
Finally, you can begin reading data (say, 42 bytes worth):46 QUERY_FILETRANSFER 20[]:[]REQUEST_BLOCK[]:[]42
At this point, with everything else in the protocol being performed with strings, you might think that perhaps the data will be encoded into hex or base64 or something. Nope, straight bytes across the wire, with no length prefix (no way of knowing how long the data will be). After the data has been sent, the server will tell you how much was sent - gee, thanks, that would have been nice to know before I had to allocate a buffer to hold it all.
Didn't you just ask it for 42 bytes of a 13987 byte transfer so that should give you enough to work out your buffer size?
Probably the size after transfer is a check so that you can compare how many it sent with how many it should have sent?
Seems pretty cumbersome but no worse than commercial systems I've worked with. At least you have access to the source code, whereas with badly documented commercial products it is just a matter of trial and error till you figure out what the documentation could have made clear in the first place...
-
RE: Hi! I'm your Oracle DBA.
@wiggzie said:
eh...I think you'll find it is perfectly acceptable grammar, idiot.
Please enable sarcasm detectors before posting on daily wtf forums...
-
RE: %$#$% Blocked!
@bobo1on1 said:
That url doesn't work.
you're obviously not at work! This was about 4 years ago and the url may have gone or more likely I remembered it wrong. Not one of my regular sites ;-)
-
RE: %$#$% Blocked!
cooldudman - what was the url? Why'd you black it out - was it teenfarmyardxxx.com? Found that in the browser history of a laptop once that we were testing for a colleague. Every time I saw him afterwards all I could think about was his penchant for animals and young girls...
-
RE: Visual Studio wtf
Yes - also the accented I's (CD) on the same line are different to the ones on the line below, and the R next to the accented y is also quite strange.
I've never seen this before in the debugger. Wonder what caused it... -
Converting FOUR_CHAR_CODE / FOURCC to string
I have an error handler that deals with FOUR_CHAR_CODE('xxxx') type of errors from a library. The lib doesn't have any string definitions for the codes but I want to present something of the error in an arror message to aid tracking down errors.
Are there any standard macros to convert a four cc back to a string as I'm thinking the endianness may be platform specifi?. I can only find MAKEFOURCC in mmsystem.h to go from chars to fourcc. -
Visual Studio wtf
Just doing some debugging with VS 2003 and noticed some very strange fonts in the memory view: wtf??
If that direct image link didn't work try this: http://picasaweb.google.com/dan.pidcock/Misc/photo#4964534858493919250
-
RE: IsNumber function
@lampkin said:
I just thought the initial function was crazy, I don't even think it works properly? (yeh I woindered about threedot)
It looks like the original author didn't know of the ? syntax. Without ? they had to do the twodot stuff because they have two dot matches in the isReal matching string.
One thing the original does that yours doesn't is accept .7 or -.3 as a valid number. I reckon it can be minimized to this to match both int and float:
^-?\d*[.]?\d+$
@lampkin said:
I probably should just strip out the function. I wasn't sure if it they wanted it to check for floating point numbers (why I put the code to do it in brackets). IsNumber could imply, is whole number and there are many areas where only whole numbers should be allowed in this application.
If it is to match just integers then IsInteger() would be clearer. If I saw IsNumber() in code I wouldn't assume that it would reject a decimal as a number.
@lampkin said:
ed: I guess the reason I havn't stripped it out is because it is the kind of application where you darn't take something out for fear of the whole thing dieing.
I know what you mean. But you do have source control don't you? And if this is compiled code then the build will fail so you'll know to put it back in...
Oh yes just thought of another thing. This is fine for US and UK applications but what if you want to deploy to Europe where they use , as the decimal separator?
-
RE: IsNumber function
I don't see how your regex matches floating point numbers. It looks like you have to change the commented regex in by hand depending on whether you are matching integers or floats. That would be a wtf in itself!
And what about negative integers?
But if the function isn't used you should really just rip it out to clean the source tree.
As for the original function: it is very strange! I especially like the TwoDotPattern - what about ThreeDotPattern etc ;-)
It looks like the original function will accept just "-" as a valid integer: not sure if that is good or bad...
Having the sub regex strings named as strValidRealPattern & strValidIntegerPattern is nice though: self documenting code.