« first day (1488 days earlier)      last day (1692 days later) » 

12:00 AM
Home time.
 
RELOAD!
[rubberduck-vba/Rubberduck] 3 issue comments.
 
 
9 hours later…
9:25 AM
hi guys :) Any Idea what might be wrong here?
"Sub TableSetUp(path As String)
Dim strTargetFile As String
Dim wo As Workbook
Dim ws As Worksheet
Dim s As String
Set ws = ThisWorkbook.Sheets("Daten")
Dim j As Integer

Application.ScreenUpdating = False
Application.DisplayAlerts = False
strTargetFile = path
Set wo = Workbooks.OpenXML(filename:=strTargetFile, LoadOption:=xlXmlLoadImportToList)
Application.DisplayAlerts = True
MsgBox (wo.Sheets(1).Cells(1, 1))
MsgBox (ws.Range("A1"))
For j = 1 To wo.Sheets(1).UsedRange.Columns.Count
 
Please tell us: Is anything wrong there? I can't tell from here. (Do you see an error message? Where does it point to?)
 
It pops me a 1004 runtime Error for the line 'ws.Cells(1,i).Value = wo.Sheets(1).Cells(1,i)'
And I actually can't see the problem :D
 
9:41 AM
Try setting a breakpoint at that line and have a look in the locals window: Is wo set correctly? Does i have a proper value?
 
How do I find the locals window?
 
Ansicht -> Lokal-Fenster
My guess would be that i <> j?
 
MsgBox debugging, huh?
 
your loop index is j whereas you try to access elements with i
 
That was kinda dumb :D but unfortunately it still doesnt work
 
9:45 AM
are you not using Option Explicit?
such errors should be easy to avoid
 
Option Explicit?
 
then back to the locals window: Does it tell you something about the variables in that line?
 
wo is set to Workbook/DieseArbeitsmappe and ws to Worksheet/Tabelle2
 
j is set to 1
 
9:48 AM
you'll have to insert Option Explicit at the top of your existing modules. But for all new modules it will be set automatically. It will force you to declare all your variables. So when you unintentionally (due to typo) use one that's not declared, the compiler will complain.
 
Ok will do that
But still that wasnt the mistake and wo as well as ws are set
so I'm a bit confused here
 
then try in the immediate window (ctrl-g):
?wo.Sheets(1).Cells(l, j)
and
?ws.Cells(l, j).Value
try to find out which element causes the error
 
in ?wo.Sheets(1).Cells(1, j) is my Data I want to insert and ?ws.Cells(1,j).Value gives me an empty line
 
what happens if you put in ?wo.Sheets(1).Cells(l, j).Value
 
The same data as without the ".value"
 
9:53 AM
or, alternatively: ?typename(wo.Sheets(1).Cells(l, j).Value)
 
it gives a string
ws.Cells(1,j).value
gives empty
 
then I'm entirely unsure what else could be wrong.
hm, l in your code is properly set? You used 1 in your immediate commands, but l in the code
for the row reference
 
Are there 2 types of the number 1?
 
one is the letter L and one is the number one
 
I used the number one every time
 
9:56 AM
and what you pasted above (the whole sub) contains an L
 
how?
 
that's why I prompted you to use Option Explicit
 
omg
omfg
sry
 
so ws.Cells(l, j) was undefined because l <> 1?
 
@Inarion possibly just l undefined
 
9:59 AM
@Vogel612 yeah, that would be the underlying reason :D
 
and that's why you override the VBEs default font to something that makes distinctions between Il1 and O0
 
totally :D
 
on that note: Rubberduck would've caught that bug :)
 
at first because no Option Explicit and then some more (variable used but not declared; and more?)
the font Consolas seems ok-ish regarding the distinction between l and 1
this, or hosch?, told me about some nice alternative (Google source or something along those lines), problem was of course: No privileges means IT has to be involved. ;)
Maybe it was thunderframe
Anyways, I'm off for lunch!
 
 
1 hour later…
11:10 AM
@Inarion 'twas me. Source Code Pro is the font.
 
