Open Side Menu Go to the Top
Register
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

06-14-2017 , 11:50 AM
Quote:
Originally Posted by kerowo
Sorry if I wasn't clear. That is the productType table. Every product has a tid for classification. So there is a product that is a golf ball but not a product that is just a ball. So far I've just been walking down the pid but can't tell when I'm at the last node.
Ah got you (I think). This would be solved with a join right? I don't write joins anymore because I use LINQ but in LINQ it would be:

tblProducts.Where(c=> c.tblTypes.Round = true);

(If I'm wrong again not surprised, it's probably me not you)
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-14-2017 , 11:52 AM
There are only 5 levels of classification so I'm just going to graph the thing manually...
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-14-2017 , 01:00 PM
Quote:
Originally Posted by kerowo
DB question, or SQL, whatever. I’ve a product type table that stores a type hierarchy in it using typeID and parentID and a product would look like this in it:
Golf ball – Ball - Globe - Round - Product
TID(56) TID(21) TID(2) TID(1) TID(1)
PID(21) PID(2) PID(1) PID(5) PID(5)

I’m just not seeing how you access this information quickly, how would I get all products that were Round without having to filter out the other sub-level names? I didn’t build it, I can’ change it, I need to figure out how to filter certain classes of items out of it. Or at least be able to describe it enough for our developers to understand it.
Confused. Can you show the actual schema?

And also, is there a hierarchy?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-14-2017 , 01:15 PM
it looks to me like a very standard thing like

Code:
create table product (
   id integer,
   parent_id integer references product(id),
   name varchar(100)
);
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-14-2017 , 01:23 PM
Rusty is right. It essentially captures up to 5 levels of classification for a product. There are some chains 3 nodes long some 4 some 5. I think they correspond to 5 windows in a UI but I haven't seen it. I could see building it one window at a time given either end but don't see how to get all the leafs for a given node that isn't the parent node for the leaf. Short of graphing it out in a spreadsheet...
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-14-2017 , 01:45 PM
so if you apply for a programming job they aren't going to call your current employer and say "we are thinking of hiring James what do you think about him?" do they? or do they only call past employers... or do they not call anyone cause they will put you through their own testing gauntlet?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-14-2017 , 01:52 PM
There is usually a spot asking if they can contact your current employer or not on the application. If not ask them not to if you are looking on the down low...
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-14-2017 , 02:01 PM
Quote:
Originally Posted by kerowo
Rusty is right. It essentially captures up to 5 levels of classification for a product. There are some chains 3 nodes long some 4 some 5. I think they correspond to 5 windows in a UI but I haven't seen it. I could see building it one window at a time given either end but don't see how to get all the leafs for a given node that isn't the parent node for the leaf. Short of graphing it out in a spreadsheet...
Perhaps look at this:

http://karwin.blogspot.com/2010/03/r...re-tables.html

There's a lot of variations on ancestory / descendent tables like that, but that particular formulation looks like what you are dealing with.

There's also an article on moving branches from the same author:

https://www.percona.com/blog/2011/02...closure-table/
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-14-2017 , 05:39 PM
I'm using react for everything so I use a lot of jsx object styling, but when I write CSS classes I've just been using camelcase.

I don't see the point in hyphenating CSS classes when literally 99% of the rest of my code uses camelcase and it just seems like a better way for me to do it.

Am I an idiot?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-14-2017 , 05:54 PM
Quote:
Originally Posted by daveT
Perhaps look at this:

http://karwin.blogspot.com/2010/03/r...re-tables.html

There's a lot of variations on ancestory / descendent tables like that, but that particular formulation looks like what you are dealing with.

There's also an article on moving branches from the same author:

https://www.percona.com/blog/2011/02...closure-table/
Thanks Dave, but those articles aren't what I have. They assume a path looks like a-a, a-b, a-c, a-d, where my paths are more like links in a linked list' a-b, b-c, c-d. I can't tell that from a-h, h-i, i-d. My guess is the UI populates a box with options as soon as the previous box is filled in.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-14-2017 , 06:22 PM
Quote:
Originally Posted by Larry Legend
I'm using react for everything so I use a lot of jsx object styling, but when I write CSS classes I've just been using camelcase.

I don't see the point in hyphenating CSS classes when literally 99% of the rest of my code uses camelcase and it just seems like a better way for me to do it.

Am I an idiot?
I do use kebab-case for my CSS, but i can't defend it other than to say i'm following convention. Sometimes it's marginally useful to have the visual distinction between the two domains, but honestly I can't think of a solid argument against what you're doing.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-14-2017 , 06:47 PM
There's no such thing as CSS classes 😄dashes in html is a convention that I don't see changing for whatever reason.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-14-2017 , 06:48 PM
Yeah most of that stuff is just convention. Some languages have settled on camel case, some snake case, and some kebab case. Afaik there's very little difference by any practical measure. But note that if you go against convention with code other people will see be it looking over your GitHub or on a whiteboard, you might be judged harshly for it.

