« first day (2372 days earlier)      last day (44 days later) » 

12:01 AM
[MDoerner/AdventOfCode2020] 1 commit. 1067 additions.
[rubberduck-vba/Rubberduck] 3 opened issues. 2 issue comments.
[Minesweeper] Games Played: 161, Bombs Used: 106, Moves Performed: 23840, New Users: 14
3 hours later…
3:29 AM
2 hours later…
2 hours later…
7:09 AM
> The extra line(s) occurs when all fields are wrapped in the private type and no other members exist. Both `Foo` and `Bar` are wrapped.
Option Explicit

Public Foo As String

Public Bar As String
Option Explicit

'Two Extra blank
'lines included
Private Type TModule1
Foo As String
Bar As String
End Type

Private this As TModule1

Public Property Get Foo() As String
Foo = this.Foo
End Property

Public Property Let Foo(ByVal RHS As String)
6 hours later…
1:22 PM
@IvenBach You opened the issue, so it's officially your idea!
2:18 PM
> **Rubberduck version information**
OS: Microsoft Windows NT 10.0.18363.0, x64
Host Product: Microsoft Office x86
Host Version: 16.0.13328.20408
Host Executable: EXCEL.EXE

A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
Updated to 5676 just now and went to Rick-click>Rubberduck>Ignore Module... and there is no right-click RD menu

**Expected behavior**
The menu would be there in all its bla
3:11 PM
3:55 PM
I'm looking at what's occurring when an encapsulate field command is invoked. Currently within IModuleRewriterExtensions.RemoveVariables(...) working to understand what a VBAParser.VariableSubStmtContext represents.
Is it the representation of a statement that declares a variable within a Sub?
4:08 PM
I cannot give you a very good answer - but I can tell you it has nothing to do with being in a Sub.
To investigate this kind of thing, I find it easiest to run code to a breakpoint where the context type of interest exists - and start looking around at the Parent and Child contexts.
Currently in the process of doing that.
I can't get over the hurdle of understanding how VBAParser tokens work.
The definition variableSubStmt shows that it contains an identifier.
I can't find IsTokenType(...) in the file.
Iven needs to learn basic parser concepts to have a foundation.
@IvenBach chat.stackexchange.com/rooms/14929/conversation/… reading when we make time for it.
4:39 PM
> I would like to elicit some feedback/reactions around the notion of developing a DeclarationProxy capability. The idea is that a DeclarationProxy is a mutable Declaration that can be setup and used in various refactoring related operations in lieu of, or in combination with, an actual declaration. Further, each DeclarationProxy encapsulates the capability to generate itself as a formatted block of code. The discussion(s) relative to #5648 and #4100 motivated me to initiate this disc
5:16 PM
Q: Count the status messages in a column VBA

QuickSilverCan someone review my code and provide feedback. For context in column A will be a status message of "OK" or "NOK" and this little function just counts the number of times this appear so I can update a label in another procedure. Not too sure if this is the most efficient way of doing this becaus...

5:44 PM
I'm finding that the built-in conversion functions like CDate and CVDate are very annoying to use. They suck when you have no control over the input so a zero-length string gets you a type mismatch error instead of a Null or something.
@QuackExchange I like the easy ones... :)
6:11 PM
@FreeMan yep. It's surprising how often the wheel is reinvented.
Do you need that comparison often enough to warrant creating BeltsNSuspenders.CDate(...)?
@IvenBach in this case, it's a part of query
so it'll be a hot path that could get called thousands of time
e.g. SELECT CastAsDateSafe(SomeLameTextThatShouldBeDate) FROM AMoronicTable;
6:37 PM
Hey, you've got access to AMoronicTable too? No wonder it's so slow, both of us are hitting it and it's not local to either of us!
lol. it's really annoying that there seem to be plenty of tables like that
"ooo, this own't let me save 2020-00-01. I know, I'll change that column from date to varchar(20)!"
The prohibition stems from - causing it to be treated as a string?
Using Nunit we can parameterize a test and add [TestCase(...)] supplying the arguments. That's not available in VBA, yet.
Is it reasonable to use a private helper function to return a 1D array of values based on a 1D array of test values?
no, not in this case. That owuld work for Excel, maybe but in this case, this function is called for each row in the table
so it's always a scalar input & scalar output
Oh sorry. My last 2 messages are a separate thought.
I forgot to state my context switching.
ah ok, was wondering how nunit got in the conversation
6:48 PM
#Words ~.~
This is regarding a unit test I'm currently on.
yes, a cheap way to get it going would be to abuse Array() function
^ which is my current idea.
Instead of Detail_1s_returns_30, Detail_2s_returns_18, etc. I consolidate them all into single test Details_return_expected_results.
this is annoying. I apparently can write the null-safe version in 2 ways -- one that performs well for good inputs but poorly for bad inputs. Other that performs poorly for good inputs but good for bad inputs.
Combine the two for poor performance for everything!
Public Function CastAsDate1(InputValue As Variant) As Variant
    If IsDate(InputValue) Then
        CastAsDate1 = CVDate(InputValue)
        CastAsDate1 = Null
    End If
