« first day (1876 days earlier)      last day (1304 days later) » 
00:00 - 21:0021:00 - 00:00

12:01 AM
RELOAD!
[rubberduck-vba/Rubberduck] 2 opened issues. 6 issue comments.
[Minesweeper] Games Played: 121, Bombs Used: 73, Moves Performed: 15539, New Users: 25
 
12:17 AM
by the by @MathieuGuindon since you were interested earlier: Nick Craver is currently evaluating what JSON serialization Stack Overflow will use on .NET Core 3: github.com/dotnet/performance/pull/701
also: holy mother of status checks
1 failing, 8 in progress, 6 successful (makes for an overall of 15)
that said: TTGTB :)
 
 
1 hour later…
1:24 AM
@FreeMan wut? You smashed your forehead into the keyboard out of frustration?
 
 
6 hours later…
7:52 AM
0
Q: Macro for transforming 2 way matrix into 1 way matrix

AlbertI have written some code that transforms 2 way matrices into 1 way matrices. Although it's comfortable to use, it's very sluggish and slow in execution. Does anyone have any idea how to improve the performance? I'm aware that the same transformation can be done with standard formulas, but solely ...

 
 
5 hours later…
12:58 PM
@Vogel612 Newtonsoft vs the new version?
 
dunno what exactly they're evaluating.
 
In Sweden we technically don't have SSNs, we have "personal numbers" consisting of 10 or 12 digits. And it's quite easy to find out the personal numbers of other people.
 
@IvenBach Yup! No, I had an ah-ha! moment where things just clicked into place. I think I get unit testing now. (Of course, I've got to write more code and write tests for it, but I'm def on the right path.)
 
(I heard you had a SSN discussion over here)
 
Our SSN here is used for sensitive information. If you have someone's SSN and date of birth, you can get into pretty much anything.
Credit card, retirement plan, healthcare info, driver's license.
 
1:03 PM
SSMS Question: Normally (using the disabled by default, but enableable and selectable "dark" theme) my code pane tabs have a blue background, however, I noticed yesterday and again today, I've got one with a purple/pink background. What does that different background color signify?
 
@23fc9a62-56de-47fb-97b4-737890 In Sweden, the first six (or eight) digits in a personal number is the date of birth.
 
The tab background colors are the same in the eye-searing "Light" theme, too.
 
So, if you find someone else's number, what can you do/not do with it?
What else would you need, for example, to get access to someone's healthcare records.
 
