|
-
Apr 5th, 2024, 11:25 PM
#1
Thread Starter
PowerPoster
Turns out program is running so fast that using datetimeserial wasn't giving uniques
Edit again. It's now in the demo and working properly. I want to use Sleep but it was slowing things down too much so I landed on using a Static variable instead. But I coded the counter (StartCallStackLog Function in cCallStack) in the wrong order so it starts counting at 2 instead of 1. Not a big deal and I fixed it but I'm not uploading it a 4th time just for that fix. Just know that if you try the demo the files start at 2 instead of one. It's an easy fix if you care.
this is how it should be:
Code:
Static nCounter As Long
' Returns Error Code.
On Error Resume Next
Close #iCallLogFileNum
On Error GoTo errHandler
If DebugMode = idx_Debug_Off Then Exit Function
If nCounter = 99 Then nCounter = 0
nCounter = nCounter + 1
<snip>
--------------------------------------------
Edit: This is something new I'm adding. It's not in the demo I uploaded. In the uploaded demo it just merrily keeps on generating file after file with the only limit being drive capacity.
I decided it's stupid to do it that way because I can't see any reason I'd need to look back at callstacks 10,000 stacks ago.
--------------------------------------------
I've spent the last two hours trying to track down a bug in my CallStacker demo.
I'm using a date/time serial thing I generate to name the files.
I have a max number of files and when it reaches that max it deletes the oldest file, moves everything up in the array and puts the new file at the end of the array.
And it starts out fine. For example I have it set to five files.
So the disk gets five files.
Then four
Then two
then four again
then three
I've been tearing my hair out.
It turns out that it was generating the files so fast (number of calls per file was set to a small number for testing) and it was generating the same file name a couple times in a row.
I've rewritten the code a dozen times at least trying to figure it out. All the versions of the code worked fine. I could find no problems with it.
Then I started printing the entire array into the immediate window and that's when I found out that the same file name gets generated several times in succession.
So I added a static to count and append to the filename and now it works like it should.
Output *before* appending the static number
Creating D:\Projects\VB Projects\CallStack Demo\Logs\Call Stacks 20240406002301.txt
sFilename(0) = D:\Projects\VB Projects\CallStack Demo\Logs\Call Stacks 20240406002258.txt
sFilename(1) = D:\Projects\VB Projects\CallStack Demo\Logs\Call Stacks 20240406002259.txt
sFilename(2) = D:\Projects\VB Projects\CallStack Demo\Logs\Call Stacks 20240406002259.txt
sFilename(3) = D:\Projects\VB Projects\CallStack Demo\Logs\Call Stacks 20240406002300.txt
sFilename(4) = D:\Projects\VB Projects\CallStack Demo\Logs\Call Stacks 20240406002300.txt
sFilename(0) = D:\Projects\VB Projects\CallStack Demo\Logs\Call Stacks 20240406002259.txt
sFilename(1) = D:\Projects\VB Projects\CallStack Demo\Logs\Call Stacks 20240406002259.txt
sFilename(2) = D:\Projects\VB Projects\CallStack Demo\Logs\Call Stacks 20240406002300.txt
sFilename(3) = D:\Projects\VB Projects\CallStack Demo\Logs\Call Stacks 20240406002300.txt
sFilename(4) = D:\Projects\VB Projects\CallStack Demo\Logs\Call Stacks 20240406002301.txt
Deleted D:\Projects\VB Projects\CallStack Demo\Logs\Call Stacks 20240406002258.txt
you can see what's going to happen when it gets to 59. 
Output after:
Creating D:\Projects\VB Projects\CallStack Demo\Logs\Call Stacks 20240406002447_14.txt
sFilename(0) = D:\Projects\VB Projects\CallStack Demo\Logs\Call Stacks 20240406002445_9.txt
sFilename(1) = D:\Projects\VB Projects\CallStack Demo\Logs\Call Stacks 20240406002445_10.txt
sFilename(2) = D:\Projects\VB Projects\CallStack Demo\Logs\Call Stacks 20240406002445_11.txt
sFilename(3) = D:\Projects\VB Projects\CallStack Demo\Logs\Call Stacks 20240406002446_12.txt
sFilename(4) = D:\Projects\VB Projects\CallStack Demo\Logs\Call Stacks 20240406002446_13.txt
sFilename(0) = D:\Projects\VB Projects\CallStack Demo\Logs\Call Stacks 20240406002445_10.txt
sFilename(1) = D:\Projects\VB Projects\CallStack Demo\Logs\Call Stacks 20240406002445_11.txt
sFilename(2) = D:\Projects\VB Projects\CallStack Demo\Logs\Call Stacks 20240406002446_12.txt
sFilename(3) = D:\Projects\VB Projects\CallStack Demo\Logs\Call Stacks 20240406002446_13.txt
sFilename(4) = D:\Projects\VB Projects\CallStack Demo\Logs\Call Stacks 20240406002447_14.txt
Deleted D:\Projects\VB Projects\CallStack Demo\Logs\Call Stacks 20240406002445_9.txt
stuff like this drives me crazy.
Last edited by cafeenman; Apr 6th, 2024 at 02:35 PM.
-
Apr 5th, 2024, 11:32 PM
#2
Thread Starter
PowerPoster
Re: Turns out program is running so fast that usign datetimeserial wasn't giving uniq
actually made it a bit simpler than using a static by just using a sleep command for 750 ms. Experimenting now to find the smallest number that won't give duplicate filenames (plus a buffer) so as not to slow things down too much.
Granted, I'm only putting 10 callstacks in a file which is a smaller number than I'd ever use.
-
Apr 6th, 2024, 05:09 AM
#3
Re: Turns out program is running so fast that using datetimeserial wasn't giving uniq
I didn't bother reading your post as the subject is not a request for help. It is just a statement. Unsure what you want here.
https://github.com/yereverluvinunclebert
Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.
By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.
-
Apr 6th, 2024, 12:19 PM
#4
Thread Starter
PowerPoster
Re: Turns out program is running so fast that using datetimeserial wasn't giving uniq
I want to go back about 20 years to when this place didn't have so much scolding going on and it was a lot more fun and engaging.
-
Apr 6th, 2024, 12:21 PM
#5
Thread Starter
PowerPoster
Re: Turns out program is running so fast that using datetimeserial wasn't giving uniq
By the way, when I did ask a question the entire engagement was everyone didn't know that Amazon has screwed up invoices and one person who posted help in Spanish or something.
-
Apr 6th, 2024, 12:53 PM
#6
Re: Turns out program is running so fast that using datetimeserial wasn't giving uniq
 Originally Posted by cafeenman
