« first day (2127 days earlier)      last day (1053 days later) » 

12:01 AM
RELOAD!
[AndaraCodes/FleetCommandMapEditor] 3 commits. 137 additions. 8 deletions.
[banane-io/pdb-frontend] 3 commits. 1428 additions. 815 deletions.
[Minesweeper] Games Played: 175, Bombs Used: 83, Moves Performed: 18862, New Users: 45
 
 
7 hours later…
7:25 AM
@IvenBach The situation is the same at my workplace. In addition to being used to it, it is valued that no interaction with the IT department is required.
Whenever I have spare time, which does not happen too often, I try to clean up a few things I work with myself.
 
 
6 hours later…
1:07 PM
I am really struggling to understand the structure of declarations and identifier references but cannot get the visualizer to work.
I get that they are a big collection of references, but what is the way to get all the references contained within a certain code module?
 
1:36 PM
I mean, I am not clear if ClassModuleDeclaration.References gets all the references contained in the class module or all the times the class module is referred to throughout the VBA project.
 
The latter, I believe
 
You need to look at all references of each declarations within the modules
Also, remember that the visualizer is for parse tree, not for declaration.
 
If you want all references in a component, you have to use the DeclarationFinder.
@this That will not get you all references in the module.
What you describe are the references to everything declared in the module.
Those are two different things.
 
I know. that's why I said the visualizer is more for parse tree, rather than the declarations.
 
1:42 PM
I do not understand what the visualizer had to do with the distinction.
 
I understood he was using parse tree visualizer to see how it was structured?
 
I was (trying) to use parse tree visualizer to see that yeah.
I thought it would be helpful because the parse tree is what is used to resolve the declarations and references.
But it doesn't work for some reason.
@M.Doerner I will see if I can guess before I ask which method.
 
did you open an issue with the parse tree visualizer github repo?
 
No, because I didn't want to bother them until I knew for sure it was worth reporting.
 
if you've read the instructions and still are struggling it's worth reporting in case a step was missed and instructions needing updating.
 
@theVBE-it'srightforme This should be close to what you are after (I think) var allReferences = _declarationFinderProvider.DeclarationFinder.Members(<ModuleDeclaration>).SelectMany(dec => dec.References);
 
It is just the standard "cannot load" error that they already recognize, just that the step of changing the option in Debugging - General doesnt fix it.
I guess I thought I would bring it up here and see if there was something else obvious I was missing first since that often seems to be the case.
@BZngr That gets the references out of each member in a given module?
 
It returns an aggregated collection of all references to all declarations in a module.
...which I think is what you are after. :)
 
@BZngr It's not exactly but it clarified enough for me to figure out so thank you. :)
 
:)
 
2:27 PM
hmm ... Duga seems to have missed some things
 
Yeah, she's been lazy the last several weeks.
 
welp. the webhook overview for duga is full of red exclamation marks
 
Maybe her WFH accommodations aren't quite up to snuff...
 
I think Simon and Mat was talking about it.
It was mentioned last week? or the week before?
 
hmm ... I may just have missed that
 
2:30 PM
evidently it hasn't been fixed still
 
we have another user pointing to the scrollbar change as the reason why RD stalls
 
@theVBE-it'srightforme To get all references in a module, you want to supply the corresponding QualifiedModuleName to the member IdentifierReferences.
Ok, what have I done wrong with the scrollviewer?
 
I have no idea
 
Could be that something goes into an infinite loop of adjustments.
 
but the comments here point to prerelease 2.4.1.5227, which in turn points to pull request #5306
 
2:39 PM
The only thing I can think of is that handling the bring into view event might have nasty side-effects.
Maybe I should have a look at the grouping grid implementation.
 
One possible culprit could be the virtualization
I recall comintern saying that virtualization has its problem.
 
@M.Doerner finder.IdentifierReferences(classModule.QualifiedModuleName) ?
 
Yes
 
okay ty
it worked for a worksheet module
it does not work for a userform module?
 
