« first day (1994 days earlier)      last day (1186 days later) » 
00:00 - 18:0018:00 - 00:00

6:00 PM
3.5hr left.
210min.
12,600sec.
Well, technically, about 60 seconds less than that.
 
LOL.
Now it's close to 600.
 
could do this all day
 
@MathieuGuindon you seem pretty opinionated on the topic... dimensioning variables at the top of a subroutine as opposed to right as they're used... beyond possibly causing one to scroll up to find the variable type, is there another downside? having inflated my code by ~2x for dimensioning as used, i am thinking about going back
 
Until 3:30 :D
 
6:12 PM
> having inflated my code by ~2x for dimensioning as used
I don't understand what that means
declaring variables as you use them made you write twice as much code?
 
But how?
 
sorry, not inflated the actual code... the space down the module (readability problem), causing me to have to scroll, as opposed to dimension types at the start which allows everything to stay in view at the same time
obviously it would be subjective, but i'm curious your thoughts
 
"as opposed to dimension types at the start which allows everything except the variable declarations to stay in view at the same time"
which is the whole point
your code isn't shorter if you declare everything at the top
 
Your subs are also too big if you can't see everything.
 
6:14 PM
Try to keep them to 20 lines or less. Not all of them will reach that target, but you'd be surprised how many will.
Some people recommend 10 lines or less.
 
I shoot for 10, refactor at 30
+/-
just try declaring all variables at the top of procedure scopes in any other language, see the looks you get. there's a reason nobody wants to touch VBA code, walls of declarations completely out of context (is this used? oh. is this used? oh. is this.. why am I reading this?) have to have something to do with it.
and when there's 20 lines of declarations at the top of a method, the only thing you know right away is that the method is doing way too many things
 
^
 
I hate these declaration blobs... with a passion =)
 
further background, i had a coworker who has been trying to learn Excel-VBA and they asked me how i started and i told them i did my best to answer questions on SO (even if not posting, but to compare to actual answers) while also asking my own questions... so they took a look at a concatenation question that showed up for Excel and asked about my thoughts on a quick way of doing that and i wrote this to them:
 
10 is too many. 3-5 is optimal. More than 5 means it's probably doing too much.
 
6:19 PM
Sub test()
    Dim arr As Variant, brr As Variant, crr As Variant
    arr = Range(Cells(1, 1), Cells(Rows.Count, 1).End(xlUp)).Value
    brr = Range(Cells(1, 2), Cells(Rows.Count, 2).End(xlUp)).Value
    ReDim crr(UBound(arr) * UBound(brr))
    Dim i As Long, j As Long, k As Long
    For j = 1 To UBound(arr)
        For k = 1 To UBound(brr)
            crr(i) = arr(j, 1) & brr(k, 1)
            i = i + 1
        Next k
    Next j
    Cells(1, 3).Resize(UBound(crr) - 1).Value = Application.Transpose(crr)
i thought ```` would create a snippit in here... my bad; lost the indents
 
I don't think chat has that? Either way, it's just three.
Yeah, chat didn't get it :D
 
as i wrote that, i stopped to think back to declarations/dimensioning in general, so figured i'd ask, as in this case non-grouped arrays or longs would essentially double the length of the subroutine. hence asking for your opinion
@Hosch250 thanks for checkign ~_*
 
@Cyril fixed :)
 
Well, I'd not group them in any other language (see the types problems in C and derived languages).
Not sure what the VBA thought on this is since you can't assign them inline anyway.
 
@Hosch250 that would be the overarching issue... (var i = 0; i++) would make things too complex!
 
6:23 PM
the problem with same-line declarations is that it gets annoyingly difficult to quickly locate a specific variable in the list - especially if the data types are implicit (and with explicit data types, it just looks way too crowded for comfort)
 
@MathieuGuindon thanks; guess i just needed to put the spaces?
 
Public Sub Test(ByVal ws As Worksheet)
    Dim arr As Variant
    arr = ws.Range(ws.Cells(1, 1), ws.Cells(ws.Rows.Count, 1).End(xlUp)).Value

    Dim brr As Variant
    brr = ws.Range(ws.Cells(1, 2), ws.Cells(ws.Rows.Count, 2).End(xlUp)).Value

    Dim crr As Variant
    ReDim crr(UBound(arr) * UBound(brr))

    Dim j As Long
    For j = 1 To UBound(arr)
        Dim k As Long
        For k = 1 To UBound(brr)
            Dim i As Long
            crr(i) = arr(j, 1) & brr(k, 1)
            i = i + 1
