« first day (159 days earlier)      last day (3021 days later) » 

12:00 AM
Yup. I'm deleting all the registry keys, backing up my work, and hard resetting local master... Enough' enough. =)
 
That is my bad. The good side is that renaming the project isn't going to be done again ;)
@RubberDuck been tinkering.. let's keep the [enhancement] label for addition of features to existing code.
otherwise we'll soon mix up new developments with actual enhancements
 
Hmmmm that makes sense I think.
 
like, making the todo comments configurable is one
 
I guess tying it to a milestone is label enough =)
 
^^ that
making SyntaxTreeNode retain code file position is another [enhancement] - the class is already implemented, but we're adding to it
 
12:12 AM
Can you add TodoItemsMenu.cs to the repo? It's missing.
I want to keep this clean this time.
 
ok hold on, I'll push my copy
 
Thanks.
 
done
 
Well...... shit. It built, but I'm still getting the same issue....
I'm out for today Mug. I'll dig into it tomorrow. Have a good one buddy.
 
 
4 hours later…
4:08 AM
0
Q: The stripping extensions

Mat's MugIn order to make my life easier with parsing some VBA code, I have written a few extension methods to extend the string type, and put them in this StringExtensions class: [ComVisible(false)] public static class StringExtensions { public static readonly char StringDelimiter = '"'; public ...

^^ yes, this means I managed to get the project to build again, after modifying the ISyntax interface and SyntaxTreeNode base class... and updating all implementations :)
 
 
2 hours later…
5:48 AM
ugh
> DimSyntax, GlobalFieldSyntax, PrivateFieldSyntax, and PublicFieldSyntax are currently implementing ISyntax; ConstantSyntax is currently derived from SyntaxBase.

As a result, only ConstantSyntax is included in the parsing, and multiple declarations are not supported.
I give up.. for now.
ugh.. and code block doesn't include its children :(
bed time
 
 
9 hours later…
2:36 PM
Too quiet. Everyone's working too hard.
 
Heh. Do you use interfaces in VBA ever?
 
Actually, yeah. Once in a while @enderland.
Admittedly, not real often. They're a bit of a PITA, so the use has to be pretty justified.
 
I spent some time yesterady learning about them. Seems like they could be useful in some situations, though, I'm not sure what ones yet :)
 
My favorite use case was one where I needed to write results to different places. So, I created an IOutput interface.
Then a Console and custom form that implemented it.
It let the consuming classes write to where ever they wanted without caring which one they were passed.
 
2:52 PM
13
Q: Extensible logging

Mat's MugWhenever I need logging functionality in .net, I use a logging framework, such as NLog. Obviously there's no logging framework for vba, at least none that I know of. As much as I love using NLog, the way it works, with targets, rules and loggers, was going to be way too heavy and complex for my ...

^^ my personal favorite use of interfaces
 
This one is mine. Write to a log or to the immediate window. Whatevs. UnitTest doesn't care.
10
Q: Unit Testing in VBA

RubberDuckUnit testing in VBA is... lacking. (What isn't lacking in VBA though?) Since I've become more interested in unit testing lately, I decided I needed something better than Debug.Assert(), so I started building this framework. Currently there is a ton of functionality missing, but since I'm new to u...

 
I should copy in some of these loggers
My current app sends error emails to me
 
> Maybe I'm tired, or maybe it's just good. I can't tell for sure at the moment, but I think you have some pretty solid code here. Good naming and formatting, as well as a very nice abstraction and use of interfaces.
Ummmm.... looks like it's just that good Mug.
 
:)
noticed that answer was all lonely and missing a checkmark
 
4:01 PM
@RubberDuck if you got a second I would like you to explain stackoverflow.com/questions/3872339/…
current answers are ... unbelievable to me
 
I don't understand the question.
 
> Other times I use

Set r = Range("A1")
^ try that with Option Explicit
 
> What's the difference between Dim and Set?
Uh.... one declares it and the other sets it....
 
nah, the question is "why does r=range("A1") work, to which the answer is "when usingcode like that you are not actually setting r to the range object, but the value of the range"
 
the short answer is "because VB allows you to be dumb"
 
4:06 PM
@Mat'sMug Why the hell doesn't that work?
Doesn't range return a range?
 
not if you use r=range("A1") as it implies a .value
 
