V2m file duration
category: code [glöplog]
@ Saga Musix: And you think I understand it better with a debugger? And yes, I read almost the complete article.
Hint:
Dim usecsVal As Double = usecs(0) * 256 + usecs(1) * 256 + usecs(2) * 256 * 256 + usecs(3) * 256 * 256 * 256
Wrong.
Dim usecsVal As Double = usecs(0) * 256 + usecs(1) * 256 + usecs(2) * 256 * 256 + usecs(3) * 256 * 256 * 256
Wrong.
The other way round?
Dim usecsVal As Double = usecs(0) * 256 * 256 * 256 + usecs(1) * 256 * 256 + usecs(2) * 256 + usecs(3)
Dim usecsVal As Double = usecs(0) * 256 * 256 * 256 + usecs(1) * 256 * 256 + usecs(2) * 256 + usecs(3)
:D
No, it's the right way around. Just take step back, look at the line and then look stlightly to the side so it's in the corner of your eye. You can really make out the mistake quaite easily if you don't stare too hard. :)
Also remember what you said: Sometimes the result is a little off. Knowing your symptoms is important.
perhaps the "*256" vals are wrong :D Dunno ... ^^
Please stop throwing breadcrumbs :D
That's the only way you learn it. Compare your code to Gargaj's. And more importantly, understand your code. You should know why the *256 is wrong.
And yes, a debugger would help you because you can quickly just step through the program and check all variable contents and compare them to expected values. Some people consider MessageBoxes to be just as good as real debugger, so make your choice.
No, this is called "teaching". Seeing a very obvious error in something you've written youself is much more valuable than correctly estimating the lenght of songs in an obsolete-since-10-years format. :P
But here's another idea: Delete the line and type it again WITHOUT copying. Chances are it'll work then. And if it does, compare the old and new line.
But here's another idea: Delete the line and type it again WITHOUT copying. Chances are it'll work then. And if it does, compare the old and new line.
Another useless breadcrumb: Funny, when you reversed the order above you didn't make the mistake that was in the original line. Also, you get maxtVal and fractVal right. Again, compare. Seriously.
usecs(0) * 256
take it as a lil sunday afternoon gift. ;)
OMG :D usecs(0) doesn´t need the factor^^ shit :D yumeji this was more helpful as the others together :P big thanks, you save my time :)
Quote:
big thanks, you save my time
And this is why he wasn't helpful at all. Seriously, YOU should have seen this.
And you never have overseen something? :) This has nothing to do with learning.
You still don't understand what kb trying to teach you.
That's why I told you to simply rewrite that line - that's eg. one of the things I've learned when you keep staring at something very simple that wouldn't work.
Also, a debugger would have shown you that the last 8 bits of usecsVal are always 0 despite usecs(0) being non-zero.
And the "corner of the eye" thing is another simple technique - the whole line follows a pattern. Which the *256 at the beginning broke. It kind of stares you into the face.
OR you could have simply compared the line to the other lines with the other values, like I said. Or when I said that your reverse line was correct apart form being reversed - hey, reverse it again!
But no, you just sat there, unwilling to let the least bit of knowledge enter your think skull, Mr. "I don't know bit shift operators yet and that's ok with me", and in effect wasted everyone else's time. Which you'll probably do again and again and again as soon as something doesn't work because you're so reluctant to grasp what the heck it is that you're doing. Well, thank you but no thanks.
Also, a debugger would have shown you that the last 8 bits of usecsVal are always 0 despite usecs(0) being non-zero.
And the "corner of the eye" thing is another simple technique - the whole line follows a pattern. Which the *256 at the beginning broke. It kind of stares you into the face.
OR you could have simply compared the line to the other lines with the other values, like I said. Or when I said that your reverse line was correct apart form being reversed - hey, reverse it again!
But no, you just sat there, unwilling to let the least bit of knowledge enter your think skull, Mr. "I don't know bit shift operators yet and that's ok with me", and in effect wasted everyone else's time. Which you'll probably do again and again and again as soon as something doesn't work because you're so reluctant to grasp what the heck it is that you're doing. Well, thank you but no thanks.
to redeem myself from the << thing previously!
IMO this is a very confusing way to tackle it.
this might work better http://www.dotnetperls.com/binaryreader-vbnet
it allows you to read direct into the right variable types and should will get rid of the endian issues caused by reading into a byte array and parsing it yourself.
IMO this is a very confusing way to tackle it.
this might work better http://www.dotnetperls.com/binaryreader-vbnet
it allows you to read direct into the right variable types and should will get rid of the endian issues caused by reading into a byte array and parsing it yourself.
thank you @kb. i like not to be "helpful". but in terms of prove reading and marking mistakes it's the same behaviour of a teacher. i did post the solution. so what?!? ;)
*didn't post
@kb_: Just stop with your path of Anger and listen to me. You told me to use a Debugger, well I did and you know what happened?? I had no idea where to read the informations because of lack of Debugger knowledge! Great. Very helpful. This has nothing to do with the will to learn! You just think everybody on this planet has the SAME KNOWLEDGE as you, and you will soon recognize that this is not the case! THINK about that when you are cooled down.
Dude, we all have to start somewhere. Obviously most people don't have a clue the first time they use a debugger. But if you don't start using a debugger just because you don't know how to use it, how will you ever be able to use one when you need it? Noone gets better at programming and debugging by doing nothing. Your own initiative at finding solutions to your problems is always important.