As you probably know, programmers can be extremely dogmatic
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-14-2017 , 07:35 PM
I have a contributor to my project that writes code completely different than me and I just cringe and accept his PRs and hope I don't judge. It passes lint at least.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-14-2017 , 07:36 PM
That's how the terrorists win or you get a co-creator when his weird code totally replaces your code in some module or other.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-14-2017 , 09:54 PM
Theoretically, you could try to mimick CSS classes with CSS pre-compilers. I've never had the need to get into the CSS pre-compilers. I believe the main one is called LESS.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-15-2017 , 12:38 AM
Quote:
Originally Posted by Grue
I have a contributor to my project that writes code completely different than me and I just cringe and accept his PRs and hope I don't judge. It passes lint at least.
I swear I read an article once about touching up contributors' PRs while maintaining their commit history (so they still get credit for doing it) for things like code style...

Found it! https://blog.spreedly.com/2014/06/24...dered-harmful/

Maybe you'll find that useful.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-15-2017 , 07:46 AM
I just read that quickly but I think I have a fundamental problem with it. Everyone should be responsible (both good and bad) for their work and only their work. This guys approach violates that because he's re-writing history.

Maybe I just don't really get the problem he's solving, because it seems like he could just check out the branch of the PR and make his clean-up changes as a commit on top of that.

Then again, I've never really cared much about the "super clean commit history" because in practice I don't find it that useful and I think it takes more effort to maintain then benefit it gives. In most repos I'm active in we're using pull requests for 99% of changes and so the pull request history is actually the 'clean' history of big issues that were changed.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-15-2017 , 12:42 PM
If I want to create a simple 2d scrolling shooter kind of in the same vein as galaga, where would be a good place to begin?

Unity seems overly complex for what I want.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-15-2017 , 01:29 PM
Surely Gullanian's Construct3 can't be a bad place to begin. Though I'd prob use Unity or even UE4 just for the benfit of learning a bit about them myself.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-15-2017 , 02:29 PM
Quote:
Originally Posted by kerowo
Thanks Dave, but those articles aren't what I have. They assume a path looks like a-a, a-b, a-c, a-d, where my paths are more like links in a linked list' a-b, b-c, c-d. I can't tell that from a-h, h-i, i-d. My guess is the UI populates a box with options as soon as the previous box is filled in.
I'm pretty sure there's a way to do that in raw SQL, but it'll be more efficient to do that in a procedural language. Basically, take the arg of the root you want, then iterate down until you have everything and return an array.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-15-2017 , 03:02 PM
They store the full path somewhere else in the db...
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-15-2017 , 05:09 PM
Basically, what you have is something called an adjacency list.

I have this table:

Code:
select *
from prods;


And to get the path, you need this query (fix accordingly):

Code:
select p1.*, p2.*
from prods p1
left join prods p2
on p1.pid = p2.fid;
Which outputs this:



If you have to go five levels deep, you can see where that is going....

Code:
select p1.*, p2.*, p3.*
from prods p1
left join prods p2
on p1.pid = p2.fid
left join prods p3
on p2.pid = p3.fid
-- etc etc etc
;
Since you already have path enumeration with something like this:

Code:
create table paths (path text primary key);

insert into paths (path)
values ('1, 2, 3, 4');
You'll have to split the path with a "like" query, split the string on ",", spin through all of those numbers, coerce to int, etc (adjust this to arrays if you are using it).

Basically, it would be a crazy query even if you have recursive CTEs available. If you don't have recursive CTE's, you'd have to split the string into a subselect, then self-join on the table 5 times the same as shown above. This will be an eye-glazer, which I think nullifies the point of using the extra table.

In effect, the first query, although rather lame, would be much easier to do than combining path enumeration, but all if this is much much easier (and more efficient) to do with a procedure.

I did some searches on adjacency lists and path enumerations, but didn't find a lot of good information on them. They are accurate, but pretty scattered, but those are the official terms you want to look for.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-15-2017 , 06:35 PM
Thanks dave!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-15-2017 , 08:23 PM
Quote:
Originally Posted by _dave_
Surely Gullanian's Construct3 can't be a bad place to begin. Though I'd prob use Unity or even UE4 just for the benfit of learning a bit about them myself.
lol

Quote:
Originally Posted by jmakin
If I want to create a simple 2d scrolling shooter kind of in the same vein as galaga, where would be a good place to begin?

Unity seems overly complex for what I want.
Gamemaker AINEC
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote

      
m