@Cyril not quite.. there's a "fixed font" button that shows up when you write a multiline message
(it's hidden if your browser is too narrow, like docked at half-screen width like I had it)
so yeah, it's "longer" code.
now consider how "dense" the code is in yours vs mine
there's much more information packed per LoC in one vs the other
 
@MathieuGuindon copy
 
shorter code != better code, basically
in fact I'm very tempted to move the nested looping into its own procedure
 
i hear you on the density; in looking at one versus the other, it's about double the lines, which may or may not affect readability (e.g., i don't want to scroll lol).
 
6:30 PM
what I don't want, is to have to remember and mentally track variable declarations
I'll remember a handful, not many much more
 
@Cyril I struggled with that whole "Dim 'em as you use 'em" concept for a while, too. Now it's second nature and I look at my own code funny when I see a wall o'Dim.
 
would you make each loop its own function to output the final string to concatenat?
 
that might be overkill :)
 
lol
 
but the inner loop body could be its own scope, yes
 
6:32 PM
@FreeMan i'm taking baby steps... i kept them grouped (variants together, longs together, etc.)
 
TBH, I look at the RD code that's posted and see a single { or } on a line all by itself and shudder. All that wasted space!! But, it does make it easy to see the scope of a conditional or loop. If there's too much to fit it all on a screen, the method is probably doing too much.
 
what bothers me, despite it not being an executed line, is having a dim within a loop. something about that just feels so wrong
 
I'll grant you that
but, refactoring is so, so, so much easier that way
 
Especially since Extract Method has been extracted from RD.
 
i can see that; when i hear refactor i think "ctrl+H" but small groupings feels better
 
6:35 PM
I'm thinking Ctrl+X refactoring here :)
 
ahh
 
like, cut this chunk, paste it into another scope
 
<-- still learning a lot of the appropriate terms to speak with persons of legitimate scripting background
so my experience in "refactoring" has been "you used 'arr' but it needs to be more descriptive, so fix that crap"
 
@this maybe my Outlook got borked over the weekend... Even using your routine, it's giving me an RTE 429 on Set o = GetObject(, "Outlook.Application")
 
guess it's just the fancy word for "optimize" in the grand scheme of things...
 
6:38 PM
@Cyril Refactoring is also extracting methods - like pulling your loop out of your posted code and making it a stand alone method that's called.
 
By having all the Dims right before they're used, it's easy to cut exactly what's needed, paste it into a new method then pass in the 1 or 2 variables it needs to work with.
 
bingo
at least until RD can do the extract method and cherry-pick bricks from the Great Wall of Declarations At The Top :)
 
i hear you; was getting that from hosch/mat as well, but was hung up on the term being used
 
related: "refuctoring"
 
6:42 PM
i know we joked about it a week or so ago based on a post on SO, but i have seen a significant amount of moving variables to global variables to avoid having to find what you want
 
> The process of taking a well-designed piece of code and, through a series of small, reversible changes, making it completely unmaintainable by anyone except yourself.
 
"dim i as long" 'but i have to do it every time' "public i as long" 'nice'
 
@MathieuGuindon Is that why the US seceded from the UK? Because we were in our own great wall of colonies stuck up on the wall and not integrated properly?
 
@MathieuGuindon lol, job security
 
@Cyril Vertical monitors help with scroll area. But I also agree that if you can't see what's going on without scrolling too much is being done. Simplify it.
 
6:43 PM
@Cyril the globals of today are the bugs of tomorrow :)
 
^ That should be a tweet.
It was difficult to think in terms of having code do 1 thing. Now it's become easier and keeps code cleaner.
 
@IvenBach done
maybe one day @CodeWisdom will quote me on that!
 
to kind of stick on the semantic questions... VB has declarations (technically dimensions) where no type is assigned to the variable, but VBA has true dimensioning assigning a type to a variable. when i talk about dimensioning a variable, and mat keeps stating declaring... am i wrong or is it just a semantic point?
 
