« first day (1281 days earlier)      last day (340 days later) » 

12:00 AM
RELOAD!
[rubberduck-vba/Rubberduck] 3 opened issues. 4 closed issues. 8 issue comments.
> I repro this with Ctrl+R. Sometimes the hotkey doesn't seem to he wired up. Activating the code pane fixes it though. I think the fix would be to explicitly activate a code pane on startup... after making sure there's one to activate (IIRC hotkeys wire up when a code pane is activated).
 
@Vogel612 whisky only matures in the barrell. Once it's in the bottle, it doesn't age any further. It's just the ullage you need to worry about.
 
12:25 AM
> I repro this with Ctrl+R. Sometimes the hotkey doesn't seem to be wired up. Activating the code pane fixes it though. I think the fix would be to explicitly activate a code pane on startup... after making sure there's one to activate (IIRC hotkeys wire up when a code pane is activated).
 
@Duga IDK if this is related but I think it bears noting that I noticed weird behavior when selecting code and running Extract Method. If I drag from right to left, it won't be enabled. Select the same block by dragging from left to right, it's enabled.
 
@this seems unrelated, but most likely a bug with how RD keeps track of the Selection ...
might be reproducible with other inspections...
 
inspections? can they be selected?
or did you mean refactorings?
 
ah right... refactorings..
soz. brainfunction declines after 1AM
 
AIUI, most of refactorings only work on a single declaration, rather than a selection, and would be normally invalid if I had multiple declarations selected for say, a Rename
I think you mean increaases, not declines :p
No worries.
but it'd definitely decline if you got some sleep. :D
.....
no it's ME who's malfunctioning.
argh.
 
12:32 AM
quite the contrary, actually..
 
indeed. :) maybe I'm the one who needs more sleep. :\
I (mis)read it as brain malfunction
 
whoops
 
12:55 AM
Duck check: In VBIDE.CodeModule there is the property ProcCountLines. Its second parameter is ProcKind As vbext_ProcKind is just designating what the procedure is? Whether it's a (Get, Set, Let)er or a procedure.
With my newer comprehension I'm trying to rewrite a macro which lists all the macros in the Active workbook.
 
RD API
 
1:17 AM
I'm off to bed.
 
2:02 AM
OMG. I'm reviewing an application that was written only months ago. Guess what? It has Gosub...Return all over the places. That is just.... I don't even....
 
Remain calm. Take a few breaths and RD on.
Do I work on RD PR or begin to assemble my new PC?
 
i know i'm just shocked
this clown has to be had living under a rock for last 20 years to not know that there are better way of doing things than using Gosub
 
Should have F5 before I done that.
 
0
Q: Using the RAII design pattern in VBA to automatically restore settings

ChrisBUsing a technique described in this StackOverflow answer by @David Murdoch I created a custom class with methods to speed up Excel (Activate turns off screen updates and set the calculation mode to manual) and to restore it to normal settings (Shutdown). When the object reaches the end of its li...

 
2:12 AM
[rubberduck-vba/Rubberduck] build for commit 2297e27e on unknown branch: AppVeyor build succeeded
 
 
2 hours later…
4:10 AM
@this unfortunately, there's too much stale documentation around.
 
 
5 hours later…
9:24 AM
@ThunderFrame that's perhaps true but this is literally my first time I saw anyone else using it still now - this isn't a guy who built few once upon a time and then went on to other things, never had to update his knowledge. This is a guy who does this professionally.
 
I have just discovered the existence and behaviour of a Gosub...
 
@NelsonVides please understand that this is just there for compatibility with BASIC
back in the day when there was no concept of procedures.
We are talking about like.... 30 years ago.
 
It doesn't seem like something I would ever like to use anyway xD
 
Good.
;)
 
procedures only have 30 years? I mean, they are still older than me though... but... only 30 years???
 
9:28 AM
IDK. I could be wrong. I'm not exactly sure when the procedures was introduced to BASIC
I only know that the BASIC in the Commodore64 definitely didn't have it.
that's about early 1980
 
For not having procedures I'd rather do Assembly then, it's much funnier xD
hey, now that I catch you here
RD usage question
 
ok
 
how do annotations work? I mean, all these '@Description("...")
I've read they'll sync the documentation on the object browser, but I'm having the feeling I cannot always use them (?)
 
I don't think they are fully implemented
at least not that annotation
but it does serve an useful purpose in that the code get documented so that when we do implement it'll maintain the hidden attribute
because right now it's a pITA to update the description via the VBA object browser
this is a fairly old blog post but it'll get you some idea of what should be working now
 
