« first day (1754 days earlier)      last day (1426 days later) » 
00:00 - 19:0019:00 - 00:00

7:23 PM
hello
anyone knows if it's possible to define a unique constraint that's based on a column that's in another table (there's a FK for it)?
or any other type of constraint (thinking unique constraint wouldn't work)
 
So, a unique constraint on an FK column?
 
e.g. I have Foo.BarId and Bar.Something, and I need Foo.Baz and Foo.Bar.Something to be unique across all Foo records
I need to denormalize it to enforce the constraint, don't I?
 
1
A: Create a unique constraint on a column based on distinct value from another column in the same table

RBarryYoungSeems like this should do it: CREATE UNIQUE INDEX [UNQ_locationName_companyId] ON dbo.[locations]([locationName],[companyId]);

Maybe not :)
 
Oh, wait, no.
Both those columns are in the same table.
 
7:28 PM
why can't you just create an UNIQUE constraint on the FK constraint?
But if you want it to be unique, this smells like a one-one relationship, doesn't it?
 
I have Collection.Id and Collection.SageDb, then Fabric.CollectionId and Fabric.Code - I need the fabric code to be unique across a given SageDb
 
ok, and assuming the Fabric represents a table, why not an UNIQUE(CollectionID, Code) then?
assuming that a SageDb can only belong to only one Collection.ID
 
because a given Fabric.Code with CollectionId 5 in SageDb1 is perfectly fine with another record with the same Fabric.Code under CollectionId 6 in SageDb2
@this see that's the problem
 
then CollectionId isn't what you want on your Fabric table
You have a functional dependency on the Collection.SageId
 
looks like it
damn
 
7:32 PM
Can you create a Fabric.SageId column?
 
5 mins ago, by Mathieu Guindon
I need to denormalize it to enforce the constraint, don't I?
 
then create a composite column FK
no, you shouldn't; composite column FK should work
 
I could add a calculated field that grabs the SageDb, and then add the SageDb to the unique key
 
Yeah, that would be another way. Make sure to persist it so you can index it, though.
 
thanks :)
 
7:33 PM
yw
 
uh, column either can't be persisted because non-deterministic, or can't pull the column value because not a scalar expression
 
it's just concatenation, no?
 
not quite
alter table [mrp].[Fabrics] add [SageDb]  AS (select top 1 SageDb from mrp.Collections where Id = CollectionId) persisted;
 
if you can't persist it, then that's going to hurt the performance.
oooh, no no no
not gonna work like that
now, SageDb is on the Collections
 
7:42 PM
I thought you meant to concatenate the SageDb to the unique key of the Collection table
which would work and be unique
 
I'm going to make the software make a record invalid if a given code exists in a given sagedb, but ideally I want the db to also enforce that
 
I'm assuming you do not want to make schema change that propagagtes into software
 
yeah that would be... inconvenient :)
 
A composite FK would probably be the simplest way. FOREIGN KEY (SageDb, CollectionId) REFERENCES mrp.Collections(SageId, CollectionId)
you could also go the way of calculated columns on both the mrp.Collections and mrp.Fabrics that aren't directly used by the software but that's just a longwinded way of making a composite FK.
No, wait, that's not right.
The calculated column would let you avoid having to manually insert the SageDb into the Fabric record
a composite FK might require code change in the software; a calculated column on the collection table wouldn't and should be referenceable for a 2nd FK
 
I'll take the perf hit and make it compute off a scalar function that takes a collection ID and returns the SageDB for it
#simple
kinda sucks though
 
7:50 PM
VS vanilla doesn't have parameter name hints... Mug. You're doing it again. R# is like crack for coding.
 
alter table mrp.Fabrics add SageDb  AS (mrp.SageDb(CollectionId));
 
yeah I don't like scalar functions and it isn't really a proper constraint.
 
@IvenBach so is Rubberduck :)
 
not sure that will work. they have rules about subqueries in a calculation (persisted or not)
 
Command(s) completed successfully.
:)
 
7:52 PM
cool
 
@this Ahh, yeah , no i make my tables in SSMS.
 
I just keep it simple with a rule: "if you're doing subqueries in your calculation, yer doing it wrong."
but of course, sometime we don't get to work with purty database schema....
 
oh bugger
Column 'SageDb' in table 'mrp.Fabrics' cannot be used in an index or statistics or as a partition key because it is non-deterministic.
 
Ctrl+Shift+Space is poor mans VS parameter name hint.
 
yeah. that's why I avoid functions/subqueries in a calculated column.
well functions that has no subqueries is OK, though.
 
7:55 PM
so my mistake was to put SageDb in the Collections table.. kinda painted myself in a corner there
I KNOW! I'LL MAKE A TRIGGER!
 
well, actually if you want to hide it from the software, you can use a view with a trigger.
I do that sometimes w/ Access so I can do some T-SQL programming and still avoid the problems with a table trigger.
 
nah, I'll do triggers at gunpoint, no less
better rework the schema
 