The ONLY time I use globals I stick them in a PublicVariables module and fully qualify them. That way they come up as PublicVariables.FooBar in my code and it's immediately apparent.
 
@IvenBach i name my module gvar for global variables, but just the same...
 
6:48 PM
Dsmvwlng s n gd. Mks cd hrd t rd.
Disemvoweling is no good. Makes code hard to read.
 
i surprisingly read that, but had to go back and think hard about what the "m" was for in de-voweling
had the wrong word
 
I can only condone it with the 31 character limit for module names.
 
copy
@Cyril @MathieuGuindon forgot to direct it to you
 
I'm just an acolyte of Mug. I don't really know anything.
 
@IvenBach i mean, he's the reason i'm even "here"
not in the biblical sense, but the in this chatroom sense lol
 
6:52 PM
He's the reason any of us are here.
Mug's like Johnny Appleseed. He spreads his seed far and wide. He freely shares it with everyone.
 
@Cyril the Dim keyword is indeed short for "dimension"; it tells the runtime how much memory to allocate for the variable. So, it does make sense. "Declaration" is more... abstract, I guess
@IvenBach no comment lol
 
@IvenBach getting biblical haha
 
@IvenBach You could also say he's like that doctor that invented in-vitro fertilisation.
 
@Hosch250 turkey-basting code-phonics at the world?
 
Who used his own, because he didn't have anybody else's.
@Cyril LOL.
 
6:57 PM
@IvenBach I'm just an acolyte of my mug, too!
 
:barf: Lessons learned. I don't care if a Worksheet has 20 named ranges or not. I care whether they exist so they can be used. Time to correct these tests.
 
7:12 PM
@IvenBach uh oh
 
7:41 PM
Ah, so there's no COM interop going on then, the package works directly with the OpenXML... which has pros ...and cons. Everything one knows about the Excel object model goes out the window, basically. — Mathieu Guindon ♦ 3 mins ago
I think I'd rather deal with COM interop
 
OTOH, with OpenXML, you can do it headless.
Just need a bit much more effort (and some a lot of grunting)
 
like I said, pros and cons
it's nice that it works on .net core though
 
8:05 PM
5100 seconds left.
 
#Breathe Hosch.
 
WHAAAAA! HAAaaaa!
That took about 3 seconds.
Story of my life:
 
@Hosch250 I think the image is broken. It's still loading. ;-)
 
...
@FreeMan You still using git for your local SC?
 
@IvenBach yup
Getting used to the quirks of Using OASIS-SVN to import/Export from Access.
Still on roll-yer-own for Excel
 
8:13 PM
And you're pushing from your working-directory/development to the "Main"?
 
yeah
 
How's that been working? I'm playing around with exporting and importing for the work I do.
Just about to start commits to track file changes.
 
#protip: be sure you have the structure you want; you don't want to do folder reorg later.
:-D
 
Do I hear experience talking in the wind?
 
hopefully not breaking, though.
 
8:18 PM
@this make sure to tell @FreeMan
particularly the names of the folders!
 
breaking, folding, spindling, mutilating, but otherwise, pretty much not a big deal...
:/
@IvenBach is good.
I need to get more in the habit of committing more often, though with OASIS, it's pretty easy to do so.
 
Yeah, thank goodness for ctrl + S
 
And I have a bit of a tendency to start a branch, have something critical come up, then it takes days to get back to the branch and I forget what I was doing.
#BetterNaming
 
otherwise, it's too easy to end up "ok, WTF did I do?"
 
#LearnTheFrigginTool!
 
8:21 PM
#AtomicCommits
 
Ctrl-S only exports the current code pane which is a real hassle - especially when you've done some sort of RD enabled refactor and it's touched several modules
Access says "you wanna save all these?" you say "sure, you go, bud!" then you forget what they all were because #habit.
 
@FreeMan I've been doing Issue####_Brief_description_of_what_branch_is_for has worked really well for me.
 
If I had issue #s, that'd be a good start.
I'm a dept of me, and I don't organize myself that well.
 
@FreeMan so quotable
 
@FreeMan That means it's easy to start. Glad I could help.
 
8:24 PM
Yeah, I should but should ≠ I will...
@Cyril feel free...
 