@this Speaking of which, has anyone heard from comintern? It seems like close to a year since we last heard from him. Even James Bond's missions don't last that long!
 
2:49 PM
IINM, his last absence was as long.
 
@theVBE-it'srightforme It should also work for user forms.
 
what is difference between ComponentType.UserForm and ComponentType.VBForm?
 
Which references are you missing?
 
last seen on march 26th last year on Stack Overflow
 
Private Sub UserForm_MouseMove(ByVal X As Single, ByVal Y As Single)

    If (X Mod Y = 0) Then
        With TestUserform
            .Height = 2 * Y
        End With
        TestUserform.ChangeFormControlFont(TestUserform)
    End If

End Sub

Public Sub ChangeFormControlFont(ByRef frm As Object)

    Dim cntrl As MSForms.Control

    For Each cntrl In frm.Controls
        cntrl.Font.Name = ""Anything But Calibri""
    Next

End Sub";
doesnt pick up a single self reference
Assert.AreEqual(3, FindModuleInternalNameUsage("TestUserform", moduleCode, ComponentType.UserForm, ReferenceLibrary.Excel, ReferenceLibrary.MsOffice, ReferenceLibrary.MsForms));
 
2:51 PM
The first is a user form, as used in Excel, the latter a Form from VB6.
 
equal code for worksheet does
@M.Doerner okay makes sense
 
I so enjoy the implicit black voodoo conversions. They make my life sooo easy!
Public Sub x()
    Dim l As Variant
    Dim r As Variant

    l = 1
    r = "1"

    Debug.Print l, l = 1, l = "1"
    Debug.Print r, r = 1, r = "1"
    Debug.Print 1 = "1", l = r
End Sub
 
@this That is why we all love VBA so much.
would it help if i included the working code for the worksheet unit test?
 
 1            True          True
1             True          True
True          False
Outputs:
 
oh lol i did not think r = 1 would be true
 
2:56 PM
In particular, I did want the False behavior I got with l = r; but it is very unintuitive given the behaviors with literals.
 
@IvenBach I both understand that their decision is permanent for the foreseeable future and also wouldn't be surprised if somewhere down the line they eventually abandon it because good golly what a poor decision.
 
wait is the ComponentType.UserForm for the actual userform object and not for the codebehind?
@this yeah...why is that?
 
My guess is that implicit conversion only applies if it's 2 data types that are not same and both aren't Variants.
The literals would have been implicitly typed as String and Integer
 
oh that would make sense
l and r are both variants and don't represent the same exact value therefore different
probably should be documented better though!
 
Yes. ^
It's far too easy to write sloppy code that does implicit conversions that you weren't expecting (or one that doesn't when you were expecting it, too).
 
3:03 PM
Does RD have an inspection for that?
also I feel like "it's far too easy to write sloppy code" might be one of the core philosophies of VBA
 
"also I feel like "it's make it far too easy to write sloppy code" might be one of the core philosophies of VBA" <-- FTFY
 
now now, lets not equate it with python
:3
@this would having the wrong event handler definition cause an inspection unit test to not work
 
@theVBE-it'srightforme Well, it's both. It specifies that, for example, the "Form1" component (the object and the code-behind) are a ComponentType.UserForm
 
@mansellan got it?
they are inseparable
 
yep
 
3:16 PM
but a userform does cast to a ClassModuleDeclaration right?
 
Not sure, I would expect so.
 
that is how i interpreted the flags in DeclarationType i guess
however that appears to be irrelevant
wait lol
does a mock vbe need more than just one userform?
im debugging the test and it wont even get to the inspection itself
whereas it does with the standard worksheet module
debugging is honestly maybe the worst part of VS
and linq
is there a trick for debugging linq statements?
 
you can put a breakpoint inside the LINQ
have to use right-click in right place to do that.
 
duck check: for a CLI, do you prefer a -quiet / -verbose switch, or a -loglevel enum?
I'm thinking the former
 
3:27 PM
any chance to use the word verbose, i mean...
 
lol
 
haha
I have a duck check as well: if I need the results of a function for use as a method parameter but I have no need for a callback delay, does it matter which of the two following options I do?
 
why does
var potentiallyRelevantDeclarations = _relevantDeclarationTypes.Length == 0
                ? finder.Members(module)
                : _relevantDeclarationTypes
                    .SelectMany(declarationType => finder.Members(module, declarationType))
                    .Distinct();
 
* Run the function ahead of time, save its result as variable, use variable as parameter
 
work for a worksheet module but not a userform
 
3:30 PM
* Use a delegate and execute the function inside the method
 
i guess when you want to use the resources?
//doesnt know at all :)
 
@theVBE-it'srightforme Sorry I don't know the answer to yours either :) Does finder.Members(module) return anything for a userform?
Sorry, that's probably pointlessly obvious
 