I want to go back about 20 years to when this place didn't have so much scolding going on and it was a lot more fun and engaging.
I know a guy with a DeLorean in case you happen know a guy with a flux capacitor
-
Apr 6th, 2024, 12:57 PM
#7
Thread Starter
PowerPoster
Re: Turns out program is running so fast that using datetimeserial wasn't giving uniq
That car got too much hate. I never owned one or knew anyone who did and I heard a lot of bad things about the quality of it but I thought it was a nice looking car.
Also, yes, please put me in touch with your friend. I'd like to go back to before I had pins and screws in various joints all over my body and I could still do athletic things.
-
Apr 6th, 2024, 01:01 PM
#8
Thread Starter
PowerPoster
Re: Turns out program is running so fast that using datetimeserial wasn't giving uniq
And I'm sorry about being a WATB. I don't mean to be so dour.
What I actually want is to get get caught up with the current state of things. What I'm seeing is not a lot of classic VB6. In fact, I think there should be a forum for actual classic VB6 because I'm seeing mostly all kinds of ways it's being hacked (not in a bad way) to do more modern stuff that isn't the classic VB6 way.
And I don't know what any of that is. I haven't been here and I've been doing my own thing which is working with what VB6SP6 provides and not much else. It's all I need (except for the jumping through all kinds of hoops to get it installed under 64-bit Windows).
And also to share my own knowledge for what it's worth.
But all the gate-keeping and scolding and all of that is just too much and I don't understand how it got this way.
But as I guess a new-comer, it's not my place to say what this place should be.
I'm thinking it's not for me though. That's my problem I know.
anyway...
-
Apr 6th, 2024, 02:04 PM
#9
Re: Turns out program is running so fast that using datetimeserial wasn't giving uniq
I share your opinion that overall this place has become a less fun place to visit over the past few years. Maybe it's just down to the dwindling number of VB6 developers (and therefore members here). When this was a bustling place, a conversation on any given topic would keep bubbling along even if individuals drifted in and out of the thread, but now there aren't really enough people left to keep things percolating. If any of the few remaining participating members get busy or uninterested in the topic, then threads get left for dead. Put more succinctly - there's not as much optimism around here anymore.
IMO If you're looking for a place with a bit more of the old vibe, I recommend checking out the twinBasic Discord chat rooms. It is definitely more optimistic over there, and while arguments still happen, they tend to be more focused on technical issues and all parties genuinely seem to be working toward solutions, they just disagree on what those solutions might be. Thankfully the trolls don't seem to have caught wind of it yet...maybe I should be keeping my mouth shut 
Anyway, "that's just like my opinion, man" - others have disagreed with me on this, so I might be wearing rose coloured glasses.
-
Apr 6th, 2024, 02:22 PM
#10
Thread Starter
PowerPoster
Re: Turns out program is running so fast that using datetimeserial wasn't giving uniq
Thanks. I'll have a look. In the mean time I guess I have to figure out what TwinBasic is. I took a quick look the other day but didn't take the time to read it over. Saved to my bookmarks for later.
-
Apr 6th, 2024, 02:42 PM
#11
Thread Starter
PowerPoster
Re: Turns out program is running so fast that using datetimeserial wasn't giving uniq
 Originally Posted by yereverluvinuncleber
I didn't bother reading your post as the subject is not a request for help. It is just a statement. Unsure what you want here.
If someone posts a problem and the solution is it less helpful to other people than if someone else solves that problem?
What I wanted was to show how I solved a problem.
-
Apr 7th, 2024, 04:16 AM
#12
Re: Turns out program is running so fast that using datetimeserial wasn't giving uniq
Might be useful to state that clearly in English in the first sentence. Also the subject is THE place to make it clear what you want to do. I start my queries in this manner "VB6 Question: How do I fix XXX in Flubber to fill my 2 dimensional array?"
I didn't read and respond you your post as the subject didn't seem to require me to do so. Others might feel the same.
Anyway, let's move on now. Keep posting, raise the next up the flag pole and see if the dog licks it.
https://github.com/yereverluvinunclebert
Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.
By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|