@FreeMan Yeah, I feel you. In that case, exporting only what change should work but you do have to pay attention.
 
@this and if a form changed in any way, you get a whole new .layout file even if it was only code changes. :/
but, for all the gripes, it's easier than the roll-yer-own I was doing
 
Yes that is unavoidable, unfortunately.
when you consider that they were using the model of check-out & check-in centralized SC, you can see why they didn't really worry too much about keeping the properties stable.
VSS FTL!
 
So nice to be a bit over 1k seconds closer to going home.
 
@Hosch250 sounds like watching paint dry has been exciting for you.
 
8:29 PM
I should get a job preventing pots from boiling.
 
at least he didn't have to watch baseball
@Hosch250 Ha!
 
@FreeMan oooo zing!
 
@this this does explain everything
 
#NotAFan
 
#Ditto
 
8:30 PM
@Hosch250 You have technical books to read. Get a head start.
 
@MathieuGuindon I don't think they even had branch-merge model back then? Not sure when it was a thing.
 
So, I read 3 chapters in my Azure book, 2 in C# In Depth 4th ed, and read F# documentation and learned some new stuff.
I can't process much more, TBH. I hit my brain's rate limit.
 
> 418 I'M A TEAPOT
 
uh.... I don't really think xcopy = SC
 
8:31 PM
@Hosch250 get some chocolate milk and you'll be rarin' to go again
is xcopy like robocopy?
 
@this When xcopy is all ya got, xcopy is SC
@Cyril yeah, but shorter
 
@this sure is... xcopy *.* x:\centralized_dev\latest
 
has anyone had issues accessing gmail via Brave?
 
<insert_facepalm>
 
lol
 
8:33 PM
@FreeMan I haven't.
 
hm... for some reason i'm drawing a blank on that function... xcopy can't mirror, right?
 
i thought xcopy = robocop, actually
 
...to the google
 
@Cyril No, it'll give me a migraine or something.
 
> XCOPY is particularly useful when copying files from CDROM to a hard drive, as it will automatically remove the read-only attribute.
lol
 
8:34 PM
49
Q: Difference between xcopy and robocopy

naveen marriI'm kind of new to batch scripting. As a newbie I find both both of them useful while scripting What are the key differences between xcopy and robocopy?

@MathieuGuindon survivable media at its finest
 
I'm getting a CookieMismatch page telling me there's an issue with my cookie settings . I need to enable, clear cache/cookies or adjust privacy settings.
 
never knew about robocopy #heathen_me
 
i only knew about robocopy, lol... for several companies i've consulted i used robocopy to mirror a network location to the XLSTART folder so we could have easily updated macros.
drop that bat in shell:common startup and win
note that if soemone uses xp they don't have robocopy (damn your computer, Della!)
pretty sure it's in 7+
 
ah! I finally found the listing of individual cookies. Searched for "google", deleted them all and I'm in like Flynn!
Robocopy was a stand alone install in the XP and earlier days.
used it in several previous lives for a variety of backups/mirrors
 
got'cha; so it was just native in 7+?
 
8:42 PM
probably vista but who cares
 
i forgot about vista lol
 
viwhat?
 
you know the one that Ballmer fell and rolled down, and broke his nod
 
@this who?
 
eh. a sweaty fat guy, I guess.
 
8:45 PM
no, what's on first, who's on second
@MathieuGuindon looks like it's right up your alley!
2
Q: AutoFilter vs ShowAllData

JvdVBackground: Since recently I came to know about a secret named range that gets created through using AutoFilter. Usually (if not always) this is called "_FilterDatabase". I thought about playing around with this a little, but then got stuck on the Range object it refers to. Let me explain with ...

 
@FreeMan Who's on first.
I think What was on second. And I Don't Know was on 3rd?
 
They were, but then nobody hit a single.
 
About 1500 seconds gone.
 
What do you need more clarification on? It is an example. I clearly stated that I do not know how to go about this, based on research I have done prior to asking this question; therefore I haven't tried anything. — atschoe 10 mins ago
hilarious #SOhumor, honestly
 
9:00 PM
@MathieuGuindon so you're the one that upvoted my comment lol
trying to be nice ='/
alright, after 1500, time to go home. have a good evening fokls
 
@Cyril you did very well
 