Right, I see...
I love the XML idea btw
So as of today we only have '@Folder and '@Ignore, isn't it?
 
9:36 AM
hm, I think we also have @Interface
which cuts down on the false positives when inspecting a class module that's meant to be used like an interface
speaking of which, I should add them....
 
Next thing. There are three things I'm very interested in RD: Source Control, Grammar, and COM hell.
1. I'm still having an issue when creating a new repo, it just never works.
2. How does the grammar works? I always found that topic very interesting.
3. I'm studying this one.
 
1. TBH, I don't use that feature myself because I already use OASIS, which is more specialized for Access rather than just VBA
2. We use a tool named ANTLR. It was originally written in Java, but they have ported it to various target, including C++, C#, JavaScript, among other things. To build the grammar we use the .g4 files which allow us to define grammar in a declarative manner and thus generate C# classes from it. There's some explanation here: github.com/rubberduck-vba/Rubberduck/wiki/The-Parsing-Process
3. What are you studying specifically ATM?
 
2. I've googled a bit ANTLR and I tried to update my RD ANTLR to the last version just to see what gets broken. But what I'm wondering at the moment is how to construct the .g4 files, like, what syntax and semantics it's using ANTLR to build the grammars. Do you know of any tutorial about this?
3. https://rubberduckvba.wordpress.com/2017/07/05/inside-rubberduck-pt-1/
https://msdn.microsoft.com/en-us/library/ms809762.aspx
https://www.mztools.com/articles/2012/MZ2012013.aspx
 
9:57 AM
Nov 26 at 18:27, by M.Doerner
@NelsonVides Currently, we are on Antlr 4.3, which cannot be built in VS2017. However, it can be built in VS2015, which cannot build the solution. So any grammar changes have to be done in VS2015 atm and then one has to switch back to VS2017 to actually build the solution.
Mar 24 at 0:48, by Comintern
Yeah. All you need to do is open the properties of the .g4 file and select the ANTLR build action.
FWIW, I also wrote an article about installing ANTLR in shudder eclipse....
 
Good, I forgot Doerner's message. Which makes me just more curious about modern versions of Antlr. I'm gonna explore your article and see what I can parse.
 
I don't get what PE has to do with the VBA Addin.
 
just exploring the .dlls
 
OK because I'm not sure if anything about the PE applies.
.NET assembly is quite different from a C++ DLL, as I've been told.
Unfortunately I do not know that much about low level internals.
 
I think I read somewhere that microsoft just kept the PE format for a .dll... that's something I need to discover though.
but what about the office interop .dlls, aren't they native code we're referencing all the time?
 
10:07 AM
But for the COM, if you want the low level details, I think MIDL is a good start
Well, yeah, when we do COM interop, we still have to generate .tlb files
which is basically using the MIDL compiler to build the file that describes the objects within the DLL
have you used tool oleview?
 
nope, here you got something new for me :D
 
I believe the PIAs are nothing more than just .tlb files so .NET know how to consume the OM of Office applicaiton
in your Visual Studio command line (via start menu)
run as administrator
type in oleview
 
10:42 AM
found the oleview, didn't work on my visual studio tough, and calling it straight from the folder raises a iviewers.dll failed load... oh right, I need admin rights to invoke it.
 
sorry, the power died on me
yes should be run w/ admin
Once you have oleview opened, there's a button that looks like 3 red arrows, 2nd from left
click it
nagivate to the C:\ProgramData\Rubberduck\Rubberduck.tlb
then you'll get to see the generated MIDL for the RD objects. Those come from the attributes that we decorate in C# classes.
Likewise, if you navigate to Excel.exe, (I think?) it'll get you the MIDL for all Excel objects. (In Access, it has to be the MSACC.OLB, not the MSACCESS.EXE, but I don't think Excel has a OLB file)
 
@NelsonVides The Antlr syntax is basically like regex, with the difference that you can reference other rules within a rule. SCREAM CASE rules refer to lexer tokens, which are defined in the lexer .g4.
 
I love this thing, new toy for me.
 
If multiple rules can match an input, the topmost in the grammar wins.
 
Remember how I told you earlier that when you early-bind a COM object, you are going to use vtable? MIDL helps with describing the v-table, more or less.
 
10:49 AM
There is only one restriction on how you can reference other rules: left-recursion must be direct.
 
@M.Doerner for my education -- left recurions is something like Foo = Foo(foo) ?
 
@M.Doerner I need to take again those notes about grammars, I read them back in the days but I didn't have an actual problem to face so I just read them superficially even though they were very interesting.
@this I'm gonna go for MIDL and this beautiful oleview for a while, thanks a lot!
 