Not for me lol.
 
Maybe paste finder.Members() code here if it's not too long?
 
3:38 PM
Sorry, poor first attempt there, I don't literally mean tell me what it does in one plain english sentence.
I meant I
I'm assuming the critical issue is inside that method so maybe we should look at it
But I probably have no idea what I'm talking about
 
Thanks, logging on on my personal computer to look
Github blocked on my work computer
 
@puzzlepiece87 wat
wait actually i cant comprehend that
so basically the code i am identifying
i mean like what it does is call finder.Members for each relevant declaration type
these are the relevant declaration types DeclarationType.Document, DeclarationType.DocObject, DeclarationType.UserForm, DeclarationType.VbForm
 
Interesting. I seem to be getting lot of inspections similar to this: Member 'xxx' has a 'VB_VarHelpID' attribute with value(s) '-1', but no corresponding annotation.
 
@theVBE-it'srightforme HIPAA workplace
 
3:46 PM
It seems to be occurring for all variables that was declared with WithEvents
 
@theVBE-it'srightforme Haha, the cavalry has arrived, glad you have qualified help now :)
 
@theVBE-it'srightforme makes sense - some companies consider their code proprietary and don't want people posting it to GH, nor do they want to deal with the licensing issues of incorporating OSS code licenses into their paid applications.
 
@puzzlepiece87 there is only one place I can think of you working now :3
@FreeMan it can still be a source of "inspiration" though!
@this what inspection?
 
@puzzlepiece87 we're all kinds of HIPPA here, but GH is available. Of course, I doubt that many here do anything more than "Joe in Accounting's VBA"...
 
@FreeMan UserForm1.Show <3
 
3:48 PM
3 mins ago, by this
Interesting. I seem to be getting lot of inspections similar to this: Member 'xxx' has a 'VB_VarHelpID' attribute with value(s) '-1', but no corresponding annotation.
 
^ FTW
 
I'm not understanding?
 
Rename the UserForm1 to NaughtyBits. That may help dissuade them from showing it.
@theVBE-it'srightforme it's simply suggesting that I add the attribute annotation because it has a non-default attribute for help ID. But I'm seeing that flagged for all variables that has WithEvents, so it's kind of noisy.
 
@theVBE-it'srightforme For historical reasons, all user forms have the DeclarationType ClassModule.
Nothing uses the declaration type UserForm.
 
 
2 hours later…
5:57 PM
I seem to be recursively nerdsniping myself. Latest recursion: globalization...
I just hope there's an exit condition, I don't wanna overflow!
 
If we hear a loud POP, at least we'll know...
 
It's ok. That's what Stack Overflow is for, right?
 
lol
 
6:22 PM
Ugh, I want to eat the cake and have it.
I have a desire to have a dynamic collection where the key can be early bound.
Example: Controls(SourceForm.SomeControl.Name).Value instead of Controls("SomeControl").Value
With Access forms, any controls are added to the interface, so the dot access is possible and thus can be verified by the compiler. But I don't want it to be tied to only one form. #FML
 
6:54 PM
Well, you just want the moon on a stick!
 
7:09 PM
@this Can you early bind an interface and wrap the control?
 
Wonder how many extra commits GH is gonna get from devs who are stuck at home...
 