According to this you can change the status bar color (which I've done in the past, but had kinda forgotten about) to indicate what server you're connected to, and you can use a plug-in to change the tab color, but unless tSQLt installed that plugin for me (and somehow it got confused thinking one tab was connected to a different server, which it's not), that's not it...
 
1:11 PM
@Vogel612 regarding your comment:
> Commands that are not DelegateCommands should be injected through PropertyInjection where possible.
Just so I'm not confused -- aren't delegate commands basically property injected, too?
 
I darkly recall something about the NavigationCommand being a pain around that, but I might be misremembering
no. DelegateCommands are newed up in the constructor
 
I think I did try to make it a delegate command and failed.
 
they are not injected at all
 
I just noticed that there's a different icon on the tab:
 
property injection works the following way:
 
1:13 PM
 
1. Instance is requested from CW
2. Instance is created
3. Properties are set to dependencies
4. Instance is injected to requestor
 
so I just define a NavigateCommand NaviagteCommand {get; set;} and CW does the rest?
 
it should, yes
 
I thought maybe that indicated that it was pinned (though it would be a weird way of showing it), so I clicked it, the tab turned blue, and the icon changed to the pinned icon (which looks like a normal pin down). Continued toggling doesn't seem to make the color go back to purple now...
 
Alright. I'll give it a go and see how it goes.
Sorry, @FreeMan I'm not ignoring you - I honestly have no idea what's that about. Like you, I've heard of different colors for different connections but that's it.
and thanks, @Vogel612 for the code review!
 
1:16 PM
@FreeMan if it's the same as VS the purple means that you're looking at a preview
and as soon as you change to a different tab, it would close again
 
@this 'sallright... I was kinda expecting you to know, but I didn't ping you because it was an @all question...
@Vogel612 it's not the same as VS then, because I changed to multiple tabs and it remained open and purple.
 
@23fc9a62-56de-47fb-97b4-737890 Something popular these days is the electronic Bank ID application which is one way to authenticate online with banks and administrative authorities. To get healthcare records you would need the person's phone or computer (depending on the mode of their Bank ID) and their passcode for it, typically six digits (but I use eight)
 
at least 6 digits is more secure than the American standard 4-digit PIN used at ATMs and just about everywhere else...
 
Other options to get healthcare records might be to get it mailed, I haven't tried this, but if so it will come to that person's address. Or you could probably go and pick it up yourself, but then you would have to show an ID card.
@FreeMan For credit cards we also use 4-digit PINs.
But then you need the physical credit card as well...
 
:(
 
1:21 PM
Our SSN is a cross between the bank ID and the user ID.
 
@SimonForsberg wait, you're saying that out of a 10-digit ID number, 8 are the DOB?
what happens if more than 99 people are born on one day?
 
@FreeMan Nope. 10 digits, then 6 are DOB. 12 digits and 8 are DOB (4-digit year instead of 2)
 
just moves the problem to 9999 people...
 
@FreeMan 00 is also allowed, so that would be 100.
@Vogel612 Actually it doesn't because one of the digits is calculated using the Luhn algorithm, so it moves the problem to 1000 people.
 
yay for checksumming :)
 
1:24 PM
Good thing Sweden is small :)
 
so... what's the rate of birth in sweden?
@23fc9a62-56de-47fb-97b4-737890 americans and their sense of scale...
sweden is frigging massive.
 
LOL. I meant population-wise.
 
it's just comparatively sparsely populated
 
However, the second last digit is odd for all males, even for all females. So if you know a person's DOB, and whether they're male or female, you have effectively 500 possible personal numbers for that person.
 
yay for not accounting for inter people, I guess...
 
1:25 PM
@SimonForsberg yikes
 
@Vogel612 332 people per day it seems. wolframalpha.com/input/?i=Sweden+birth+rate
 
that's probably averaged as well...
 
yay for genetic encoding: x=[0,2,4,6,8] y=[1,3,5,7,9]
 
@Vogel612 Well, the non-binaries and other genders probably appear at later stages than birth. There's been a debate about legalizing a third gender, but it's going slowly. I think other countries are way ahead of us there.
@Vogel612 Of course
 
@SimonForsberg I'm talking about "biologically inter" people, though..
it's not that uncommon...
 
1:27 PM
@SimonForsberg doesn't account for immigration/new citizens (I know they're different)
 
@Vogel612 Oh, I'm not very familiar with those.
@FreeMan Exactly. But for some immigrants it's hard to know their actual date of birth, so a whole bunch end up with January 1st, IIRC.
 
@SimonForsberg hence overloading that day even more!
Guess it's not that big an issue, or that they've worked around it.
just give 'em all a GUID al-la @hosch250 @23fc9a62-56de-47fb-97b4-737890
 
@SimonForsberg That's easy enough to solve. Once Jan 1 is full, give them Jan 2.
 
@FreeMan There's been an issue that the personal numbers have ran out for some days. Article in Swedish: metro.se/nyheter/…
@23fc9a62-56de-47fb-97b4-737890 That's exactly how they solved it.
 
@FreeMan I do wonder though - we use GUIDs in a lot of places, so the collision potential has to be increasing as we use it up. Sooner or later, some unlucky soul will have same GUID as some random session or device somewhere.
 
1:33 PM
@23fc9a62-56de-47fb-97b4-737890 LOL! Oh...
 
@SimonForsberg I love that. "We're having problems giving everyone numbers. We recommend y'all start a similar system."
 
@23fc9a62-56de-47fb-97b4-737890 I don't think we've been recommending this system to anyone.
 
@this "Wait... You claim to be 'Bob Smith', but my computer says you're 'Logitech USB Input device'. Can you prove you're 'Bob Smith'?"
"Sir, I gave you my GUID, that proves I'm who I said I am, doesn't it?"
 
Exactly!
 
"Not on my computer it doesn't, 'Bob Smith'"
 
1:36 PM
@SimonForsberg It's in the article you linked.
@FreeMan The inputs are different.
 