You are welcome.
RE: Left recursion, this seems to explain the problem well enough - it's more general than I originally thought. en.wikipedia.org/wiki/Left_recursion
 
'Just like regex' is... an imo problematic simplification. The correct term you're looking for is EBNF @NelsonVides
@this there's two ways to recurse in a grammar. Left and Right. It's provable that those are equivalent in what they can match
 
just to try it out -- so a right-recurions would be something like 1 + (2 + 3) rather than (1 + 2) + 3, using the () to denote which gets resolved first?
 
11:51 AM
0
Q: Excel Slicer Macro Speed Issue

ChrisSituation: I am trying to print off reports for selected budget holders (selected from a Budget Holder Table), using the budget holder name to feed into a slicer which then updates various pivot tables. Objective: The objective is to populate efficiently the slicer with a single budget holder...

 
@this Yes. The case Antlr cannot deal with would correspond to ((1+2)*3)+4.
 
12:54 PM
just realized - if they are equivalent, then why not just transform as a right recursion before resolving? Otherwise I am not sure I understand why specifically left recursion would be problematic.
 
1:34 PM
As you can read in the Wikipedia article you liked to, there is an algorithm to turn left-recursive grammars into purely right-recursive ones. However, the parse tree you get after the transformation can look very different from what it would have looked like with respect to the original grammar.
IIRC, antlr takes a somewhat different approach to resolving direct left-recursion. Instead of adding additional rules, it adds predicates to rules that dynamically limit the depth of the left-recursion.
As a consequence, the preprocessed grammar is no longer context insensitive.
Regarding why left-recursion is a problem for a top-down parser, a left-recursion has no guarantee to ever stop if you are reading the input left to right, which you need to do if you want to be able to support potentially infinite streams.
In contrast, a right-recursive rule always consumes tokens (to the left) before recursing.
Thus, for a finite input, the parser knows after finite time whether a rule matches or not.
 
 
3 hours later…
4:33 PM
@NelsonVides If you run into trouble with the ANTLR upgrade, feel free to ping me. I've tried this before and been able to solve most of the problems, so I might be able to help.
 
4:47 PM
@Hosch250 in Visual Studio 2017?
If so, why not a PR? I recall an issue because ANTLR 4.4 + 4.5 had some performance enhancements that could be useful for RD given that we are still on 4.3
 
 
2 hours later…
6:25 PM
@Hosch250 could be useful to male a feature branch and PR your work there =)
 
 
2 hours later…
8:08 PM
posted on December 08, 2017 by Rubberduck VBA

Your VBA project is embedded in an Excel workbook. It references the VBA standard library; it references the library that exposes the host application’s (i.e. in this case, Excel’s) object model; it includes global-scope objects of types that are declared in these libraries – like Sheet1 (an Excel.Worksheet instance) and ThisWorkbook (an Excel.Workbook instance). These free, g

 
@BloggingDuck @Mat'sMug code highlighting seems to be borked when blocking external scripts
the post looks great, though :)
 
thanks
@ThunderFrame did you know this?
in Discussion between JohnyL and Scott Craner on Stack Overflow Chat, 1 min ago, by Mat's Mug
are you saying unqualified honors Option Base while qualified with VBA doesn't?
in Discussion between JohnyL and Scott Craner on Stack Overflow Chat, 3 mins ago, by Mat's Mug
@JohnyL Rubberduck resolves both VBA.Array and Array to VBA._HiddenModule.Array (variant-returning function)
 
@Mat'sMug really? Wow!
 
I'll have to validate this, but ...damn
 
8:41 PM
Option Explicit
Option Base 1

Sub test()

  Dim a As Variant
  Dim b As Variant
  Dim c As Variant
  Dim d As Variant

  a = Array(1, 2, 3)
  b = VBA.Array(1, 2, 3)
  c = [_HiddenModule].Array(1, 2, 3)
  d = VBA.[_HiddenModule].Array(1, 2, 3)

  Debug.Print LBound(a), LBound(b), LBound(c), LBound(d)

  'Prints 1 0 0 0

End Sub
 
wow ...
 
it's almost like we need a helper function called something like SafeArray
 
question: what about different lower bounds?
can you make qualified arrays have a different LBound than 0?
 
yeah.
Dim Lame(3 to 5) As Byte
TBH I wouldn't be at all surprised if the underlying C++ was doing something like Lame[i-lbound];
 