I don't see a view trigger as problematic as table trigger, since it's now explicitly opt-in
I agree, though, if you are able, reworking schema is best but if reality doesn't permit, well....
 
I'll still take the lazy route and just denormalize the thing a tiny little bit
the software won't even blink
 
I don't get it. You can change schema but you don't want to do composite FK?
 
8:02 PM
nah you're right. I need to do this right.
 
dew eet rite!
 
@KySoto *rite
 
I don't remember off the cuff if you can write a T-SQL function for the DEFAULT "constraint"
if it does (and permits subquery) that might be a cheap way of ensuring Fabric.SageDb is populated.
(without having to change software, I mean)
 
actually now that I'm looking at it, the SageDb is already denormalized ...I need a mrp.SageDatabases table, and a SageDatabaseId in mrp.Collections
ugh, wait no, ...dang everything is in a darn tangle
 
8:07 PM
hmm
i kinda wonder what the current schema looks like
 
If it's really that awful, it sounds like a triggered view would be the cleanest way of getting you what you want to do entirely at SQL level.
 
> **Rubberduck version information**
Version 2.4.1.4627
OS: Microsoft Windows NT 6.1.7601 Service Pack 1, x64
Host Product: Microsoft Office XP x86
Host Version: 10.0.6771
Host Executable: MSACCESS.EXE

**Description**
Upon opening the VBA Editor and clicking the Rubberduck "Parse" button, Rubberduck completes the parse with a Parse Error on two lines of valid VBA code, both with different, unrecognized syntax.

**Parse Error 1:** extraneous input '_\r\n ' expecting '-'
When I doubl
 
#TIL Solution Explorer>Solutions & Folders button. That will help navigation.
 
8:30 PM
Duck check: When inheriting from a base class is there a convention to follow where base(foo) gets put?
class Foo(string param1, string param2) : Bar(param2)
or
class Foo(string param1, string param2)
    : Bar(param2)
A quick peek at the RD code base has examples of both.
 
is that a new class syntax?
or you're mixing up class definition w/ its constructor?
class Foo : Bar
I tend to go next line when there's more than 2 things after the :
 
class Foo : Bar and public Foo(...) : Bar(....) yes. #WordsWinAgain
How about { ... } if it's empty is there a preference?
 
consistency is preferred
;-)
but, I personally don't really care either way
 
mkay.
 
> **Re 1**

Rubberduck already has a `lineSpecialForm` for the peculiarities of that syntax. It can be seen here: https://github.com/rubberduck-vba/Rubberduck/blob/2925035f5210cb7f56792554a43f6e44052acb82/Rubberduck.Parsing/Grammar/VBAParser.g4#L574

It seems that we're somehow failing to correctly parse that as a lineSpecialForm. Could you try playing around with the syntax there to make the error go away?
If you find semantically equivalent code that parses, it might give us more informat
 
8:37 PM
I now feel adequate to develop on RD.
3
 
> Thanks for reporting this! :+1:

Indeed, `Line` syntax is essentially special-cased, both in Rubberduck's and VBA's parsers. Thanks for reporting this! The problem seems to be with the line continuation character though, which we might have forgotten to account for in that specific - I can confirm that the code correctly parses without the line continuations.

https://github.com/rubberduck-vba/Rubberduck/blob/2925035f5210cb7f56792554a43f6e44052acb82/Rubberduck.Parsing/Grammar/VBAParser.g4
 
@Duga oh, lol
@IvenBach awesome!
 
HA! I was faster 😀
 
but yours is more comprehensive... damn
 
8:38 PM
> **Re 1**

Rubberduck already has a `lineSpecialForm` for the peculiarities of that syntax. It can be seen here: https://github.com/rubberduck-vba/Rubberduck/blob/2925035f5210cb7f56792554a43f6e44052acb82/Rubberduck.Parsing/Grammar/VBAParser.g4#L574

It seems that we're somehow failing to correctly parse that as a lineSpecialForm. Could you try playing around with the syntax there to make the error go away?
If you find semantically equivalent code that parses, it might give us more informat
 
line continuations strike again!
 
'course they do
 
I wonder how much % of parser bugs are direct consequence of line continuations.
 
I'm honestly not sure whether I'd want to see the the code that MS used in the VBE to deal with the little buggers
 
Feb 25 '17 at 0:51, by Mat's Mug
I've just found out about your project and it interests me greatly. — IvenBach 50 secs ago
2yr 1month until adequacy was achieved.
 
8:41 PM
Aight, go and kill some bugs :)
 
:)
we'll quote you on this one:
4 mins ago, by IvenBach
I now feel adequate to develop on RD.
 
Quote me after I've submitted 20+ commits.
My previous "Whoopsie fix previous commit" don't count.
 
@IvenBach "50 secs ago" is very confusing in that quote from '17.
 
@IvenBach you're at 252, currently
 
28 secs ago, by IvenBach
My previous "Whoopsie fix previous commit" don't count.
FML that should be 20 PR not commits...
 
8:44 PM
30
Q: Implement the Thanos sorting algorithm