@23fc9a62-56de-47fb-97b4-737890 Unless you can read Swedish, I would take the translation with a grain of salt.
 
There wouldn't be a collision unless the two guids were part of the same system.
@this OK :D
 
@23fc9a62-56de-47fb-97b4-737890 There's a not there.
 
@23fc9a62-56de-47fb-97b4-737890 Yeah, but it's fun to contemplate!
 
@SimonForsberg Ohhh, the translation got botched bad :)
 
1:37 PM
"Vi avråder andra länder" = "We're not encouraging other countries"
 
> "We advise other countries to introduce a system that we have in Sweden," says Ingegerd Widell to DN.
 
@23fc9a62-56de-47fb-97b4-737890 Yeah that's bad! What translation is this?
 
Bing and Google do it the same way.
 
Google says "We advise other countries not to introduce such a system as we have in Sweden," Ingegerd Widell told DN.
 
@SimonForsberg where's the "not" - I guess it's not inte
 
1:40 PM
Ooops, right. I accidentally pasted the English text into Google.
I'll have to report this to Bing :D
 
@this "avråder" = the opposite of "råder" = do not encourage
 
Or even better:
Dear Mr. HID-compliant vendor-defined device-
We regret to inform you that your driver is not compatible with the new 64-bit software that we are installing in all government offices. You will be uninstalled with extreme prejudice.
We apologize for any inconvenience this may cause you and your next of kin.
Sincerely,
The Government
2
 
cool
 
@SimonForsberg wow knowing the translation I can actually read that
"Wir raten anderen Ländern davon ab" would be the German wording
 
1:45 PM
Issue reported. We'll see if it's ever fixed :)
 
Is there any effective difference between SET @localVariable = dbo.myUDF and SELECT @localVariable = dbo.myUDF? If not, I'll happily cut 3 characters out of the middle.
 
there is
I don't think in the case of assignment from a function, though.
but this is subtly different:
DECLARE @i int = 0;

SELECT @i  = MAX(ID)
FROM someTable
WHERE id = @someIDThatDoesNotExist

PRINT @i;

SET @i = (
  SELECT MAX(ID)
  FROM someTable
  WHERE id = @someIDThatDoesNotExist
);

PRINT @i;
 
2:10 PM
erm... I get nada from that. where is the output of PRINT @i supposed to be displayed?
 
because the @i was set to 0, originally, you should see the first PRINT @i return 0
(check message tab)
but the 2nd PRINT @i will be actually null (which is correct)
 
status bar says "Query executed successfully", yet I get no output. :/
 
wtf
 
long story short, though, you're saying that SET will give a more correct answer?
 
try SELECT instead of PRINT
yes because it will NULL when there is no data, whereas the SELECT version will not change the value at all if there is no result.
 
2:16 PM
well, I get results, just different that what you're getting:
 
hmm.
let me do a test.
 
I can see the advantage of SELECT if it behaved the way you've specified - kinda a shorter, easier to type version of COALESCE
 
must be due to the aggregation function
 
da! that was it.
remove the Max(...) and just select ID and it works as advertised.
 
yep, aggregation function changes the rule
so it's good to be aware of that quirk behavior, esp if you have it selecting from a table
 
2:21 PM
so the SELECT has value: Give me the result of this thing, unless it's NULL in which case, leave the variable untouched. i.e. @local = COALESCE(<query>,@local>
 
but when you're using SELECT without a FROM nor WHERE, it's usually better because you can assign several variables in one go.
 
that is handy.
 
2:59 PM
You guys think Windows updates are bad? KACE updates are worse.
 
3:18 PM
K, Ace...
 
KACE updates need a KISS update.
 
3:35 PM
#memories... just came across this gem
Dude, where have you been all this time! — Mathieu Guindon Aug 15 '14 at 20:08
Wasting time on Stack Overflow. — RubberDuck Aug 15 '14 at 20:10
 
@Greedo I had it all on an old computer.. which died in 2015. This is all that's left of it :-/ the original function on the SO post is self-contained though, no? — Mathieu Guindon Jun 5 '18 at 18:57
GitHub FTW :)
 
@MathieuGuindon Awwww... is this where the Mug and the Duck first met?
 
After reading that, it almost feels like I was there
 
3:48 PM
20 questions
today: 1,015
 
bit o' growth.
 