11:20 AM
So is it a good font for user experience or better with something else?
 
@ThunderFrame Thanks for reminding me. :) Should probably save that somewhere.
@PeterMTaylor I'd say it depends on what your UX entails. ;)
 
0
Q: Hide Excel Rows faster

Emilio M BumacharI've built a VBA Excel macro that works on a spreadsheet of duplicated files, and displays only groups in which at least one duplication is owned by the current user. The spreadsheet lists file metadata, one file per row, grouped with other files whose content is identical, i.e. "duplicated". Ea...

 
I probably would not want to read pages of text (in natural language) in it.
 
@PeterMTaylor it's specifically designed for use in IDEs. It's not a font for writing essays in, or webpages/forms, but it is definitely better than Courier New, and I'd argue that it's better than Consolas, but that's just my opinion.
@PeterMTaylor but if you're looking for a nice webfont, or font for generating text in a PDF, then I highly recommend Raleway for body text and Montserrat for headings. Both are available on Google Fonts. fonts.google.com/specimen/Raleway?selection.family=Montserrat
 
11:50 AM
GTK @ThunderFrame
 
 
1 hour later…
1:18 PM
0
Q: Excel 2016 VBA - Show/Hide multiple shape groups

MatlasI have the following code I'm using to show/hide multiple shape groups in Excel 2016 using VBA and macros: Sub Pic_1_SA_click() ActiveSheet.Shapes("Group 23").Visible = True ActiveSheet.Shapes("Group 71").Visible = False ActiveSheet.Shapes("Group 19").Visible = False ActiveSheet.S...

 
> Thanks Guys. Please let me know when the fix is out so that I can help testing it.
 
Anyone home?
 
Nope, at work. :P
 
Lol
Mind if I ask a VBA question of you (to you?) ?
Well I will leave it in the Pond for whom ever may encounter it...
 
to you sounds more correct to me. But I'm not a native speaker. ;)
 
1:29 PM
It does but I think it is the former.
 
to one of you ;-)
(not native either though)
what's up?
 
@MathieuGuindon More native than me - if we go by our home countries' official languages. :D
 
I guess lol
 
remmy, engleesh be, like, bruken. ya know wha' mah seezing?
 
so the good news is, I've got something like VSCode block completion semi-working, and fully testable.
the bad news is, it's not going to work.
 
1:34 PM
I have an array which has duplicate rows which can be identified by the concatenation of columns 1-4. I want to loop this and decant unique rows into a second array. I was thinking to use a scripting dictionary to identify duplicate rows. I would loop the array , adding a key,which is the concatentation of the 4 columns , into the dictionary if it does not exist. If it didn't exist I then decant the row into my second array.
It got me thinking.....if I don't care about which row is kept amongst the duplicates, is it more efficient to simply overwrite the value in the dictionary for a given key or to do a test of if exists? It feels like the overwrite should be more efficient.
 
@QHarr but then you still have to check if the key exists, no?
hmm or you could just go dict(key) = value
 
No....I can just say dict(key) = value
yah!
 
yup. single traversal, no hassles
 
Huzzah!
 
@MathieuGuindon how come?
 
1:37 PM
@this I need to track where the "placeholders" are
 
Thank you @MathieuGuindon
 
placeholders? The inserted text?
 
for each ${1:item} in ${2:collection}\n\t$0\nnext
yeah
so I got it to regex-replace to for each item in collection\n\t\nnext and put the caret at $0
and select the item
then you type something and hit {tab}, it needs to select collection
but the placeholder got shifted to the right
so I tried regex-ifying the regex-replaced rule, matching everything as a literal
so I could locate the collection
I'll end up with a freakin' regex-parser again
ideas welcome... I'll stick to the curent untestable-but-working completion for now
"working"
 
[rubberduck-vba/Rubberduck] Vogel612 pushed commit 3cde5a3b to next: Reset MemberProcessing flag when entering module, fixes #4003
Merge pull request #4147 from Vogel612/fix-illegal-annotation

Reset MemberProcessing flag when entering module, fixes #4003
 