@BZngr Considered that but 1) would have to be the LCD among implementations, 2) wouldn't early bind the different members that might exist on one implementation but not other. @mansellan is correct; I want the moon on a stick.
 
7:34 PM
Design feedback question: if I'm processing an indeterminate number of files in parallel and am trying to make a progress bar more informative than like
0%.... 0%..... 0%..... 20% 47% 100%
Would you all do something like multiply the file count by 4 and implement quarter-file progress increases?
Or is that a silly idea?
 
Why is the number of files indeterminate?
 
@HackSlash Because the user selects however many they want and then I chuck the processing tasks without limit into the thread pool.
 
Normally for indeterminate processes, I report the file being worked on.
 
(no throttling)
@this I'm working on multiple files at once. Am I using the wrong terminology?
 
that way, users can see progress since the status text's changing
No, I was envisioning you'd list all files being actively processed upon
 
7:40 PM
The number of selected items is know, does it change?
 
then when you finish a file, you remove it from the status text
(and put in the new file)
 
@this Ah, interesting idea, maybe something like that would be good. I'll probably keep it simpler for my users, but I like the principle generally.
@HackSlash Nope, it's static after selection.
 
The thread doing the chucking knows how many files it chucked and can count up if needed.
Pass that number to the progress bar
 
That would also work if you're calculating the chunks in advance.
 
@HackSlash Sure, but I'm asking what you would recommend to keep your users happy if you start on many/all of the files at once... there's a delay, and then many/all finish at once.
(Trying to avoid a situation where progress is 0% for awhile, then suddenly 100%)
 
7:43 PM
To clarify - are you chunking at all?
 
No, just file looping, one second, getting the code:
 
Oh! Well, I can tell you what Microsoft does: Lie. They do a time based count to 80% and then the rest is based on real information like the files completed.
 
            var fileProcessMonitoring = new Task[files.Length];

            for (var i = files.GetLowerBound(0); i <= files.GetUpperBound(0); i++)
            {
                viewModel.FilesCompleted = i;
                viewModel.CurrentFileName = files[i].Name;

                var file = files[i];
                fileProcessMonitoring[i] = Task.Run(() => ProcessSingleFile(file, viewModel));
            }

            Task.WhenAll(fileProcessMonitoring).Wait();
 
and within the ProcessSingleFile, you don't actually have anything that equates to reading a "record" or a part of the file?
 
You take the total size of bytes of all the files divide by the current copy rate, then you get those wildly changing estimates that we all love.
 
7:45 PM
viewModel.CurrentFileName = files[i].Name; is leftover from when I did everything synchronously on a single thread and will probably go away
 
@HackSlash Haha got it, I've always thought the Microsoft time estimates were pretty bad, that explains a lot xD
 
@this Exactly my experience as a user xD
 
Parallel for each files
 
7:47 PM
@this Yup, I do have something, I'm thinking about using that with my quarter-file progress reporting idea
Each file has a different number of lines
12 mins ago, by puzzlepiece87
Would you all do something like multiply the file count by 4 and implement quarter-file progress increases?
So I could detect when more than 25% / 50% / 75% of the lines have been processed and report that
 
But the thing is that if you aren't collecting them upfront, you don't have the max value.
and without max value, your progress bar might not make sense
I suppose you could add to the max value as you start a new file but that might look weird to people looking at the progress files ("hey why did it go from 50% to 37%?!?")
 
I'm probably just communicating this poorly but to try to say the same thing again:
 
OR it would say "calculating estimate" and you need a progress bar for your progress bar
 
Say the user picks 10 files
Then inside each ProcessSingleFile(), I could track the currentLineNumber and compare to the number of lines in that file.
 
The problem, though is that you don't know how many files will be processed in parallel.
Actually, that's a red herring now I think about it.
Yes, it'd work the way you're thinking.
 
7:51 PM
And then +1 the progress when it gets to 25%, 50%, 75%, 100% of that file
@this @HackSlash Thank you both for affirming this isn't a terrible idea :)
I was a little worried
Now I just have to figure out why after so much effort I still haven't offloaded enough from the UI thread lol
 