Talking about which:
3
Q: Rich data types - boolean object

GreedoContext You can probably skim most of this, it's unlikely to be useful for a review and is just for background info. Also download the files I've tried to create a Boolean object - some truthy reference type which can be used in place of VBA's builtin Boolean. I have 2 motivations for this:...

New zombie?
 
@MathieuGuindon My PR may take me a bit to finalize. I was finally given an official list of tasks. Dev time will be after hours at home now.
Wanted to give you a heads up as they may linger for a bit.
 
@IvenBach you should give a stern talk to the other guy who has 6 months plus open PRs.
 
@23fc9a62-56de-47fb-97b4-737890 this is my review:
Why not use MSForms.ReturnBoolean? — Mathieu Guindon Jun 29 at 20:04
it's reinventing a square wheel :)
WP site is 521 views (1%) under the 2018 total :)
 
4:02 PM
testing question: I've written a function as the first step in writing a stored procedure. I wrote a bunch o'test cases for it yesterday. Should those function test cases live in the same "place" as the test cases for the sproc or should I break the set of tests out into a separate file?
the function is generic enough that it can be called from other places as well, so it would make sense to me for its test cases to be "stand alone".
SSMS question: will SSMS not autocomplete schema names? I've tried '.', '<tab>', '<ctrl>-i, <alt>-i, nothing seems to get it to complete. I've only got one schema that starts with test`, so it shouldn't be hard for it to figure out what I'm after...
 
@FreeMan usually a file for each "class"
@FreeMan If you're creating it via the tSQLt's AddTestClass, or whatever it was, then it doesn't exist for the intellisense to see.
If you want, you can permanently create the test schema but it still wouldn't see the objects because the way tSQLt works, they all are created and torn down
 
@this so... the function (the one you helped me with yesterday - thx again!) is part of the larger "class", but it's generic enough to stand alone and be used elsewhere...
@this I've already created some tests in this schema yesterday, so the schema exists...
 
@FreeMan you created permanent objects?
@FreeMan really it doesn't matter because it'll be just a bunch of .sql files
 
I used EXEC tsqlt.NewTestClass 'testFindBySSN'; and the schema still exists
 
hm but do you run the tsqlt.DropTestClass or something at end?
 
4:12 PM
no. I didn't see instructions to do that in the tutorial, so I didn't.
I guess that would make sense to do so - it does leave a bit of a mess in the OB...
 
hmm i see what you mean
 
no biggie... typing dbo. isn't a huge deal, but typing test<someLongStoredProcedureName>. could get a little annoying by the 15th test case...
copy/pasta to the rescue!
 
I see - NewTestClass is idempotent
well, not really
it'll drop and recreate it
thinking about it some more, it's probably OK as permament objects in development environment
you definitely wouldn't want it carried over to the production, though
so if they are in fact permanent, you may need to refresh the intellisense, esp. if you've just created or altered the objects.
 
Theoretically, you shouldn't be running the tests in Prod, though, right?
 
never.
 
4:18 PM
so there's that...
:)
@this they were created yesterday and it was refreshed yesterday - it's listed in the OB. I'm reasonably confident that I hit ctrl-shift-R a few times...
OK, minor issue. I'll live with it.
 
hmm. interesting. maye you need to bracket it?
to clarify, you were EXECing it, right?
 
CREATE OR UPDATE PROCEDURE test. <--I expected that to auto-complete the one & only (so far) schema name starting with test
I guess it makes sense that it wouldn't auto complete that.
How does it know I'm going to specify the schema since it's not required...
It won't even pick up intellisense and auto complete after I've specified the database.
:/
 
the intellisense is kind of retarded.
yeah I can confirm -- no autocompletion on CREATE OR ALTER
but I get autocompletion on EXEC
 
New, from Microsoft, it's Retardisenseâ„¢. Now available in all your favorite IDEs! Not available in all states. May cause itching or minor bowel irritation. Check with your doctor if symptoms persist.
 
for SELECT, I always write SELECT 1 FROM first fill in the FROM clause and alias them all, then i work on the select list with "slightly-less-retarded-isense"
 
4:25 PM
I use SELECT * FROM <table>, but yeah... It can't know what columns to provide until it knows what table you're looking at, so that one makes sense...
 