1:56 PM
@MathieuGuindon just a thought. Maybe the pretty printing handling stuff needs to be its own thing. If it's a service, you can eliminate that from the unit tests and make sure works correctly w/ VBE. That way, if we do ever go AvalonEdit, it's still easily abstracted out.
For the unit tests themselves, use a no-op pretty printing handling service.
 
it's not the pretty-printing..
 
NVM, then. I read the above about shifting to right as an effect from pretty printing.
 
no, it's an effect of typing something in place of item
not being able to do anything after pretty-printing is another problem though
 
@MathieuGuindon Idea #1--remove the resolver stage from parsing.
You can easily parse fast enough to have the parser handle this.
Only run the resolver once a parse hasn't happened for a second or so.
 
2:10 PM
0
Q: Getting rid of Merged cells

Patrick HonorezMerged cells are a PITA in Excel. They prevent doing a lot of actions and make copying columns impossible. So I wrote this little code to change all the merged cells in a given sheet into 'Center across selection'. I did NOT test against vertically merged cells, but it should not trigger an error...

 
@Hosch250 #1.1 make the parser capable of returning a parse tree given a string
if it's fast enough to parse every keypress then this can work
 
drats that's in my EM branch....
if you want, I can make this a separate PR so that it can be made available.
I needed that for the code preview box.
 
hmm
can you cherry-pick the commit(s)?
 
maybe, IDK. No matter - I can make that happen.
would rather push it as one proper PR, anyway.
 
2:17 PM
TBH the EM branch still needs more refactoring and thoughts. That's why it's been languishing for so long.
and now it just became clear how many things prerequisites it was missing
 
also, bonus points for ParseCurrentScope that only tokenizes the current procedure if the caret is in one, or just the declarations section if that's where we're at :)
 
The one I have takes an arbitiary string.
 
I can work with that
 
the string only needs to be a complete "module"
 
oh
does it?
 
2:19 PM
consider the external references.
module level variables for one thing
 
I don't care for resolving though, just tokenizing
and I know the line offset to use
 
passing in a single procedure body should work
 
cool
hmm it's going to fail to parse on most keypresses though, need to account for that
 
That said, I'm not sure if I'm resolving stuff in there. I assume yes since I just run the parser on it. Didn't feel slow but that's just opening a dialog rather than each keypress.
ah, and that's where we need that another PR that never happened to keep on parsing in face of errors.
 
2:22 PM
I think Hosch was working on it but ran into problems w/ it?
 
IIRC @Hosch250 has a 12-month stale branch with that
 
yeah
 
@this I did much of the groundwork for that, not sure if I still have it around.
 
so you need that, too.
 
It's quite easy to do--except for it breaks our entire parsing sequence.
 
2:23 PM
what was it that blocked you?
 
Because we no longer have the single error point--our entire code relies on that.
 
ah
 
nah I'm not going to have it affect the "main" parse engine
it really needs to do as little work as possible
and not need to unwind the call stack on a parse error
take a string, spit out a parse tree, valid or not. time elapsed ~0ms
I guess I can probably live with 50ms
perhaps 100
not much more though
 
you could try to parse the least amount possible by predetermining the entry rule
 
hmm
then I could do that and not even bother parsing until I know I need to complete a block
@Vogel612 you're a genius!! this is it!
 
2:36 PM
I've been laughing for 15 secs straight now, thanks
:)
 
Dragons don't "test the boundaries of what is capable of flying," as any dragon worth the name is a good deal larger and heavier than even the biggest flightless birds. Rather, they look the Square-Cube Law straight in the eye and say "I'm a dragon. Move!" and physics obligingly gets out of their way and lets them do their thing. — Mason Wheeler Dec 1 '16 at 18:57
 
@Hosch250 exactly
 
so Vogel's a maniacal evil genius?
 
@this I have a large black labrador-mix... so that's probably a no
 
