I almost always try to abstract out problems because half the time the very act of trying to express the problem abstractly makes me answer myself.
Definitely, sometimes!
But if not, then we're relying on the understanding of the person to relate the problem in an abstraction when that person presumably/often doesn't have a full understanding, hence why they're coming to others with problems. :rotate:
And "show me your code" avoids a tedium of back and forth / abstract-answers-for-abstract-questions.
The only exception to SHOW ME YOUR CODE and giving a direct answer is when it is school work.
Then I will avoid code and dance you around in circles until you fall face-first into a pile of enlightenment.
How bloody that process is varies.
0
Monkey Ball WarriorA collection of mediocre hatsSeattle, WARegistered Userregular
edited May 2012
Well this IS schoolwork, but I'm pretty sure at this point I'm going above and beyond because I've always wanted to write this application. The absolute shit quality of most Point of Sale systems was in fact one of the motivations for me going into comp sci in the first place.
Monkey Ball Warrior on
"I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
We're not needing to write SQL for you, but we kinda need to know the concepts you're working with. AKA schema.
0
Monkey Ball WarriorA collection of mediocre hatsSeattle, WARegistered Userregular
edited May 2012
So I DO in fact need to allow partially null foreign keys, and here's why:
A ticket will have multiple line items. Say a dude orders a large meat pizza with extra cheese and a large soda.
Pizzas start off with a template, in this case the Meat pizza template, so they start of with normal cheese, bacon, etc.
Soda, however, does NOT have a template. You can't customize soda. I might get more specific later on, say "Coca Cola" vs. "Sprite", but that's not customization, that's just different menu items. You can't get a Sprite with extra sugar.
So the table that tracks the individual line items in a given ticket has to track the templates for menu items that are customizable, but not for ones that aren't. If I specifiy a template, though, I want to make sure it is one that actually exists for that menu item.
So at this point my Ticket_items tables looks like
ecco, I would have assumed that it would get the value of X pre assignment, that makes the most sense. The assignment on the left should be evaluated first, and then the action/logic on the right is performed.
I can totally see how you'd think that - and I did rewrite the code so that it would behave as that.
Unfortunately, I believe this is one of the areas where C's design decisions can accidentally trip up the programmer. It tries to leave enough behaviour undefined so that the optimising compiler has freedom to work... but that's bitten quite a few programmers. There's a whole set of "It runs under debug, but breaks under release!" bugs just related to that.
Specifically, for equality, since assignment is *not* a sequence point, it means that the compiler is free to decide whether to evaluate the left expression first, the right expression first, or it could even interleave the two evaluations if it decided it was more efficient. But this freedom requires that the left expression and right expression be effectively independent of each other, which:
Hah, well I'm moving to a new project (sorta... Still have to finish the Java one, but my time is now split between the two) and we're going to be doing DMA scanning for malware and things like that through the hardware. Really interesting stuff. So I'm brushing up on my C and one of our contractors highly recommended the Intel manuals.
0
Monkey Ball WarriorA collection of mediocre hatsSeattle, WARegistered Userregular
Good news is that I think I can make my ER Model without lines crossing. That's something right?
"I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
Oh, that's pretty cool. Unfortunately for you though, any malware that's able to hide itself away from the OS can hide itself from everything if it tries hard enough on recent CPUs; ie HW can only access what the host explicitly allows it to, as enforced by the PCI root hub. Good luck though, it will at least work for older ones. What's your vector for getting in? Firewire?
Hah, well I'm moving to a new project (sorta... Still have to finish the Java one, but my time is now split between the two) and we're going to be doing DMA scanning for malware and things like that through the hardware. Really interesting stuff. So I'm brushing up on my C and one of our contractors highly recommended the Intel manuals.
Why does your job keep on having you chase your tail?
It's always silly pipe dreams that won't deliver anything useful.
Also you're going to have to be very careful with a memory scan - you don't know what ranges are ram and what ranges are mapped device memory. Very Bad Things can happen if you try to scan device mapped memory. Also, since you're downstream from the root hub you can't even find out the configuration
Welp... I was down to around 25 known bugs as of last week. Then they let someone else test it... Now we're at 63.
That's why just having the developer test the code is terrible. It used to happen all the time at my old job. I always tried to explain to them that I'm the developer, I'm biased and so at a disadvantage when testing. If I didn't already think it was correct I wouldn't have written it that way and I wouldn't be testing it yet. There are also things that you just don't even think to try because how it works is so engrained in your mind that you just know not to do X and it never crosses your mind that someone else might.
This is why you should have a conversation with a tester before you start programming. They are hungry to break things, and will help you build something hard to break.
Posts
Definitely, sometimes!
But if not, then we're relying on the understanding of the person to relate the problem in an abstraction when that person presumably/often doesn't have a full understanding, hence why they're coming to others with problems. :rotate:
And "show me your code" avoids a tedium of back and forth / abstract-answers-for-abstract-questions.
I'd rather see your code and see your example than the abstract stuff unless it's business critical/secret.
Then I will avoid code and dance you around in circles until you fall face-first into a pile of enlightenment.
How bloody that process is varies.
We're not needing to write SQL for you, but we kinda need to know the concepts you're working with. AKA schema.
A ticket will have multiple line items. Say a dude orders a large meat pizza with extra cheese and a large soda.
Pizzas start off with a template, in this case the Meat pizza template, so they start of with normal cheese, bacon, etc.
Soda, however, does NOT have a template. You can't customize soda. I might get more specific later on, say "Coca Cola" vs. "Sprite", but that's not customization, that's just different menu items. You can't get a Sprite with extra sugar.
So the table that tracks the individual line items in a given ticket has to track the templates for menu items that are customizable, but not for ones that aren't. If I specifiy a template, though, I want to make sure it is one that actually exists for that menu item.
So at this point my Ticket_items tables looks like
And some dummy data that Postgres has no problem taking is
So Ticket #1 has:
1: Large Meatocalypse Pizza
2: Large Soda
EDIT: So here's my final schema and sample data. Now I get to try to prove it is in 4NF. YAY!
I can totally see how you'd think that - and I did rewrite the code so that it would behave as that.
Unfortunately, I believe this is one of the areas where C's design decisions can accidentally trip up the programmer. It tries to leave enough behaviour undefined so that the optimising compiler has freedom to work... but that's bitten quite a few programmers. There's a whole set of "It runs under debug, but breaks under release!" bugs just related to that.
Specifically, for equality, since assignment is *not* a sequence point, it means that the compiler is free to decide whether to evaluate the left expression first, the right expression first, or it could even interleave the two evaluations if it decided it was more efficient. But this freedom requires that the left expression and right expression be effectively independent of each other, which:
pDest[ x ] = ++x;
is not.
Is going to keep me busy for a little while!
Why does your job keep on having you chase your tail?
It's always silly pipe dreams that won't deliver anything useful.
This is why you should have a conversation with a tester before you start programming. They are hungry to break things, and will help you build something hard to break.
Go to the new thread.