still better than VBA's zeroisense when writing SQL-as-a-string. ;-)
 
I guess SELECT 1 forces you to go back and specify columns 'cause that 1 will prolly stand out like a sore thumb if you otherwise forget.
 
yeah
also in generally, I try to avoid using *
it's OK when I'm just doing ad-hoc queries but when I'm defining views or stored procedures, it's best to not use * and enumerate the columns explicitly.
 
@this I can't do that to Wayne. It might make him fly the coop and never return to the pond.
 
actually if you look there's a PR even older than Wayne's.... ;-)
that's the one I was referring to.
and that's not his first 6+ months PR, either.
No worries RE: Wayne - I already talked with him - he is wrapped up with his current business and he was one who gave me the notes I needed to pick up the PR. :)
 
4:42 PM
@this crikey, who's that bclothier fella? He needs a stern talking to ;-)
 
IKR?
he's all over the map and doesn't do anything. I think he was supposed to do this extract method thingee but he keeps get distracted by shiny things and wandering off.
 
troublemaker!
 
wastes a lot of time answering questions from n00bs, too...
 
0
Q: Seeking peer advice on large VBA Program

Chris LafkyGood morning all - I have written a fairly large VBA program for work and I am looking for a few experienced vba coders who would be willing to take 30 minutes to an hour out of their day to look through the entire file and give me some pointers on the things I would like to do going forward, as ...

 
4:51 PM
@this I'm a bit duck-headed at times. This thankfully wasn't one of them. He'll get to that PR when he comes to his seances senseis scentses scentences sinces senses.
 
Ohhhh, that might solve some of my .NET Core troubles :)
 
did they mention when they'd GA the .net 3?
I think last time they said sept....
 
yep, sep
preview 7 has a go-live license, and the RC is due any time now
 
VS 16.1 doesn't really support it, but 16.2 does.
You can use it in 16.1, but it's not got good support.
 
hmm. only less than 2 months to RC it?
doesn't seem right.
also more importantly whether it will be backported to 2017....
 
4:58 PM
> Version 16.2 supports debugging JavaScript in the new Microsoft Edge Insider browser for ASP.NET and ASP.NET Core projects. To do this, install the browser, set a breakpoint in the application’s JavaScript and start a debug session.
Is this how they're trying to force people to dev for Edge?
:)
 
TBH, I thought that was already a thing.
 
By adding good support for it finally?
 
I recall seeing similar thing way back in VS 2015
but of course, when I tried that, it really didn't work.
 
@23fc9a62-56de-47fb-97b4-737890 one might hope!
 
@mansellan RC = ??
 
5:08 PM
Release Candidate (Optionally Return Code or Remote Control, but not in this instance)
 
Beats me why they didn't follow the convention and called it Delta Gamma
 
Yeah, why'd they have to go with Rho?
 
RC is the convention?
 
not when it's following alpha and beta
 
Maybe I'm young, but it's always been RC.
 
5:15 PM
In MSFT's case, they use the term "Preview"
 
They have alpha (internal), beta (public preview), and RC (might have a few bugs).
All three of those are under the Preview label.
 
but in many other places, yes it's as you say, alpha -> beta -> RC
but if you're greeking, why not greek all the way?
and thus my joke fails.
 
when using tSQLt.FakeTable it loses all the constraints (unless specifically told to keep them) and one of the constraints would be IDENTITY on a primary key column, right?
@this semantics are so hard to identify via text...
 
yeah
 
so as I insert records, I tell it what value to insert for the IDENTITY column so I know what to expect back to ensure it's finding the proper record.
thx
 
5:19 PM
there's other constraint to replicate the constraint. I'm a bit fuzzy on the exact reasoning but the answer was that constraints are not necessarily the subject under the test
 
right. I've seen mention of that in the docs. Just wanted to be sure it was going to go as I expected. I was reading it right.
So FakeTable actually drops my real table, creates a new version, inserts the records that I've specified, then rolls back that whole thing as a transaction to restore the real table?
 
I believe yes
 
just a touch spooky...
 
which is why you don't want to run it on production. ;-)
 
It's just dev. If it blows up, I copy it back from production.
^^ that
 
5:22 PM
but on development, it's all right. It's all there to ensure that the tests are 100% replayable
 