That's easy: nothing should be done on the UI thread but updating the UI.
 
Yeah, I've been trying to do that as far as ProcessSingleFile() is all of the work haha
 
Except there needs to be a thread for that code calling ProcessSingleFile, it has a wait in it. The UI would kick off that thread and it would do a Parallel for each on all the files.
The UI thread should return without ever waiting
 
Oh got it!
Didn't realize the waiting was holding anything up, I thought it was done asynchronously
 
And maybe it is
 
8:01 PM
But based upon what you said it sounds like I'm keeping the UI thread waiting by the mailbox for the mail to arrive.
 
and maybe it is
I think it's asynchronously waiting for the mail. It should just return and there should be some other thread asynchronously waiting for the mail.
 
Got it! Thanks! I first started looking into asynchrony to relieve the UI thread, but it looks like that's not enough. What I'm taking away from what you're saying is that asynchrony is helpful but is not enough on its own to free up the UI thread. The asynchronous work needs to be assigned from a different thread altogether.
 
It's complicated and I'm no expert but I know that the UI thread only calls an action and returns. Or it reacts to stimulus by updating the UI. You never have a _Click event waiting for the click action to be done. If you want to disable the button then do so.
 
Duck check: would you say this code smells?
Public Sub Foo(Optional Bar As IBar = Nothing)
  If Bar Is Nothing Then
    Set Bar = New IBar
  End If

  'Do stuff
  Bar.DoMore
  'Do more stuff
  Bar.DoThisToo
  'Wrap up
End Sub
The alternative would be:
Public Sub Foo(Optional Bar As IBar = Nothing)
  'Do stuff
  If Not Bar Is Nothing Then
    Bar.DoMore
  End If
  'Do more stuff
  If Not Bar Is Nothing Then
    Bar.DoThisToo
  End If
  'Wrap up
End Sub
 
8:24 PM
@this Wait, so the potential smell is silently creating a new instance?
 
No. Creating a new interface to provide a no-op behavior
Set Bar = New IBar
and the IBar, being an interface should have no code so calling methods on it will do nothing.
 
Oh oh
Another dumb question, are you creating a new interface just to avoid errors farther down?
If so, why not If Bar Is Nothing then Exit Sub?
 
