« first day (1057 days earlier)      last day (2123 days later) » 
00:00 - 18:0018:00 - 00:00

6:00 PM
gosh, 2PM and I haven't had lunch
bbl
well one problem without much work-around, is everything that's late-bound
i.e. we need to literally interpret the code to resolve the type
other than that, RD knows everything about anything that's early-bound. I mean everything.
latest released resolver works with roughly ~50K declarations in I don't even know how many scopes, just for a basic Excel VBA project with an empty UserForm and no code anywhere
v1.4.3 had roughly 500, all manually hard-coded
 
Thats pretty comprehensive
Nice
 
what's impressive is that we managed to get much, much faster at resolving things, while going orders of magnitude more detailed in every aspect
 
@BrandonBarney I always avoid causing errors if possible too. But yeah, I always have to loop through the sheets for that particular need.
 
@Duga and this is what keeps us going =)
@BrandonBarney we're loading the COM libraries a project references, and scrape everything we can from them. That takes a little more than a second - that's what's going on when parser state says "loading references"
 
6:18 PM
Makes sense, I wouldnt have thought of that approach
 
The shit VBA7.DLL does... you wouldn't believe
 
> I did an up date yesterday but that didn't seem to change anything.
 
VBA is a huge mess of a hack, is all
 
I just found this neat little gem from a previous project:
 
I should've been fired.
lol
 
@BrandonBarney ouch
 
I remember doing it too
I have no clue why I didnt just do something more appropriate lol
Like a "Find" and "xlToRight"
Then again, in fairness, this was the first time I used "Find", "End" and Arrays
I was a pretty big VBA noob
 
I can't even see that image but I am 90% sure I've done more shameful things haha
@Comintern I think it was you that explained to me about models. And now here I am testing something, and I needed to change a Max value from 20,000 to 1,000 for testing purposes, and I was able to change a single number rather than rewriting it in a ton of places. Basic programming stuff, but so so appreciated.
 
Basically I did an Xlup to find the grand total row, and then kept trying .Offset(i,0).ShowDetail. This all being wrapped in an On Error Goto Err, Resume where i would increment by 1.
And I definitely have done worse lol. For this project I stored literally all of the data I was compiling on separate worksheets.
 
6:38 PM
> 2.0.13 and VBA 6.5
On Fri, Apr 28, 2017 at 2:21 PM Mathieu Guindon <notifications@github.com>
wrote:

> Which version are you running?
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/rubberduck-vba/Rubberduck/issues/2993#issuecomment-298071020>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AYKNc3WZZDFxy39A5fQUlQboAWeUgNfKks5r0i4wgaJpZM4NLqcw>
> .
>
 
a line label named Err is an interesting way to test RD's resolver
 
lol
That was far before I knew about the Err class
 
@Hosch250 You there? I can't make sense of the first example msdn.microsoft.com/en-us/library/cscsdfbt.aspx
 
@BrandonBarney I wish Err was an object/class
if that were the case we'd pick it up from VBA7.DLL
but no
it's one of the many hacks in VBA
 
What is it then? I assumed class by its functionality
 
6:40 PM
me too
 
> @retailcoder I think we can put them on another channel outside the lexer. The CommonToken has a settable field for the channel. So I think we can rewrite the channel during preprocessing.
 
Err is a function in VBA.Information that returns an ErrObject
 
Ok, fair enough, makes sense I guess.
Cant you set the properties of it though?
Like Err.Number = 1
 
yup
 
Thats where I get hung up. I thought only objects had properties
 
6:44 PM
Public Property Get Foo() As Whatever
^ valid in any module type
 
Was not aware. Good to know. Limited usability I would imagine though
 
#ThingsLearnedWorkingOnRD
 
@IvenBach This? Base b = d as Base;?
That is basically a soft cast.
If d can be cast to type Base, b is d exposed as a Base. Otherwise, b is null.
@Mat'sMug You know how you can register event handlers in lambdas in the ctor in C#?
Can you do that in VB.NET?
 