5:43 PM
If I set the OB to auto-collapse in SSMS, I can open it with F8 how do I hide it again? F8 again doesn't hide it, nor does Esc. The only thing I've found is to click the mouse in the code pane, then I end up with the cursor somewhere, anywhere, but where I wanted it.
 
6:17 PM
This info needs to be in a DB and not an #ExcelDB. First to wrap my head around the idea.
 
test cases are much more likely to pass when the expected result is properly specified.
 
well at least you know the tests' working. ;-)
 
6:35 PM
for some values of "working"
Yeah, actually, it was quite instructive.
 
I remember having worked with SSMS. I do. past-Iven had an inkling as to what to do in it. Current-Iven not so much... Short term memory never made it into long term persisted storage.
 
The argument was that if you wrote the failing test first, you'd have a clearer picture of what you need to do to achieve the functionality
 
Carp, all this thinking about test cases has me really thinking about the logic of the code I'm gonna be writing. "Wait, I don't want it to give me that result. Oh, wait, yeah, I guess I do - I'll have to sort that other detail out later..."
 
but in practice, it hasn't really held up.
Now, that, I can buy. Writing tests after the initial version is really helpful.
 
"write the failing test first" - what's that really mean?
 
6:36 PM
ok, don't write any code!
just write the test itself
even though the code to be test does nto actually exist (yet)
it'd be just a stub
 
that's.... stupid odd weird stupid
 
e.g. CREATE FUNCTION dbo.Foo() RETURNS int RETURN NULL;
then you write all tests on the Foo to define what are good / bad results
 
yeah... that's... overkill...
 
that's the whole drive behind TDD
 
but, I guess I get it.
I s'pose it minimizes writing broken code.
 
6:38 PM
but as I said, when writing something new, I have hard enough time conceiving the details I need to think.
 
in theory
 
because I usually realize "oh I need a parameter", and oops I wrote 25 tests but they all need to have parameters. Doh!
something like that.
 
so. much. that!
 
Now, if it's an existing functionality, then it usually works better because you already have a defined contract.
 
writing small functions/methods/sprocs and writing tests for them is a giant leap for this man's kind. I'll stick with that...
at least for now.
 
6:40 PM
so it's easier to write a failing test that adheres to the existing contract then verify that it fails with the current implementation before going to update that implementation to support the new functionality.
In this scenario, it becomes much easier to be assured that your change will not breaking the other existing functionality when adding the new functionality.
which IMO is easily #1 source of bugs
 
Because our own brilliant ideas could never break anything...
 
@this mkay, I can see the value/logic in that.
 
@IvenBach and the excuse goes "but I wasn't anywhere close to that part of application codebase. I was changing stuff in that entirely other place...."
That kind of breakage is especially annoying.
 
Is it a bad sign when you write a test that passes, but feel the need to put a comment in there as to why it passes so when future you is trying to figure out why the heck this one passed but the result still doesn't make sense he can understand the thought process?
@this annoying and often very difficult to track down.
 
CR vs SO in a nutshell
@GSerg that's addressing one aspect of it. It says nothing of the questionable Boolean return value, the side-effecting nature of the function, the implicit ActiveWorkbook references, the questionable need for FORMATSHEET constant (assuming the sheets are in ThisWorkbook), or the error handling redundantly checking Err.Number. CR would also tackle the SysHungarian naming scheme, and praise the correct use of ByVal and Private modifiers. — Mathieu Guindon 1 min ago
 
6:45 PM
@FreeMan You're no longer a Mort kind of guy.
 