Ohhhh crap. I don't have a workbook open... lol
 
> Dim r as Range
r = Range("A1")
 
the difference between Dim and Set is -18
2
 
that code will never work
 
4:07 PM
? (Asc("D") + Asc("i") + Asc("m")) - (Asc("S") + Asc("e") + Asc("t"))
2
hahahah
i know, what a terrible joke
 
ok guys, pivot table calculated field question
 
@vba4all Or 3. The similarity distance. =)
 
I don't understand how the code in that question never got questioned frankly
 
If have WeeksOfStock calculated as = IFERROR( (AvailableToSell+InWork)/('RecentSales (6)'/'Weeks (6)'),0)
is it possible to apply that same calculation to subtotals?
because sum and average don't make any sense for this
 
hey should I delete this answer?
 
4:13 PM
@vba4all wait, you're @mehow?
 
@Mat'sMug did you really not know that?
 
...yeah
 
@vba4all hahahaha over the top much?
 
@vba4all love it
 
Am I the only one with the same name? lol
 
4:22 PM
haha thanks
just made me a bit sad that answer didn't get any recognition ;(
i mean 1.3K views and only 2 upvotes
1 possibly from the OP...
so 1 spare on top that's just sad...
 
and I was a bit sad, not seeing @mehow on CR all this time...
2
 
Does this answer seem to capture OPs real intent?
0
A: What is the difference between dim and set in vba

RubberDuck Dim declares the variable. Dim r As Range Set sets the variable to an object reference. Set r = Range("A1") However, I don't think this is what you're really asking. Sometimes I use: Dim r as Range r = Range("A1") This will never work. Without Set you will receive runtim...

 
@RubberDuck SET reference if you want to add to your answer - msdn.microsoft.com/en-us/library/gg251642(v=office.14).aspx
 
Thanks! good call.
 
4:35 PM
It's wiki, so let's make it as complete as possible.
 
great
now anytime i see #91 mentioned in a question i can mark as a dup of your (that wiki) answer
2
btw. I am preparing some of the code i recently wrote in vba for review --- how weird does that preparing for review sound haha
i am reviewing my own code before i put it for a review
lol
 
doin' it wrong
 
Nah. That's not weird. I do it too.
In fact we encourage it.
That way reviewers don't pick on stupid things like indentation and naming. The way to get a great review is to get it so spotless that people have to address what the code does, not what it looks like.
 
i spent 2 hours today making a sscce from the entire project
@RubberDuck so true
 
@RubberDuck I've seen alot of non-indented VBA code at my company. I don't understand how people don't indent properly while writing code, its so hard to read perfectly left aligned code. Makes no sense to me
 
4:42 PM
Stab 'em </sarcasm>
2
 
24
Q: How to get the best value out of Code Review - Asking Questions

rolfl I have a project I am working on, and I would like some, or all of it reviewed, how can I ask for this review on Code Review in a way that produces the best possible value? This is not about a question being on-topic, or off topic. Rather, this is about making on-topic questions great qu...

@enderland listen to the Mug.
Or, actually, don't listen to the Mug.
 
^^ was going to say
 
oops, just stabbed someone, is there a Control+Z for that?
3
 
Just indent their code every time you see it. Then it's done and they get all crazy about someone else touching their code.
And then you can tell them that you had to so that you could read their code.
Takes a few times, but they eventually get the hint.
 
I wish there was someone at the company I work for who actually can write, even not indented code :P
 
4:48 PM
@vba4all be very very very careful what you ask for ;)
2
 
actually... i just lied
forgot there are 2 engineers who do some C++ but they never shared with me
maybe like once cause someone's loop did not work...
I guess I got too technical answering why it doesn't work and (unintentionally) scared them away for good :P
 
lol
2
 
interesting
 
Very
in The 2nd Monitor, 22 secs ago, by RubberDuck
Have y'all seen this yet?
 
5:04 PM
@vba4all i didn't know you could get ASCII codes from strings in VBA. I remember looking for it too...
 
@ptwales opposite of Chr() function
 
I specifically remember someone telling me that didn't exist...
 
@ptwales I think I remember using them in BASIC 2.0 on my Commodore 64...
@RubberDuck we need an installer for Rubberduck ;)
 
@Mat'sMug I wasn't alive for that. I think I am the youngest one here.
 