vrwimThe sorting algorithm goes like this: While the list is not sorted, snap half of all items (remove them from the list). Continue until the list is sorted or only one item remains (which is sorted by default). This sorting algorithm may give different results based on implementation. The item re...

LOL.
@IvenBach LOL.
This is when it gets fun. You think you know enough--and every time you turn around, you learn more stuff. But now you start to understand it pretty quick, because you have a good solid base to build on.
 
@Hosch250 You've no clue how thankful I am to this pond.
 
You still have 365 days to TIL in every year, so make use of them :)
 
> Thinking again, rpt.Print being a member call, it really needs to be parsed and resolved as such... but we can't have any member call allow an outputList, it has to be conditional.... @MDoerner does this warrant a predicate? Or is there another way?
 
9:05 PM
> If I remove line continuation from each of my `Line` method calls, the parser now complains:

extraneous input ',' expecting {EOF, ':', REM, NEWLINE, "'", WS, LINE_CONTINUATION}
and puts the cursor after the right parenthesis and before the `, , B` in this line: (and all other such lines)

Me.Line (ctl.Left, ctl.Top)-(ctl.Left + ctl.Width, Me.Height), , B

This is in the `Detail_Print` event of a Report, where `Me` is and Access.Report, and `ctl` references an Access.Control.

Tha
> please remove one of the commas in that to fix the parser error, we're not parsing nothing as an expression here which would be required because you have an additional comma.
 
9:20 PM
@Duga hmm the docs looks misleading. The syntax suggests it's not optional but the comments says it is
> Indicates the RGB (red-green-blue) color used to draw the line. If this argument is omitted, the value of the ForeColor property is used. You can also use the RGB function or QBColor function to specify the color.
 
@this soo ... what's their syntax for omitting the argument. Just ,, or do they skip it?
I'd think neither B nor BF count as RGB colors
 
skipping would be just a comma.
so, , , would be valid
(,, should get pretty printed to , ,)
i wonder how it handles the named parameters. Probably not.
this has to be one most moronic special form there is.
and i might be failing but I'm not finding it in MS-VBAL either.
 
bleargh
 
i have a feeling that line continuations contribute to 80% of parser bugs and the special forms of Line/Spc/Circle contribute 15% of the parser bugs leaving only 5% to the rest.
 
> @Vogel612 if Line (thing1, thing2)-(thing3, thing4), , B is legal, then our parser rule for it might need to make the last expression optional.
 
9:31 PM
sounds about right..
@Duga ~sigh ... yea. fully correct.
 
doesn't make it any less fugly, though.
 
I do not like that form.
I mean, WTH is (x,y) - (x, y)?
 
value tuples, VB-style
(fromX, fromY)-(toX, toY)
like, 30 years before .net had them
 
(fromX, fromY, toX, toY) would have been more idiomatic, IMO.
 
9:33 PM
I bet there's a historical reason for this nonsense
 
I'm sure. It's called "hack"
They weren't shy of putting in a hack or two back then.
 
and then you don't do two without doing a third
 
kind of can see why they said "screw it, let's just start over" and made .NET instead.
 
lol completely
 
> So.. to fix the line continuation problem, we could just slip a whiteSpace? before & after the MINUS token, I think.
 
9:45 PM
ok I think I got this: I created a SageDatabases table, so now I'm dropping the SageDb column from Collections, and I'll be adding a FK SageDatabaseId column to Categories, Fabrics,Models, and Styles, which can all keep their CollectionId FK. Minor tweaks to stored procedures will be needed
hmm, actually Categories could be sagedb-agnostic too
wait no, it can't
#rubberducking
TTQW though
 
@MathieuGuindon Yep, IIRC the spec even calls them tuples.
 
10:02 PM
hmm maybe not, can't find that any more
 
> That whitespace should belong to the part of the rule that matches for tuple
 
@this that sorta thing (bug causing) is why i almost never (ONE time only) use them
 
10:33 PM
@Dictionarycom | ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄| You're goking, right? |___________| (\__/) || (•ㅅ•) || /   づ
That thread...
 
That's so much funnier than it should be.
 
@KySoto I usually use them to stack the arguments vertically. Makes it more readable but that's just me.
 
10:49 PM
I do that, too, when the number of arguments gets out of hand.
 
It also could be a code smell begging for a UDT or a class. Unfortunately that's not always practical.
 
For me, it usually happens for my object initialization methods because of all the DI.
Fortunately, those methods are only called from the (static) factories wiring everything up.
Hm, maybe I really need to buy a new computer. I get the impression the thing causing my recent system failures is actually my SATA controller.
Today, windows was unable to load because it could not find the boot device. I fixed it be switching the SATA cables around.
 
11:24 PM
@MathieuGuindon Haha, I win. I pronounced it JIF all along :)
 
@Hosch250 creamy or crunchy?
 
@this REAL. And crunchy.
LOL, just got reminded of MaraNatha butters.
Those are awful.
TBF, though, we usually got alternative butters, like almond butter.
 
 
00:00 - 19:0019:00 - 00:00

« first day (1754 days earlier)      last day (1426 days later) »