@FreeMan That's exactly what unit tests are supposed to help us avoid.
@FreeMan Maybe? This might be an indication that the implementation could be more clearer. But if this is due to underlying implementation beyond your control (e.g. T-SQL's quirks), then comment is needed, I guess.
 
@IvenBach Mort?
 
@this Yeah... It's kinda in a portion of the code I haven't developed yet, so the comment is there to remind me "this was the thought process at the time" even though it may evolve some before I get there...
@IvenBach I'd say more of an Elvis wannabe with strong Mort tendencies...
@FreeMan Maybe you should have some sort of design documentation...
^ the Mort tendencies are all screaming "Nah, why bother? Just wing it, it'll work out!"
 
7:01 PM
You're passing an object pointer that's exacly, uhm, I'd guess a huge 4 bytes. — Mathieu Guindon 2 mins ago
VBA object refs are 32-bit integers, right?
 
in 32-bit VBA yes
64-bit they are well, 64-bit.
 
#duh
thanks
ByRef, yes. Are you saying ByVal only passes a pointer, and does not make a duplicate of the value to work with in the function? — SMJ 1 min ago
just how widely spread is this
 
I'd imagine very so for those who have no programming background
e.g. all Morts out there
 
@MathieuGuindon :cough: You remember how when I kept coming to this pond how much I would thank you and the others? Do you remember? Remember how I said I'd tried learning this stuff before and failed miserably? This is part of the foundational reason why I was so grateful.
This is really foundational stuff that's hard to grok if you've never done any of it before.
 
after all, the concept of a pointer is quite opaque in VBA.
In C/C++ it's hard to miss the difference between a int and * int
 
7:08 PM
What pointer... You don't even have a clue it's there.
 
@MathieuGuindon FWIW, in C++, it actually will make a duplicate.
 
well, but then again, they love to redefine it so it'll be INT and LPINT, whatever.
 
@this very true
 
That really bit me when switching to C#.
 
@23fc9a62-56de-47fb-97b4-737890 you mean if you're doing void foo(MyThing myThing) instead of void foo(* MyThing myThing)?
 
7:10 PM
I have a CS degree and have been programming for 30 years and still had a hard time registering that my Workbook, Range and Cell parameters could all be ByVal or ByRef and that it didn't matter - I could change the source location either way.
 
the former would be consider bad code, I think.
 
Or ref MyThing.
Eh, not necessarily.
Sometimes that's what you want.
 
for certain structs, perhaps. For a class? IDK.
 
@23fc9a62-56de-47fb-97b4-737890 in well-written C++, the dupe doesn't happen ;-)
 
7:15 PM
When I was learning C++, that was actually explained as a feature, so you can pass items around safely.
But that you have to be really careful about performance.
It showed how to write it so it would copy correctly and safely and stuff.
I don't remember those details anymore.
 
hmm. just to confirm - so foo(MyThing myThing) would be basically a deep copy of the object?
The thing I'm unsure is how it handles the private fields / members - if those aren't copied, that might not be a true deep copy
 
Yes.
They are copied.
At least, if you implement it right.
 
FreeMan, how would you go about passing the object as a copy, then, so data does not get manipulated? — SMJ 5 mins ago
@FreeMan
not posted:
> You need to use @ in order for people to get your pings ;-) if you want to pass a copy, you need to make a copy. In the case of a Range, you don't own the class, so you can't do that (well I guess you could Range.Copy over to some other cell and pass that cell). For user code, you would clone the instance into a New one. ByVal does not clone objects.
 
IIRC, there's a special constructor you need to override.
That bit me really hard with a List<T> that I wasn't expecting to be modified since I didn't specify ref on it.
 
I would have understood that feature explanation as "ok so now you know what it does, you know why you don't pass objects around, but pointers to objects instead."
 
7:22 PM
@MathieuGuindon feel free to post that yourself. I don't need the credit. ;)
 
Have you seen that question in the HNQ about e-scooters?
Basically, companies allowing their users to dump their e-scooters all over cities on private property and/or public property, and then not wanting to pay the costs of other people removing them?
IMO, if they don't want to be hit with the costs, they can put it on the last person to use the scooter.
 
I turned off HNQ. My worklife thanks me.
 
8:07 PM
TFW when you try to implement something only to be told that it's not recommended by MSFT anymore but the MSFT's replacement doesn't work for what you need it to do.
 
TFW you didn't notice NEMA 5-20P when you only have 15amp outlets available.
 
weird... I've got that same icon I had earlier, but this time the tab is blue
the button description is Keep Open.
the heck does that mean?
 
Keep it open, of course!
 
So if I try to close SSMS, it won't close?
and this time it does say 'preview' in the hover text. Maybe I didn't hover long enough before to notice it.
nope. It closed.
TTFN - y'alll have a great weekend!
 
uh, #jokefail, I guess
Have fun!
 
00:00 - 21:0021:00 - 00:00

« first day (1876 days earlier)      last day (1304 days later) »