5:20 PM
Oh but when C64 was "hot" I was like 5 or 6.. it's only later when I was 12 or so, that I dusted the thing and discovered BASIC :)
 
my first computer was C64!!!
 
I like how they called 5.5" floppys "mini-discs"
 
I was using the Candy colored iMacs in elementary school.
 
5.25?
 
yeah 5.25
 
5:30 PM
the other ones where like 3.5 i think
 
I always mix 'em up!
 
@Mat'sMug we need an uninstaller for RubberDuck...
 
lol
 
Okay, I need an uninstaller...
 
fixed your registry yet?
 
5:32 PM
Haven't had time yet. Shoulder surgery sucks (and it wasn't even my surgery =P)
 
sounds painful
 
Yeah. It is.
Seriously though, I was investigating installers last night. We'll get there. Milestone?
 
yeah
 
The whole thing with my reg is weird. It's like it's hanging onto an old dll.
 
and I need to make the Parser class unit-testable. Tired of hooking up the EXCEL.EXE process and inspecting result nodes with a breakpoint.
 
5:35 PM
Yeah. That sucks.
 
damn, LogicalCodeLine and Instruction structures aren't in the repo
 
I was trying to think of a way to do the same for todolist. Break the logic away from the form and vbe.
 
I need to test this:
        private IEnumerable<LogicalCodeLine> SplitLogicalCodeLines(string projectName, string componentName, string content)
        {
            const string lineContinuationMarker = "_";

            var lines = content.Split('\n').Select(line => line.Replace("\r", string.Empty)).ToList();

            var logicalLine = new StringBuilder();
            for (int index = 0; index < lines.Count; index++)
            {
                var line = lines[index];
                if (line.EndsWith(lineContinuationMarker))
I spent a good amount of time yesterday, to make SyntaxTreeNode know which actual code line it belongs to
 
Some features will require working on a file anyway so attributes don't get lost.
I don't like this suggestion, but what about CodeModule.Find?
 
huh?
well, I made each LogicalCodeLine know its line position, and each Instruction know its LogicalCodeLine and start+end column position
so we'll be able to make a treeview of the code, and double-click any node and locate and select the corresponding code in the IDE
 
5:42 PM
> startline Required. A Long specifying the line at which you want to start the search; will be set to the line of the match if one is found. The first line is number 1.
But that's strongly coupled, and I honestly haven't looked at the parser much.
 
yeah, I'm currently using that to "goto test method"
public Parser()
{
    var syntaxType = typeof(ISyntax);
    _grammar = Assembly.GetExecutingAssembly()
                       .GetTypes()
                       .Where(type => type.BaseType == typeof(SyntaxBase))
                       .Select(type => type.GetConstructor(Type.EmptyTypes).Invoke(Type.EmptyTypes))
                       .Cast<SyntaxBase>()
                       .Where(syntax => !syntax.IsChildNodeSyntax)
                       .ToList();
}
^^ I'll consider the parser completed when it works.. even if it doesn't parse the entire language grammar
 
And still looks like gibberish to me. =)
 
it's a bit of reflection magic, to find all classes derived from SyntaxBase, call their default constructor, and return all instances that aren't IsChildNodeSyntax.
so it'll pick up EnumSyntax, but not EnumChildNodeSyntax
 
Ohhh. Okay. I think I see what you're doing there.
 
basically the parser will "just work" without any modifications, as we implement the grammar
this is the part I need to decouple:
        public SyntaxTreeNode Parse(CodeModule module)
        {
            var project = module.Parent.Collection.Parent;
            var component = module.Parent;

            var publicScope = project.Name;
            var localScope = string.Concat(project.Name, ".", component.Name);

            var content = SplitLogicalCodeLines(project.Name, component.Name, module.Lines[1, module.CountOfLines]);
            var memberNodes = ParseModuleMembers(publicScope, localScope, content).ToList();
so basically a LogicalCodeLine solves the line continuation problem
and Instruction solves the multiple-instructions-per-line problem
I'm still figuring out how SyntaxTreeNode, ISyntax/SyntaxBase and Instruction will play together in ParseModuleMembers
I have a recursive ParseCodeBlock method that doesn't seem to work, and ParseModuleMembers is fugly as hell.
so I need to write some tests... ASAP.
 
5:56 PM
Well, we need a more abstract type of CodeModule. It needs a project name, component name, and lines. Inject the properties I suppose. Then that class's constructor can either take in an actual CodeModule, or those properties directly.
Right?
 
yep
or actually, I was thinking of just passing in these strings directly into the parser
I think the VBA namespace might end up mootinating pretty much the whole Reflection namespace.
Reflection exists so that unit tests can be located
but the syntax tree will make it pretty easy to locate public methods that start with Test, or comments that start with todo:
CodePaneExtensions will be useful though... but I'm not sure Reflection is appropriate for a name anymore
actually, perhaps the Reflection namespace might end up with some COM-visible helpers so that VBA code can do some reflection magic
allright.. cigarette time, and then back to work
 
 
3 hours later…
8:52 PM
LOL. I spent an hour or so today explaining bitwise conditionals to my coworker today.
That was fun...
I don't see what's so confusing about this
 publisher.PrintPDFs RptBItem + RptItemActivity + RptNewItem + RptPrintList
</sarcasm>
 
They're enums?
 
Yeah.
Public Enum RPubReportType
    RptItemActivity = 1
    RptNewItem = 2
    RptBItem = 4
    RptComsNotFed = 8
    RptVoided = 16
    RptPrintList = 32
    RptAllVoids = 256
    RptAll = RptItemActivity + RptNewItem + RptBItem + RptComsNotFed + RptVoided + RptPrintList
End Enum
I need to change that though. I saw someone do it in actual powers of two and it's much cleaner that way.
This is the PrintPDF signature.
Public Sub PrintPDFs(ByVal rptType As RPubReportType, Optional runAsSamples As Boolean = False)
He was confused about why I was adding all of the enums together and passing it into a single parameter.
Then this really blew his mind.
   ' If one of the reports supplied is a standardReport
    If rptType And standardReports Then
       'Debug.Print "Standard Reports - rptType: " & rptType

        If runAsSamples Then
            RunStandardReportsAsSamples rptType
        Else
            RunStandardReports rptType
        End If
    End If
 
9:08 PM
I saw someone do it in actual powers of two and it's much cleaner that way.
whistles
 
Was that a Mug that I saw do that?
 
Can't remember which post, but yeah ;)
 
RptItemActivity = 2 ^ 0
RptNewItem = 2 ^ 1
RptBItem = 2 ^ 2
RptComsNotFed = 2 ^ 3
RptVoided = 2 ^ 4
RptPrintList = 2 ^ 5
Yeah. That looks a lot better, doesn't it?
 
:)
 
9:24 PM
Great.. way to go Security.... just scare people away from using Google drive.
Like it wasn't hard enough getting people to switch to begin with.....
 
10:00 PM
@RubberDuck story time?
 
10:14 PM
Oh. We had a new training module at work actively discouraging people from using Google Drive.
 
lol
 
It's a great tool and yet the umm... more mature associates don't want to use it already.
 
mature associates geezers
 
That ^
I don't get it. Spend a crap ton of money to use google's services and then tell people not to use it. Smh...
 
They paid for google drive and told people not to use it?
 
10:23 PM
"don't use it, you can't do VBA with that crap"
 
Yeah @ptwales. Seriously.
 
What were their reasons? Scroogle?
 
No @Mat'sMug, but you can use JAVAScript.
 
"don't use it, everybody can google our sales figures"
 
THEN DONT PAY FOR IT
 
10:28 PM
Lol. Yeah. More or less that ^
It's because the data is all stored on Google's servers, not ours.
 
That's a fair claim.
 
"can we not host our own cloud?"
 
Which is ridiculous because they had to have known that before we switched from Lotus
 
You totally can host your own cloud if you want to spend the time setting it up.
 
Again it comes down to "THEN DON'T PAY FOR IT!"
 
10:30 PM
I'm sure there are others like that.
 
hmm
 
if they don't like OpenSource stuff
 
Lol. Open source...
> but people can see the code!
> Thats obviously a security risk...
Sorry guys. Feeling cynical about the corporate world today.
 
11:09 PM
I think I'm losing my spot as #1 all-time C# reviewer tonight at recalc!
I won't let that happen in the VBA tag, @RubberDuck! ;)
 

« first day (159 days earlier)      last day (3021 days later) »