Yes. If Bar is Nothing, running Bar.DoMore will cause an RTE 91 (object not set)
because there are other stuff that will execute even if we don't use Bar
e.g. 'Do stuff, 'Do some stuff` and 'Wrap up
 
Oh got it
 
The fact you're asking me questions is a confirmation that this is confusing.
 
8:29 PM
In my opinion, which counts for nothing because I'm no expert, I think it's fine. If you're trying to make like, hyper clean code, then sure, but I think what you're doing quickly and neatly accomplishes your functional intention.
I think the smell is very mild.
I mean, I'm also dumb, so :P
 
:-)
For now I put in a comment to explain the Set Bar = New IBar
I think I may need an annotation because that should flag an inspection about abusing interface in that manner
 
If do stuff, do more stuff, and wrap up really don't need bar, if I was trying to make hyper clean code, maybe I wouldn't even put them in the same method, but that obviously depends on context that you can see and I can't.
 
even if I converted those into private methods, I'm still stuck with the essentially the same body
 
Yeah, that's true, I was just arriving there in my thoughts.
I guess the bigger picture alternative would be something like
If Bar Is Nothing Then
    DoStuff
    DoMoreStuff
    WrapUp
Else
    (Your method)
End If
That, in my amateur opinion, would smell the least
and then you could make Bar a non-optional parameter
But again, you're looking right at the code and I'm not, your opinion is correct.
 
Unfortunately, the methods on Bar has to be executed between those stuff.
 
8:37 PM
Got it, even if Bar is nothing is what I'm taking away from what you're saying.
You can't skip them entirely even if Bar is nothing.
 
not without a If Not Bar Is Nothing or making Bar a no-op, yeah
 
I understood previously that if Bar is not nothing, then you need them between, which I abbreviated as (your method), but it seems you are telling me you must execute methods that might be empty, which I don't understand but I accept.
 
in this context Bar is kind like raising events the manual way
 
Ah got it, that explains it!
Cool, well then your alternative is no smell and your current is very mild smell, imo
 
9:10 PM
@this you never answered my question on #5443 ;_;
 
I did? In this chat, not there?
 
ugh i missed it then?
 
we had an extended discussion about that last week, IIRC
 
i remember that
 
It was in response to that (didn't want to turn GH into a 2nd chat platform. ;-) )
 
9:13 PM
i asked another question after it i think
 
oh
 
@this ill cp here in service of this goal
 
about the useform?
 
Not my bailiwick. I'm an Access guy, remember. I don't htink they have codename, do they?
 
9:16 PM
I remember and still think you know about Excel because I conflate Excel and VBA
old habits etc
Anyways yeah they do. I would think it is less common to have that self-reference issue with them since examples usually use Me (not that they typically explain what Me is very well) and the lazy approach is to not qualify at all, but still.
 
and can you set the property the same you can with Excel's?
I thought that can be only via the VBIDE alone, not in code.
 
oh no its not in code
only in vbide
they are just classes basically
you can't change worksheet codename in code either though
is read only
 
Oh, I might have had the wrong impression. I thought CodeName was a write/read property
 
I actually hadn't checked until just now but no, it is not.
I don't think it is relevant to the inspection because it just cares whether a document is referring to itself with its name rather than Me?
 
Also I realize I'm a bit muddled. In both Access forms and Userform, you can do Form1.Whatever for either. The proposal is to change that into Me. This actually works even for the predeclared classes, too.
So it's not actually something to do with being a document.
It's all about using a class to reference to itself using its name instead of Me
 
9:24 PM
^ this is why I asked you :)
 
In fact, that's better because that is no longer host-specific.
 
So literally any class module?
 
we don't really care if it's Sheet1 or Form1 or Class1
well the only case where it won't work would be a non-predeclaredId class module.
since there'll be no Class1 to reference
 
non predeclared id?
(yes I should know this I know)
 
I believe all document modules are also predeclared.
a predeclaredid class is one that has a default instance available to you.
 
e.g. UserForm1.Show is possible because you are referencing the default instance that's automatically made for you.
 
If it wasn't, then you would have to do Dim f As UserForm1 : Set f = New UserForm1 : f.Show
 
i remember now
 
and as such, you woudln't be able to use it from inside the class.
 
9:26 PM
@this thankfully we don't have go through that tedious nonsense :)
lol
anyways
if a class is non predeclared and therefore cant reference itself by name, does it even matter?
i mean
the person writing the vba code wouldn't have been able to use the class name anyways
 
well.
create a new Class1 class module
put in the code:
Public Sub Derp
  Dim Class1 As Class1
  Set Class1 = New Class1
  Class1.Derp
End Sub
Here's your first unit test!
In a more serious use, you probably don't want to change that into Me
 
How is that legal?
Dim Class1 As Class
 
Ask Joel Spolsky. He said it was OK.
 
(link)
anyways point taken
but what about factory pattern with predeclared
Public Function Create(ByVal xPosition As Long, ByVal yPosition As Long) As IGridCoord
    With New GridCoord
probably want to ignore that too?
i guess that can be addressed later
 
9:52 PM
Yes probably should be ignored -- With'd stuff is effectively an implicit variable
basically you don't want to consider if there's a variable declared (explicitly or implicitly)
only if there's no variable declaration in which case you probably want to raise a result
 
10:05 PM
what about With Sheet1 as a set off for changing a set of attribtues
?
is that a declaration?
 
hm
yeah that should be a With Me
 
10:58 PM
@HackSlash Lies, damned lies, and progress bars.
 
11:26 PM
Why are progress bars so awful? Because programming is hard
 

« first day (2127 days earlier)      last day (1053 days later) »