End Function

Public Function CastAsDate2(InputValue As Variant) As Variant
    CastAsDate2 = Null
    On Error Resume Next
    CastAsDate2 = CVDate(InputValue)
    On Error GoTo 0
End Function

Public Sub doz()
    Dim o As Variant
    Dim v As Variant
    Dim r As Variant

    Dim s As Date
    Dim e As Date

    Dim d As String
running the test doz yields results like this....
CastAsDate1    Now()        4001          4046           45
CastAsDate2    Now()        4046          4110           24
CastAsDate1    ""           4110          4112           2
CastAsDate2    ""           4112          4130           18
CastAsDate1    "abc"        4130          4152           22
CastAsDate2    "abc"        4152          4230           38
CastAsDate1    Null         4230          4232           2
CastAsDate2    Null         4232          4233           1
CastAsDate1    0            4233          4234           1
CastAsDate1 does better with bad inputs, but CastAsDate2 does better with good inputs. WTF do I have to choose. What if it's 50-50? Fishing for alternative programming that can get a good perofrmance for both cases....
7:06 PM
> I ask because I found the Ignore functionality discussed in github.com/rubberduck-vba/Rubberduck/pull/5604. I used it recently yet now it doesn't appear anywhere.
7:18 PM
@this CastAsDate2 seems the most correct because you should work from the expectation that things will go well. Then work to make things go well before that call happens. Can you coalesce your empty strings to nulls before they are processed?
8:01 PM
If I'm coalescing, I'll be using some more VBA or a user-defined function. At that point, I might as well just do a Select Case and assigning Null if input is a zero length string.
8:44 PM
@this if you have control of the DB you could disallow zero length strings and run an update command that changes all zero length strings to Null.
Allow Zero Length property = False
9:06 PM
@HackSlash If I had control, I wouldn't have to write massaging query to clean up data.
@this, if you are already using a query can you make it return nulls instead of ZLS for that field?
@HackSlash that's exactly what I'm doing - writing a function that will convert all crap inputs into Null.
Because CDate() is too dumb to deal with a Null, and while CVDate() can, it can't deal with a ZLS.
Oh, I am suggesting to do that in a query instead of VBA. Not sure if it's faster or not.
that would be ugly and we're taking about several columns
so t.aMoronicColumn AS CleanData would get morphed into IIf(Len(t.aMoronicColumn & "") = 0, Null, CVDate(t.aMoronicColumn)) AS CleanData. Repeat for several more columns.
9:17 PM
it might be a bit faster since it can use native functions without going into VBA but it wouldn't be very easy to write. We often need to write one-shot queries and for that reason I'd rather write CastAsDateSafe(t.aMoronicColumn)
FWIW, this seems to give best performance for all cases:
Public Function CastAsDate3(InputValue As Variant) As Variant
    If Nz(Len(InputValue), 0) = 0 Then
        CastAsDate3 = Null
    ElseIf IsDate(InputValue) Then
        CastAsDate3 = CVDate(InputValue)
    End If
End Function
but TBH, I find it very very annoying that I have to write a low level function just because the built-in conversion functions are too dumb.
Interesting. How is that better than just checking IsDate? Also, null being the default state in a function it seems that assigning null is superfluous.
no it's not
for a funciton that returns a Variant, it returns a Empty if you never assign to it
which is not same thing as Null
wow. TIL
Hmm. now you're right - IsDate() is tolerant of nulls and ZLS already.
I thought I had a case where it failed
so yeah, I could just get rid of the nz/len check
actually that's the CastAsDate1 version
and that is much slower than the CastAsDate2 version
Mind you, that's when considering the good input case as you can see here:
3 hours ago, by this
CastAsDate1    Now()        4001          4046           45
CastAsDate2    Now()        4046          4110           24
CastAsDate1    ""           4110          4112           2
CastAsDate2    ""           4112          4130           18
CastAsDate1    "abc"        4130          4152           22
CastAsDate2    "abc"        4152          4230           38
CastAsDate1    Null         4230          4232           2
CastAsDate2    Null         4232          4233           1
CastAsDate1    0            4233          4234           1
2 hours later…
@Duga Hmmm...Trivial change - all tests pass locally.
Found this message in the AV output: An error occurred while sending the request.
The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
The remote certificate is invalid according to the validation procedure.
GET https://api.nuget.org/v3-flatcontainer/microsoft.codeanalysis.analyzers/index.json
GET https://api.nuget.org/v3-flatcontainer/system.xml.readerwriter/index.json
Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/system.console/index.json'.

« first day (2372 days earlier)      last day (44 days later) »