@MathieuGuindon I'm not sure if you already tried this: keep a dictionary of the current placeholder values, then, replace the entire code block with a regex-replacement of the original snippet every time one of the placeholder values changes. That doesn't require any parsing and it allows the user to move forward and backwards between placeholders using tab and shift-tab (so they can go back and change a placeholder value if they change their mind.
 
2:39 PM
Yeah, gonna have a long haired persian cat to qualify.
 
alternatively a white rabbit or a "Fußhupe"
 
@ThunderFrame the problem is more with the placeholder positions than with their values though
 
oh? That's news to me. Is that a common motif for a villain character in German literature or what?
 
@MathieuGuindon but you know the start positions after each replacement, and the length of the next value... But you only need to know the position of the current placeholder target.
 
@this the rabbit comes from Austin Powers and the tiny (usually fugly) dog comes from a different Bond movie, IIRC
 
2:43 PM
might work...
much easier with a proper parse tree though
 
ah, I didn't see Austin Powers.
 
I have something mocked up in a VBA form using textboxes (as I didn't want the distraction of the hooks). It's not quite done, but I think it will work. And my snippet involves writing to multiple locations in the module, not just a single contiguous block.
 
Struggling to remember the dog in one of Bonds movies. I'm stuck with that Dr. Claw imagery.
 
The small dog is probably in my head from Kim Possible....
 
@Vogel612 Reminds me of Monty Python's killer rabbit.
 
 
3 hours later…
5:33 PM
posted on July 03, 2018 by Rubberduck VBA

The Builder Pattern is rarely something you need. Often a Factory Method does the job just fine, as far as creating object instances goes. But sometimes, creating an object in a valid state would require a Create method with many parameters, and that gets annoying. There’s something rather elegant about chained member calls that build an object. The methods of a… Continue reading OO

 
@BloggingDuck that draft had been collecting dust for well over a month... trimmed to death and published
Gaps would be records that were deleted. You would hit the exact same problem if this were SQL Server with an int primary key with identity specification, which is pretty much standard and best practice. In SQL Server you can set identity insert on; not sure if Access has something similar, or if it lets you just insert values in an autonumber column. — Mathieu Guindon 31 secs ago
^ @this does Access have anything like set identity insert on;?
 
set identity insert on is strictly a T-SQL thing.
In Access, you can run SQL that inserts into the autonumbering column directly and as long it's unoccupied, it should succeed.
 
I know.. so does Access let you insert an AN field?
ha
then OP created the problem haha
 
yes, you just can't do it via the UI but via the SQL, no problem.
 
@BloggingDuck Missing line continuation characters _ after .OfSize(Medium)
I don't think .CrustType = Classic is valid syntax.
 
5:46 PM
@IvenBach assume Classic is some enum value
 
Set pizza = builder _
    .OfSize(Medium)
    .CrustType = Classic
    .WithPepperoni _
    .WithCheese(Mozza) _
    .WithPeppers _
    .WithMushrooms _
    .Build
 
ah, damn
updated
 
I do the same when I write too. It looks correct in my minds eye, but it's not when I'm writing it.
 
meh, these two were added after the initial draft
 
In CW, I noticed that they return a different "builder" as you build up
which I think makes for a confusing API
 
5:51 PM
@this MockVbeBuilder does it too
 
OOP Design Patterns: The Builder https://rubberduckvba.wordpress.com/2018/07/03/oop-design-patterns-the-builder/
 
I think they did that so they could constraint the methods that may be called or something
but meh. it trips me up when the chained call go red when I remove a method that incidentally changes the return type.
 
@TweetingDuck #DuckTheBuilder
 
now we just need #DuckTheDestroyer
 
Sub EndItAll()
    End
End Sub
 
6:10 PM
^ IDK about the UF but in Access, that is going to create confusion.
(a form stays open but its state is reset so it will appear to "misbehave")
at least if you instantiate it as a class, it'll actually disappear. Global instances, however doesn't work that way.
 
One for you lot. Seems a bit short for code review.
0
Q: Pass the result of Array() as an argument

ivan_pozdeevIn VBA, it is possible to assign the result of Array() to a typed array: Dim a() as Integer a = Array(1, 3, 5) But for some reason, this breaks when the result is passed into a function: Sub Main() Foo(Array(1,2,3)) '<- "Type mismatch: array or user-defined type expected" End Sub Sub ...

 
6:52 PM
:grumble:
Get told "You can't do this" by help desk pineapples. 10 mins of monkeying with it proves them wrong. It helps to answer questions if you understand what you work with...
Nothing special either, basic feature of sharing meeting within the same family of accounts.
 
So VS now runs on Mac
Critics crack me up
@pieeatingchamp @docsmsft @VisualStudio Are you expecting Windows Forms and/or Windows Presentation Foundation to work on... not Windows?
 
I don't blame the guy, though. It's not fun to have to write different UIs just to support different OS.
Semi-related (wasn't the one I was looking for RE: why Java and Mozilla UI cannot live up to the standards set by the native OS frameworks) blog.codinghorror.com/are-web-interfaces-good-enough
 
yet if you have your WF/WPF code properly done, the only part you need to rewrite is the UI (assuming rest runs on .net core)
 
7:07 PM
yes yes, abstract it all over, yadda yadda. #StillTooMuchWork
Indulge my laziness, dangamit!
 
7:39 PM
The ideal is to strive towards laziness.
 
8:24 PM
@TweetingDuck You link to the GoF answer made your post a lot more meaningful.
Often Most of the time I fail to see the implications with the abstract concepts. Concrete examples make it a lot easier to digest.
 
it also demonstrates the pattern in a much more realistic setting
at one point in the draft I was talking about the VbeMockBuilder
I think I scrapped & rewrote that article 4 times
*yawn* BANG!! — Mathieu Guindon 2 mins ago
 
WB.SE tis a silly place.
 
8:46 PM
FWIW, the VbeMockBuilder would have been better as a 2nd post followup
don't cram the thoughtfood down the readers' throat all at once. :p
 
maybe
I figured I was better off introducing the pattern with a dead-simple (too simple) example that just shows the mechanics
 
because the result mutation with a descriptor would be a way to constraint the parameters for builder.
but whether it's intuitive....
 
da wat?
 
you said CW and MockVbeBuilder behaved the same?
e.g. when you do stuff like Component.For.blah.blah.blah.blah, what you can put in depends on which descriptor you have ATM.
e.g. Classes.For<IFoo>.WithDefaultInerface is illegal; it must be Classes.For<IFoo>.InNamespace("foo").WithDefaultInterface
 
@this no, I said MockVbeBuilder exposes methods that return another builder type, which in turn have methods that return another builder type
that's how you can build a VBE, a VBProject, a VBComponent, a UserForm, in one instruction
 
8:52 PM
in CW example, it referred ot them as Descriptor
maybe that's just their name for the builder pattern, IDK.
 
the first thing I thought when I read "descriptor" was "reflection"
 
yay for consistent naming?
anyway thinking about it, it is same thing - a builder that returns another builder can be used to constraint the API.... whether it's a good idea.... ???
 
it makes the API more fluent
 
as long you know that you're getting a different builder, sure.
in the CW's example, it wasn't that obvious
 
#KnowYourTools, and #ReadIntelliSense, yes
FWIW Ninject isn't all that obvious either
 
9:02 PM
until the code went red when I removed some methods and had to look around for what I was trying to substitute.
in a way it's good that it forces you to be explicit even if you end saying .UsingDefault or whatever
but if it returns a different builder, the method probably need to say that clearly (?)
 
agreed
public MockProjectBuilder ProjectBuilder(string name, ProjectProtection protection)
^ doesn't get any more explicit than that
 
That works, i think.
With CW's example above, it wasn't that obvious unless I actually look at the intellisense.
 
TBH I'm confused AF over CW's API
 
relieved that he's not the only one
The mock IoC is harder than I thought. I keep getting null references / cannot activate when trying to resolve the dialog. The same works when I F5.
 
9:18 PM
I did not find the CW API to be too confusing after reading the documentation.
BTW, the associating Descriptor with reflection is rather correct. It is simply a description of what you want to register. You can call some methods on it to get a descriptor with more details specified.
 
might be me then. When I try to research the errors I got, I could not locate the documentation that would have clarified whether I was missing something.
 
@MathieuGuindon I am pretty sure that the updated code doesn't work either...
builder.OfSize(Medium).CrustType = Classic.WithPepperoni
^^ that just doesn't work...
 
that's the original error Iven pointed out. I don't think it got updated.
 
is it?
 
4 hours ago, by IvenBach
I don't think .CrustType = Classic is valid syntax.
.CrustType(Classic) _ however would be
 
9:25 PM
What do you mean with it works when you F5. Do you use exactly the same registration for everything?
 
oh, no! That would be very wrong.
 
ya, was subsequently changed to have a line continuation after both OfSize and the assignment to CrustType
 
the mock IoC should be a subset
 
@Vogel612 I've not had the change to go back and code it to test it out.
 
I did copy the 3 methods from the original IoC for setting up the container itself (e.g. enabling automagic and disabling the properties)
 
9:26 PM
I doubt that the pepperoni belong to the crust. ...
 
You will still have to register all dependencies and dependencies thereof all the way down.
 
then I proceeded to register the Mock<> and types that I can locate within the Rubberduck.Refactoring
which means I must register Rubberduck.Parsing....
and how many other types....
that feels a bit excessive.
 
What I mean is, you have to register everything you have to inject into any of the constructors.
 
hm. so I would have to register RubberduckParserState, since it's one of the ctor parameters
 
The container only knows about what you registered.
Yes
 
9:29 PM
hmm thought I read that it would automatically derive all dependent types
 
Yes, but only those it knows of.
It works in production, because we register the RubberduckParserState.
The point of an IoC container is that you do not have to wire up the injection for all types by hand. You still have to tell the container what you want to have injected for a given parameter type.
 
ah, I found the article
that's where I got the impression that it could be done without having to enumerate all the dependency types.
Does that still seem sensible?
 
9:51 PM
Hm, that is something from the undocumented part of CW.
 
That is one of those pages only reachable through the FAQ, apparently.
Anyway, you should be able to return mocks for everything in the lazy component loader.
 
hmm. that does not bide well for its documentation.
I do have a different resolver set up for the moqup, based on another article....
this will take care of all Mock<>
 
> Typing `Public Property Get Foo() As Long` and then completing with `Enter` produces the below with `Variant` being selected.

```
Public Property Get Foo() As Long As Variant

End Property
```
 
However, since these would not be set up correctly, all properties and functions would return the default value for the return type, most of the time null.
 
9:55 PM
but I must still register concrete types like RubberduckParserState
I presumed that when I request for a Mock<>, I must configure the mock before injecting.
 
As said above, the return values of everything on the mock are default values as long as you do not set it up.
And all procedures are no-op.
 
Correct. I'd have to manually new up the object I want to pass the mocks in.
There's an example of that in the last link I posted
 
Auto-mocking is OK when you jsut need to put in the parameters and do not care what they do.
 
yes which is indeed the case for some of the unit tests I need to revise.
 
If the parameter types follow contracts like not returning null from some method, you will have to set that up.
 
10:06 PM
yes. One thing at a time, however. I need to get the IoC itself working with a minimal registration only necessary for running unit tests.
 
10:16 PM
@Vogel612 ha! tell Pizza Hut!
 
I thought this is interesting...
InfoQ: What will be important in the future of testing?

Bhamare: Let me take a deep breath first.

Well, for me the important thing in the future of testing is going to be “having to share it” with different job-roles and managing it with authority at the same time, in such a way that quality of the end product is not compromised.
 
11:05 PM
> Having a search box akin to what Code Explorer or Code Inspection Settings has would be nice.
 
11:23 PM
:+1: for RD. Making refactoring easier and with more confidence stuff oughtnt break.
Should the parse button be clickable when it's on inspecting? I've noticed that when I alt tab to another application while it's parsing and tab back it goes from greyed out unclickable to blue and clickable.
 

« first day (1488 days earlier)      last day (1692 days later) »