probably
using some fugly syntax
 
6:52 PM
I can't figure out how.
 
SomeEvent += (sender, args) => { ... };
right?
 
Looks like you use WithEvents and Handles, and it automatically registers it.
@Mat'sMug Yeah.
Or: AddHandler c1.AnEvent, AddressOf EventHandler1
 
so `SomeEvent += Function(sender, args) => ... ... I don't know
Dim action As Action(Of Item) = Sub(x) Console.WriteLine(x.Items)
damn that's ugly
 
SomeEvent += Sub(sender, args)
                 [do stuff]
             End Sub
 
6:56 PM
        Public Sub New()
            AddHandler SomeEvent, Sub()

                                  End Sub
        End Sub
        Public Event SomeEvent()
 
Is object[,] similar to variant[,]?
 
pukes
 
And by variant[,] I mean VBA variant(,)
 
yeah. in .net anything and its mother is an object
like in COM a Variant can be anything and its mother
 
6:58 PM
@Hosch250 I'm trying the code but the result isn't making sense.
 
Why not?
@Mat'sMug Doesn't work--you can't assign it.
You have to use AddHandler.
 
ok, I officially hate VB.NET
 
@Mat'sMug So does Johan Larsson.
 
I don't blame him
 
He wants me to make it crash VS if it detects VB.NET in use.
 
6:59 PM
lol
public class VisualBasicUserException : Exception { ... }
nah, too ambiguous
whatever
 
@BrandonBarney so how's that VSTO code coming along? got a clean exit yet?
 
It exits clean (I think), but I am working on managing the data now lol
 
@Hosch250 From Console.WriteLine(b.ToString()); I get "Base"
 
@IvenBach Of course.
Oh, hmm.
 
7:04 PM
if you run it 10 times and there isn't 10 EXCEL.EXE processes in task manager, you have a clean exit :)
 
They probably overrode ToString().
 
If I move public override string ToString() to class Derived : Base run it I get the same.
 
public override string ToString()
{
    return "Base";
}
Yup.
 
I sometimes have Excel processes hang. But that could be because I am not checking my code as much as I should before I run to debug
 
Duh.
 
7:05 PM
I can get clean exits if I look for unclean exits though
 
object defines a method called ToString().
 
*virtual
 
Normally, it returns the full type name, but if you override it, it returns whatever you say.
 
After moving it since b is coming from d's base shouldn't it not be coming up with "Base"?
 
You are saying you want it to print Base when you have it.
@IvenBach Internally, it is still a Derived, so that makes sense.
 
7:06 PM
@IvenBach learning about inheritance I see! keep it up!
 
It doesn't always have to create a new object.
Sometimes it will, but not always--in particular, interfaces and base classes.
 
I was expecting it to print the full location.
I've done inheritance before but am trying to under stand the as keyword.
 
Is .Value an object?
C#
 
From a range? yup
Even if that's an int
 
How do I declare an object for it? And seriously though? Why would they make it so complicated.
 
7:14 PM
Duh Check: everything in C# is an object?
 
@IvenBach correct.
 
I'm seriously gonna need to research better object management then
 
Everything inherits ToString and GetHashCode from System.Object
 
@BrandonBarney I forgot the "?". It's not a sleight against you. I "Duh Check:" with the RD team constantly.
 
7:15 PM
Cause half my code is Foo foo; Marshal.ReleasecomObject(foo);
I know Iven lol
 
well, there's a distinction
you have value types and then reference types
struct and class everything else, respectively
my knowledge of how the runtime (CLR) works gets foggy at that level though
 
namespace Rextester
{
    public class Program
    {
        class Base
        {

        }
        class Derived : Base
        {
            public override string  ToString()
            {
 	             return "Base";
            }
        }

        public static void Main(string[] args)
        {
            Base a = new Base();
            Base b = new Derived() as Base;
            Derived d = new Derived();

            if (b != null)
            {
                Console.WriteLine(a.ToString()); //expected result: GOOD! (Rextester.Program+Base)
 
but basically the CLR is cheating a bit, and a struct gets allocated on the stack, while reference types get allocated on the heap. but that's low-level memory management stuff that you don't need to care about
basically an Int32/int isn't allocated the same way a string or Worksheet is
 
Can someone clarify my knowledge disconnect of Console.WriteLine(b.ToString());
Does it stem from the fact that Base b = new Derived() as Base; isn't actually getting it from it's base?
 
there's the declared type, and then there's the runtime type
welcome to the rabbit hole of type and overload resolution
 
7:20 PM
So, if I understand correctly, the reason why ComInterop is so messy and a pain is because we have to deal with memory management ourselves, whereas without InterOp the memory is managed automatically?
 
COM interop does a lot of things for you :)
 
@Mat'sMug Not necessarily.
 
@Hosch250 roughly summarized
 
Jon Skeet or Eric Lippert, or both, have written articles on that common myth.
 
I know, I read them
 
7:22 PM
@Mat'sMug This for me?
 
yes
 
So it's declared as Base b = new Derived() as Base; which means it should be the base type? but it's actually the derived? Because of it's run-time type?
 
it's always the derived, that's what's being new'd up
but the code sees it through its base interface
try a hard cast instead of a soft one
 
I'm probably going to have to come back to this one. The original example then makes no sense to me.
At least not in the way I understand it.
Hard cast being?
 
var foo = (Base)new Derived();
 
7:25 PM
Couldn't think it through and type it fast enough.
 
shakes a fist at SQL Server
 
Since the Base class is in it's inheritance path it can be cast as that.
 
you know, sometimes I feel about C# the same way I feel about French: I know how it works, but I can't quite explain the rules and I get confused when trying to.
correct
 
Duh Check: IF you had a class that had an inheritance path of a : b : c : d : e : f (psuedocode since I don't know real inheritance).
 
First it makes me enclose my parameter in parentheses for an insert statement, (?), but then it makes me leave out the parentheses at the beginning and end of my parameter text. Give me a break, just pick one or the other.
 
7:27 PM
then a can be cast to f
 
var foo = (e)new f(); would be valid
 
yes
 
:+1: Ok. This little part makes sense.
 
bbl, gotta work now
 
After operators, we'll do modifiers.
There are only a few of those, and we'll do exceptions after modifiers.
Then unit testing.
 
7:29 PM
Base b = (Base)new Derived(); still gives the same result "Base"
Not what I was expecting from what @Mat'sMug just explained.
 
Why not?
 
Then I misunderstood what you were expecting
 
If a soft cast works, then a hard cast will also work.
 
I'm expecting it to print out "Rextester.Program+Base"
 
We already explained that you overrode ToString().
 
7:31 PM
in the Derived class but that's being cast back to a Base class which doesn't have any override.
Is the override being carried back through the cast operation?
 
It still isn't creating a new object for you.
Internally, it is still pointing to the same Derived object.
 
I'm not understanding the internals properly then. Not a surprise.
So it's being newd up as a Derived being cast to a Base which carries the override with it?
 
No.
It is still a Derived.
It isn't being changed at all.
 
Base b = (Base)new Derived(); so the cast is not doing anything in this?
 
Nope.
It's like you have a box.
 
7:35 PM
That's because it's already inheriting from Base?
 
One side of the box says Derived. Another side says Base.
 
You can't cast it back to something that it's already inherited from?
 
You just turned the box so you can see the Base side.
 
25
A: Convert derived class to base class

Jon SkeetYou can't - that's entirely deliberate, as that's what polymorphism is all about. Suppose you have a derived class which enforces certain preconditions on the arguments you pass to an overridden method, in order to maintain integrity... you don't want to be able to bypass that validation and corr...

 
If you turn it again, it will say Derived again.
It is still the same box.
 
7:36 PM
Nice analogy :-)
 
But a box has 6 sides and you can inherit down more than 6 steps. I know I've seen it.
 
So?
 
Getting food to fuel my peanut sized brain.
 
This box can have N sides.
 
Boxes in my world have 6 sidez...
Don't make me rethink my world :p.
 
7:38 PM
Then you won't become a developer.
You have to learn to think like a computer.
Pretty soon, you'll start thinking in base 2.
 
pfffft nope
 
7:59 PM
@IvenBach if you want to call the ToString from the base class you can always generate IL code on the fly
15
A: How to invoke (non virtually) the original implementation of a virtual method?

descoyou can generate dynamic method to make proxy that use Call (not CallVirt) instruction var x = new C(); var m = typeof (A).GetMethod("M"); var dm = new DynamicMethod("proxy", typeof (void), new [] {typeof(C)}, typeof (C)); var il = dm.GetILGenerator(); il...

(not for the faint of heart!)
This is clever, but if I saw this being used in production code to work around a limitation of architectural design, it would certainly raise my eyebrows. — Dan Bryant Jul 31 '10 at 14:36
 
8:25 PM
@Mat'sMug Not sure what that means.
@Mat'sMug So it's by design.
 
absolutely
@IvenBach it means if you really want, then anything is possible. you "just" need to emit IL code on-the-fly for it.
C#, F#, VB.NET, every .net language compiles down to IL code
IL/CIL/MSIL is all the same thing
"Intermediate Language"/"Common Intermediate Language"/"Microsoft Intermediate Language"
 
it's the .net language, what the runtime (CLR / "Common Language Runtime") sees when it JIT (just-in-time) compiles your code
when you compile C#, you build an assembly. a .net assembly is IL code, it needs the .net runtime to compile it into machine code
a bit like Java compiles down to bytecode and needs the JVM to run
 
@Mat'sMug Ok. I'd been told that before but lacked comprehension to internalize it.
 
that SO answer [ab]uses the System.Reflection namespace to inject IL code at run-time that calls the base method of the base class, and invoke it
 
8:32 PM
It'll take me a while to understand all that.
 
no need, it's a complete and utter hack that no one ever needs to even get close to do
just saying, it's possible
but "normal rules" don't allow it
reflection doesn't care about the "normal rules"
with reflection a private method is just another method
 
So it could in theory be discovered from outside the class by something calling it?
 
hi @alexredskisn96!
@IvenBach with reflection, the wheels come off and anything is possible.
 
I'll cross that mirror when I come to it.
 
yep
FWIW it's very rare that reflection is the only solution to a problem
one example: RD uses reflection to get all the types that implement the IInspection interface, in all loaded assemblies.
 
8:45 PM
_sigh_ What am I doing wrong?

rstVal.State, adStateOpen, rstVal.EOF, and rstVal.BOF are all True
rstVal.Recordcount is -1

The relevant part of my parameterized query (cmd.commandtext) is:
create table #DRS1(RejectedClm nvarchar(30) primary key); insert into #DRS1 values (?);

The relevant part of my parameter-inserted query (Replace(cmd.CommandText, "?", cmd.Parameters("parClaimsToQueryThisRun"), , , vbTextCompare)) is:
create table #DRS1(RejectedClm nvarchar(30) primary key); insert into #DRS1 values ('N027FLP00530'),('P079FL832721'),('P079FL832714');
Oh, my chat formatting didn't get picked up, sorry
 
multiline => no formatting
huh, why are you replacing parameters in the cmdstring with cmd.Parameters????
 
I'm not, that's just to write to the log file
 
oh
 
Is there an easier way to write the parameters-replaced query to the log file?
I'm just trying to best represent what I am sending to the server
 
just log the command string and then log the parameters, in sequence
 
8:49 PM
The conditional-AND operator (&&) performs a logical-AND of its bool operands, but only evaluates its second operand if necessary.
Duh Check: Short circuiting?
 
yes. so false && true doesn't evaluate the true part, because the result is already known with false
 
@Mat'sMug Ah, I'm currently doing similarly: I'm logging the pre-replacement parameter query and the post-replacement parameter query in sequence.
(Which is what you see above)
 
:+1:
 
@puzzlepiece87 that can get quite a PITA with multiple params, no?
 
This is my first parameterized query ever and I'm only using one, so the answer is both yes and that I didn't foresee that :P
Btw, speaking of only using one parameter, am I screwing myself up again by trying to insert multiple values with one parameter? is that my issue?
 
8:56 PM
I've no idea what your query is
 
Duh check: In terms of using & or && in boolean checks the && is preferred because of it's ability to short circuit. Otherwise there's no difference between the two?
 
& is a bitwise operator
 
@Mat'sMug create table #DRS1(RejectedClm nvarchar(30) primary key); insert into #DRS1 values (?);
Sorry, I tried to put too much into one post, I was trying to be less annoying by having it as one message.
create table #DRS1(RejectedClm nvarchar(30) primary key); insert into #DRS1 values ('N027FLP00530'),('P079FL832721'),('P079FL832714');
 
^^ It becomes that when I replace ? with the parameter value
 
8:58 PM
I understood that and have been using && and ||.
 
@puzzlepiece87 that REALLY looks hacky
> For integral types, & computes the logical bitwise AND of its operands
 
@Mat'sMug Why, because I'm using multiple values in one parameter? If so, thanks for helping me rubberduck, that was my guess after talking with you above.
 
yes
 
Okay, fixing, thanks.
I thought once I eliminated my abuse of In () that would no longer be a problem.
 
@IvenBach actually your statement is correct, given bool operands
I didn't even remember you could use it that way
 
9:01 PM
I move slow, tortoise and snail slow, to ensure comprehension.
Been going over all the bitwise operations by hand to makes sure i'm understanding what's going on.
 
I need to re-read some of the basic stuff. been too long since I went over that, and never quite needed to use it
 
I now understand 0xC832 and what it means. Nifty stuff.
 
0xDEADBEEF
 
3735928559
 
1 hour ago, by Hosch250
Pretty soon, you'll start thinking in base 2.
 
9:07 PM
I don't think it, I can do it.
 
when I said "pffffft nope" I literally thought to myself "nope ...he'll be thinking in base 16"
 
@Mat'sMug Argh, this is so frustrating. So you can only have ~256 parameters per query?
I don't get the thinking here at all. You're supposed to minimize parameters, but you also can't use one parameter to stand in for many values?
Am I not supposed to parameterize table value insertion at all?
 
something is wrong with the approach
 
I'm sensing that lol
 
why is that table temporary in the first place?
 
9:14 PM
Because I don't have a sandbox.
 
get one
you need one
otherwise you'll have to code under-performing crap and you can't accept that. you're a professional.
 
This is never going to fly at scale. That's not your fault, it's my company's, but man, I'm just sad right now that parameters are so inflexible.
 
@Mat'sMug Heh, I almost added that to it. You can think in any of them, preferably all of them.
KnockoutJS, where have you been all my life? learn.knockoutjs.com/#/?tutorial=intro
It's like writing WPF, only with HTML and JS.
Seriously, check it out.
 
@Mat'sMug And I appreciate my company's approach that we're dealing with very sensitive healthcare information so they minimize unnecessary permissions as much as possible. They can't give sandboxes to every single person who uses my programs.
 
then they need to get you a DBA that cooperates and creates the tables you need for you.
 
9:18 PM
I'll work on it.
Thanks for helping me get to this conclusion even though it's been a brick wall.
 
np
BTW they don't need to give a sandbox to everyone at all
but you need to be able to pull data overnight and populate the tables you need to get your queries to run in a decent amount of time
they're not the ones wasting their time staring at their screen while the server works harder than it needs to
3 minutes per day means 15 minutes per person per week. if 4 people need to run that report it's a whole hour every week, lost to a poor query. average that to $40, times 50 weeks: the company is paying $2K/year for people waiting for that query to finish.
getting it to run in under 10 seconds won't cost anything
 
9:33 PM
@Hosch250 Assignment and Lambda Operators. Making progress!
 
TTGH
 
@Mat'sMug Thanks for your help again.
What does "Boxed value" denote? Just the value within an object/variable?
 
9:55 PM
@Mat'sMug Well said. I just talked to some of our IT partners and they helped come up with my favorite solution yet. I can write my entire list of claims (>20k) to a text file, call a new stored procedure that would load the list into a table, and then work from there. They can set up a table on their own schema and a stored procedure I would write without bothering anyone bureaucratically. I'm optimistic again that this is going to work.
I'm sure it will be harder than I imagine, especially if the server will only report back that it triggered the stored procedure rather than it finished loading every claim in the list.
 
10:08 PM
@Hosch250 you there?
 
10:19 PM
@IvenBach lookup boxing / unboxing
 
10:41 PM
Getting to that after I finish up => operator and Lambda Expressions. #TheReadingIsReal
@Mat'sMug Isn't it your children's birthday? Take an evening away from RD and spend it with them.
 
11:34 PM
@BrandonBarney Placing an add-in on a network share is doable. Workbooks that refer to the network location store the UNC path internally (rather than a drive-lettered path), which might actually help in an environment where people use different drive letters, or don't all have the right drive mapped.
 
I just stopped by to share my new favorite git alias.
git config --global alias.f-it 'reset HEAD'
3
 
but 2 key things to keep in mind. 1. Make the add-in read-only, and then you can update the add-in whenever you like and without first having to ask everybody to close Excel.
2. Some "power-users" will make a local copy ( to make Excel load faster), and because Excel will see the correct add-in Name (even though it is on the C drive), it will treat that C drive copy as a perfect substitute for the network copy. Pretty soon, the local addin is out of sync with the network addin. You may want to put some code in the add-in that checks that the add-in is being opened from a certain location, or that the workbooks check that the addin in use is a certain version
 
git f-it --hard
yesterday, by Brandon Barney
Every time I begin to think I may like C# you throw crap like this at me
You'd really love Java then @BrandonBarney
 
@BrandonBarney The best solution is to have the add-in deployed, but that limits your flexibility around urgent fixes etc. The network approach is also robust, but doesn't always work if a user is on a laptop and not connected to the network.
 
I rolled an updater that would check the network for newer versions when it loaded. Took a while to catch all the edge cases, but eventually worked nicely.
 
11:43 PM
@RubberDuck IKR, but you need the infrastructure in place up front, or somebody gets left behind.
 
True.
 
I have "power users" in my office that consistently break the rules, then blame me when it blows up. But they also blame me when I put safeguards in place.
 
I'm a tier 1's worst nightmare.
> Yes, I've done that. And that. And that. Listen, this is legitimately broken. Can you please just connect me to tier 2?
 
There's a famous story about a tier 1 asking the user to remove the power cable from the socket, "because network issue", which the user questioned, but did anyway. When the user plugged the cable back in, the tier 1 says "Great, Now I know you've actually restarted, and not just told me that you restarted"
5
@Mat'sMug IDK, it might be registerable, but for this task a single entry point is fine. The add-in is supposed to be a UI-based add-in for most users. I just want to expose some of the functionality as an API to the power-users. i.e. It wasn't supposed to be an RD suggestion, just an FYI for an easily deployed add-in architecture.
 
00:00 - 18:0018:00 - 00:00

« first day (1057 days earlier)      last day (2123 days later) »