Hi all. So I'm on the new version and all seems well, except it's sorting my library projects wrong. The previous version was alphabetical, but this one isn't, and I can't get it to be. The sort button doesn't affect it.
 
hm, I wonder if we're even sorting project-level nodes
 
By cosmetic name or filename, it's backwards.
It was the other way in the previous version. It's also backwards chronologically.
Unless it goes by last-change date or something.
 
what I mean is, there's a non-zero chance that project nodes are ordered in just whatever order the VBIDE API gave them to us. need to check.
 
9:06 PM
Ahh gotcha.
So it's in collection order.
 
don't quote me on that, I'm still searching! :)
            foreach (var project in adding)
            {
                var model = new CodeExplorerProjectViewModel(project, ref updates, _state, _vbe) { Filter = Search };
                Projects.Add(model);
            }
yup, no sort
wait no, that's the backing collection - the view might define a sort for it
    <TreeView x:Name="ProjectTree"
              Grid.Row="2"
              Background="White"
              HorizontalContentAlignment="Stretch"
              ItemsSource="{Binding Projects}"
and it doesn't
so yeah, the project nodes are just added in whatever order the VBIDE loaded them
 
FWIW, I'd think it should follow the reference priority?
the current project should be always the first one.
 
loaded projects may or may not be referencing each others...
@this you're thinking Access and single-project
 
@MathieuGuindon but you have a node for each workbook, no?
within the workbook, you get a list of projects, right?
 
no
each workbook is a VBA project
 
9:12 PM
hmm. feels wrong.
no I'm wrong.
 
Excel can have multiple books opened, related or not
 
Right.
 
I agree with @spinjector that they should be sorted explicitly
 
hmm. sorry, I'm confused again - because I know that I get annoyed when Access loads an add-in, it comes up as another project
 
and now I'm curious whether & how the VBE's own Project Explorer sorts them
 
9:13 PM
but sometime it puts it in first
which feels wrong to me
 
sounds like PE isn't sorting them either then?
 
because I'm working with a current database project and the add-in project should be later.
yeah could be
 
but the add-in would be loaded first I believe
 
in this case, it's apparently alphabetically?
 
I think the fix should be to introduce a sort definition and a CollectionViewSource with Projects as the backing collection, and bind to the CVS instead of directly to the Projects collection
 
9:16 PM
Now you have me wondering, I don't recall what Access does. I can't recall if I have any code libraries set up in any ACCDB files.
 
@this E-D-B?
 
I had Default loaded originally.
 
does the CE have them in the same order?
 
I initialized the add-in, then it puts it in there.
let me see
(fwiw, CE didn't pick it up - guess not reparsing on project adding?)
huh?
reparsing still not picking it
 
@this locked?
 
9:18 PM
?application.VBE.VBProjects.Count
 2
ah yes
it is
we still don't load locked project (yet).
 
won't show up in CE until we flick the switch on TypeLibAPI
 
^
anyway, because lot of Access' add-ins (wizards in this case) usually start with ac, I think it get to load in front of other projects
which makes it really annoying
 
...so they are sorted
(?)
 
need more testing to be sure.
let me see if I can trip up another addin
 
@spinjector can I steal that for a GH issue?
 
9:22 PM
Less than 500 seconds to go.
 
> Code Explorer project nodes are not explicitly sorted anywhere. This results in non-deterministic project node sorting.

![image](https://user-images.githubusercontent.com/5751684/69377661-c04c7100-0c7a-11ea-8c9e-a3e42cde3168.png)

Let's wrap the ViewModel's `Projects` observable collection with a `CollectionViewSource`, bind the XAML to this CVS, and explicitly have an alphabetical sort definition.
 
 
so I guess so? Note, however, the VBA project name file name has no relevance.
 
9:25 PM
either way, it feels wrong to me because Default is the one that I have open. I don't know how that'd work w/ Excel, though.
 
I'd go nuts if the project nodes started re-sorting depending on what code module I'm looking at
 
Yeah, that'd be no good either.
 
have the node say "I'm the active project", but don't mess with the ordering :)
 
My beef is mainly that the add-in's projects get to go after the active project
but I am not sure VBIDE API tells us whether a project is an addin project
 
^ a project is just a project
 
9:27 PM
I think as long CE bolds the active project it might help but still... :\
 
keeping it bold will be a PITA
 
++AvalonMention;
need Avalon for that.
;-)
 
I could've sworn I had the active project listening at some point?
The only problem was it spun in an infinite loop because it kept trying to feed the data back to the PE, which fed it back to the CE...
 
yeah the IDE event model has evolved quite a bit since then
 
9:30 PM
OK.
Well, TTYL!
0 seconds!
 
-1
later!
 
@Hosch250 FREEEEEEEEEEEEEEEEDOOOOOOOOOOOOOOOOOOM!
Duck check: Is there a problem using literals in an assert? Assert.AreEqual True, actual where actual is of type Boolean?
WTF... That should be Assert.IsTrue actual.
What was Past-Iven even doing?
 
Yep
 
@IvenBach love this! :)
 