8:57 PM
well, it is documented:
> The lower bound of an array created using the Array function is determined by the lower bound specified with the Option Base statement, unless Array is qualified with the name of the type library (for example VBA.Array ). If qualified with the type-library name, Array is unaffected by Option Base.
 
Because what is an array? A contiguous block of memory allocated to a N elements of same data type. How do we access the elements? By doing pointer arithmetic with the first element's pointer address the base. Therefore, 3 to 5 has to be pure syntactic sugar.
But holy moly, this kind of nonsense has entrapped far too many people with unnecessary one-off errors.
@ThunderFrame I have to admit that this feels very ... arbitrary. Don't worry, if you incant the magic incantations, all that will go away!
 
@ThunderFrame ffs
 
The VBA functions have always been weird. It's like the compiler special cases them.
Sub test()
  Clng 1 'Syntax error
  VBA.CLng 1 'runs just fine
  CDec 1 'Runs just fine
End Sub
 
@ThunderFrame CDec doesn't compile on a Mac
 
Prolly cos there's no data type for Decimal, so it's stuffed in a Variant which has few side effects
 
9:04 PM
@Mat'sMug @this - see my edit, with qualified usage
 
ok, that's just.... sad.
 
Oh COME ON
 
#TIL (or maybe #TIRIA) There's a CLngPtr
someone needs to set up a contest of inconsistency between VBA and JS
@ThunderFrame i'm wondering if you happen to know whether a VBA enum will be considered a LongLong on a 64-bit platform? Or is it forever a Long?
 
@this I've avoided 64-bit - It should arguably be a LongLong, but I suspect they just left it as Long?
 
9:19 PM
Never found any explicit documentation. I wouldn't be surprised if it's still a Long, which would be bad news for enums used in API calls since that would mean implicit conversions at least.
our standard has been to use 32-bit but even so, I'm future-proofing the code by ensuring it stays 64-bit compatible.... hopefully.
 
@this I've done consulting jobs where the client was on the verge of pulling the 64-bit trigger ("64-bits, is more bits, it must be better, right?"), only to realize that they're hugely dependent on 3rd party libraries and controls that won't work on 64-bit, and none of their code has been written defensively for bitness.
 
Yeah, same situation here. So far, most of our clients ended up staying on 32-bit but there are at least few where this is real problem
e.g. they need to run 64-bit Excel or 64-bit PowerBI and that cause all sort of compatibility issues
and I wouldn't be surprised that in few years 64-bit will truly become the norm.
Hmm. I feel this is a false positive. I'm getting lot of inspection for ByVal parameter passed in but assigned but reviewing them, they are something like those.....
Public Function OpenBrowser( _
    ByVal URL As String _
) As Boolean
    Dim res As Long

    ' it is mandatory that the URL is prefixed with http:// or https://
    If InStr(1, URL, "http", vbTextCompare) <> 1 Then
        URL = "http://" & URL
    End If

    res = apiShellExecute(0&, "open", URL, vbNullString, vbNullString, SW_SHOWNORMAL)
    OpenBrowser = (res > 32)
End Function
IOW, it's assigned only to clean up the string into a acceptable format, and the callee don't need to care about that and we save a variable declaration. What do you guys think?
 
9:37 PM
@this think about the positive, where a user assigns a value that they expect to update the original - the inspection can't distinguish between a real case and a false positive. Your fix would be to use a temporary variable?
 
blargh
i'm already copying the variable in memory
you're asking me to copy it to yet another place?
 
IKR
@ignore
 
i mgiht end up disabling the inspection - there's lot of them and htey are more noise than help for me. :(
because most of them trip on this pattern
where there's a guard clause to ensure it's valid or reformat it somehow.
 
10:09 PM
oh hai @JohnyL!
 
Hello everyone :)
 
^ future contributor, current status: sleepy
 
@Mat'sMug That's a common trait among contributors
 
lol
 
10:59 PM
<-- current contributor-ish. current status. sleepy
@Mat'sMug what about FR i18n now?
The RESX VS Addin is just outdoing my tool in every aspect
 
11:46 PM
it's some way off but I'm hoping I can get to the point where this is possible....
            Form form = new Form();
            form.Name = "searchDialog";
            IFormControl textEntry = form.AddControl(ControlType.TextBox, "searchText", 200, 200, 200, 500);
            IFormControl OKButton = form.AddControl(ControlType.CommandButton, "OKButton", 500, 200, 200, 500);
            form.SaveAs(tempPath, VBEVersion.VBA6);

            project.VBComponents.Import(tempPath);
WPF designers for forms?!?
 

« first day (1281 days earlier)      last day (340 days later) »