@IvenBach Happy Birthday!
 
9:36 PM
I'm glad I caught it before someone else pointed it out.
Better to catch your own mistakes and own up to them.
@M.Doerner Thanks.
 
@MathieuGuindon Sorry, I had to take a call, If you mean can you use my screenshot, sure go ahead, there's nothing sensitive in it.
For the project sort issue, that is.
 
10:10 PM
:starry-eyed: Wow... Setting up these local network repos and using them is something magical.
It feels like I have #ThePowah.
Must remember it's all a facade. When I FUBAR it real gewd and it comes tumbling down it'll teach me I've so much to learn.
 
@spinjector thanks - figured chat was already public, created the issue anyway :)
 
ActiveWorkbook.Worksheets(ActiveSheet.Name).{whatever}
we need to be able to warn about this.. somehow
 
@MathieuGuindon mind bends
 
10:21 PM
doesn't Worksheets return a Variant whereas ActiveSheet would have been a WorkSheet?
 
ActiveSheet is Object
 
Ok. if it was, that'd be even dumber
 
but yes, Worksheets returns a Variant
 
You can have a chart sheet.
 
and Workbook.Worksheets can yield another Sheets collection if you give it an array of sheet names
(Workbook.Worksheets is a Sheets object)
 
10:23 PM
not sure we can do this without coding some kind of list, similar to what we did for _Default.
 
@MathieuGuindon Please do an article on why some objects return variant when you'd expect a specific type. That alone was a monumental understanding for me.
 
^ FWIW, it still surprises me that Excel's collections aren't strong-typed.
Access' collections are.
 
#convenience
#quicktype
 
you mispelt "quacktype"
 
10:24 PM
>:-D
 
False positive?
Private Sub Foo()
    Debug.Print Bar(Sheet1)
End Sub

Public Function Bar(ByVal ws As Worksheet) As String
    Bar = ws.Name
End Function
'Argument with incompatible object type' doesn't make any sense.
Reading rubberduckvba.com/Inspections/Details/… gives me more confidence it is a false positive.
 
That made me chuckle:
?typename(sheet1)
Empty
Gonna lurve dem default members
?typeof sheet1 is worksheet
False
FML. Sheet1 doesn't even exist. Hooray for implicitly declared variables in immediate!
 
10:43 PM
I always have a Sheet1 because of Personal.xlsb.
 
That helps, I guess. The above is gibberish because I had opened battleship and it doesn't.
one'd hope that VBIDE would be kind enough to go "what? I don't see no Sheet1 here!"
but noooo, it has to go "gee, I don't see it, so I'll just make it out of thin air! Here's some nonsensical answer about the Variant I just created for you!"
 
Hello, what's up?
 
11:02 PM
@IvenBach because RD is not seeing that Sheet1 is a Worksheet; known & reported already
@FreezePhoenix been a while, welcome back!
driving home, bbl
 
@IvenBach That was reported already just two days ago.
 
@MathieuGuindon Approximately 1 year. Same length as my chat suspension. Must be a coincidence. Excuse the sarcasm xd
 
11:31 PM
Day late and a dollar short.
Rather it be reported twice and fixed than ignored to fester.
2
 
@FreezePhoenix oh. makes sense! I'd recommend playing nicely by the rules now =)
Don't hesitate to LMK if you want to talk privately about it
 
00:00 - 18:0018:00 - 00:00

« first day (1994 days earlier)      last day (1186 days later) »