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.
Why should it?
How would
MyValue = MyValue + 5;
Be evaluated then? It assumes MyValue's original value before any evaluation? A whole lot of things would not work, eh?
not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
Cygwin is dumb, you'd be better off using VirtualBox and getting a debian install. Or install mingw.
At that point maybe bloodshed 's C++ ide would work. You don't have to write C++ projects in it. Or stick with sublime and use the built in makefile part of it.
not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
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.
Why should it?
How would
MyValue = MyValue + 5;
Be evaluated then? It assumes MyValue's original value before any evaluation? A whole lot of things would not work, eh?
MyValue on the left isn't an integer. It's an l-value, and I know that l-value before you touch the right hand side, during, and after.
My experience with Cygwin has been... less than positive. I'd just set up a Linux partition instead, if possible. It's honestly less of a headache.
Same. I'm not a fan of it... But I am going to have to end up writing memory scanning for Windows so I don't think using a Linux Partition is the route I want to go.
virtual machines if you're afraid of another partition....
perfectly valid syntax in languages that do closures properly.
Well that would be tricky, I would assume someone who designed a language spec wouldn't leave that undefined and simply come up with a way that should work.
I would probably default to leftmost = final assignment and then switch to rightmost evaluations. So the position in the array would be 4, as evaluated with MyVal+1, and finally assigning that to MyVal because it's the leftmost expression. I could see both ways though.
not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
Isn't void main() an acceptable declaration under C89? I thought there were three different valid main()s:
int main(int argc, char **argv)
int main(void)
void main(void)
edit: and the compiler would automatically consider the last one to always return 0 or EXIT_SUCCESS.
Article 2.1.2.2 Hosted environment from c89 spec only shows usage of int main, it even states that main must return like exit, and returning without a value may result in undefined behavior. The usage of void main(void) is caused by people using lax compilers.
Isn't void main() an acceptable declaration under C89? I thought there were three different valid main()s:
int main(int argc, char **argv)
int main(void)
void main(void)
edit: and the compiler would automatically consider the last one to always return 0 or EXIT_SUCCESS.
I don't think void main is valid by C89
and some quick testing indicates that it doesn't even do what you were expecting (I got 1 as the exit code under gcc)
I wish that someway, somehow, that I could save every one of us
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.
Why should it?
How would
MyValue = MyValue + 5;
Be evaluated then? It assumes MyValue's original value before any evaluation? A whole lot of things would not work, eh?
But, the compiler is allowed to transform and evaluate your expression in any way, so long as the result is the same
i = i++
can be done as (for example):
i = i
i++
tmp = i
i++
i = tmp
i++
i = i-1
i+1 does not affect the value of i, i++ does and it's undefined as to where that happens relative to the assignment
Isn't void main() an acceptable declaration under C89? I thought there were three different valid main()s:
int main(int argc, char **argv)
int main(void)
void main(void)
edit: and the compiler would automatically consider the last one to always return 0 or EXIT_SUCCESS.
I don't think void main is valid by C89
and some quick testing indicates that it doesn't even do what you were expecting (I got 1 as the exit code under gcc)
Yeah, after looking into it more, it seems void main was never (ever) considered valid, and the only reason it shows up is because compilers weren't willing to call people on their bullshit.
Personally, I don't think I've ever NOT used int main(int argc, char **argv) with EXIT_SUCCESS and EXIT_FAILURE (since it feels hacky to just return a magic number).
perfectly valid syntax in languages that do closures properly.
Well that would be tricky, I would assume someone who designed a language spec wouldn't leave that undefined and simply come up with a way that should work.
I would probably default to leftmost = final assignment and then switch to rightmost evaluations. So the position in the array would be 4, as evaluated with MyVal+1, and finally assigning that to MyVal because it's the leftmost expression. I could see both ways though.
yeh, that's what it does,
it's tricky, but is available (and useful) in any language that supports closures (java go sit in the corner with the dunce cap, again).
it's very nice when you when you're overriding some methods in classes, such as (in python) handling certain HTTP errors.
Say, you're doing a REST API, and you need to handle the 300 series differently than spec'd. Make the class for one of the errors and then:
http_error_301 = http_error_303 = http_error_307 = http_error_302
Monkey Ball WarriorA collection of mediocre hatsSeattle, WARegistered Userregular
edited May 2012
Okay, so imagine 3 database tables A(id), B(id, foo), C(id, foo, bar). B.id is a foreign key to A.id, and so is C.id, but C.(id, foo) is also a foreign key for B, but only if C.foo is not null.
Am I breaking normalization somewhere? If not, how the hell do I express that in SQL?
EDIT: Basically I guess I'm asking if a partially null composite foreign key is legit.
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
That should be fine, your join could be an issue if you don't use the correct one if it filters out partial null values.
not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
0
Monkey Ball WarriorA collection of mediocre hatsSeattle, WARegistered Userregular
edited May 2012
I've decided the only way to be sure is to try it and see if things explode in my face, or if my professor has a fit when she sees it.
EDIT: If you are curious, for my final Databases project I'm implementing a Point of Sale system for a pizza place, and the issue is trying to store something like
Ticket #552, Line Item #2: Large Meatocalypse Pizza with Extra Cheese and No Ham
Okay, so imagine 3 database tables A(id), B(id, foo), C(id, foo, bar). B.id is a foreign key to A.id, and so is C.id, but C.(id, foo) is also a foreign key for B, but only if C.foo is not null.
Am I breaking normalization somewhere? If not, how the hell do I express that in SQL?
EDIT: Basically I guess I'm asking if a partially null composite foreign key is legit.
What are you trying to accomplish?
A nullable column in a foreign key is allowable (at least in some DBMS) but that means the reference is not enforced, so what are you hoping to gain?
edit: Actually, that seems like it might work if you're trying to do this:
For every C, if foo is null, make sure id is in A, if foo is not null, make sure id+foo is in B?
If so, if you can create two foreign keys (one on id -> A, one on id+foo ->B) and foo is nullable, that should work, since the B FK will be ignored for referential integrity but the A FK will still be enforced.
If it's a composite key, chances are you wouldn't be able to insert into it with a null value unless there was a matching value with nulls in B. If I'm understanding you right.
not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
0
Monkey Ball WarriorA collection of mediocre hatsSeattle, WARegistered Userregular
Hopefully that helps you see what I'm going for.
"I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
If it's a composite key, chances are you wouldn't be able to insert into it with a null value unless there was a matching value with nulls in B. If I'm understanding you right.
If it is allowed at all, when you create a composite key that has nullable fields, if any field is null then NO reference is checked or maintained.
Which basically means what I was saying in the edit. You have A FK, which has no nullable, so is mandatory / enforced, and then B FK, which is enforced iif there are no nulls, otherwise simply ignored.
I feel like this is a very simple problem but I'm having a brain fart.
In MSAccess
I have a combo box, called cbFO, storing the ID values, that range from 0 to 6.
I have a query, that takes the input from cbFO and returns the results that apply. So for example:
Query setup:
Field: Field Office ID
Table: Field Offices
Sort: Ascending
Criteria: [Forms]![main]![cbFO]
Will give me most of what I want. But I created a new FO, called CENTRAL OFFICE with an ID of 0. Now I want in my criteria field to check to see if cbFO = 0 (that is, CENTRAL OFFICE is selected), give me all the records.
I tried something like:
Field: Field Office ID
Table: Field Offices
Sort: Ascending
Criteria: iif( ([Forms]![main]![cbFO] = 0), "*", [Forms]![main]![cbFO] )
to check and see if, the combo box has CENTRAL OFFICE (which has ID 0) as the selection, return ALL records, else return whatever combo box has selected...But it's not working correctly. Gives me an error about it being too complicated.
What am I doing wrong?
Edit:
Nevermind, solved it, I'm an idiot. Just changed the criteria to:
Criteria: [forms]![Form1]![cbFO] Or [Forms]![Form1]![cbFO] Like "0"
Are they actually? We don't have the context to know that.
Which is why the majority of SQL/database posts and H&As are solved after I get someone to be specific. :P
Abstract examples usually just hide the real issue.
0
Monkey Ball WarriorA collection of mediocre hatsSeattle, WARegistered Userregular
You know what... I'm realizing that I don't need to do that after all. Basically if I'm adding customizations, then I know already that I'm dealing with an item that has a template (otherwise I wouldn't have somewhere to start from).
I should be able to avoid partially null foreign keys now.
"I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
Posts
How would
MyValue = MyValue + 5;
Be evaluated then? It assumes MyValue's original value before any evaluation? A whole lot of things would not work, eh?
At that point maybe bloodshed 's C++ ide would work. You don't have to write C++ projects in it. Or stick with sublime and use the built in makefile part of it.
MyValue on the left isn't an integer. It's an l-value, and I know that l-value before you touch the right hand side, during, and after.
and
maybe in C89, but in K&R C, it returns int. always.
Joe's Stream.
virtual machines if you're afraid of another partition....
Joe's Stream.
Outputs:
Most OS expect int 0 as success.
perfectly valid syntax in languages that do closures properly.
Joe's Stream.
compiler usually takes care of it... and if he's using an ANSI (C89) compatible one, that should work....
of course, if he's using a strict K&R, well, that doesn't work.
Joe's Stream.
Well that would be tricky, I would assume someone who designed a language spec wouldn't leave that undefined and simply come up with a way that should work.
I would probably default to leftmost = final assignment and then switch to rightmost evaluations. So the position in the array would be 4, as evaluated with MyVal+1, and finally assigning that to MyVal because it's the leftmost expression. I could see both ways though.
Article 2.1.2.2 Hosted environment from c89 spec only shows usage of int main, it even states that main must return like exit, and returning without a value may result in undefined behavior. The usage of void main(void) is caused by people using lax compilers.
Well if he's using cygwin who knows what he ended up with.
Also a linux virtual machine is really nice for learning C.
I don't think void main is valid by C89
and some quick testing indicates that it doesn't even do what you were expecting (I got 1 as the exit code under gcc)
You can install Windows SUA instead of Cygwin.
Don't assume bad intentions over neglect and misunderstanding.
I wouldn't call it exception handling since the major point and use of it is chaining the results of programs together, aka unix style.
I thought that was cstdlib & C++ that did that.
yeah
I don't think cstdlib normally has anything stdlib.h doesn't have, aside from the namespacing
But, the compiler is allowed to transform and evaluate your expression in any way, so long as the result is the same
i = i++
can be done as (for example):
i = i
i++
tmp = i
i++
i = tmp
i++
i = i-1
i+1 does not affect the value of i, i++ does and it's undefined as to where that happens relative to the assignment
Yeah, after looking into it more, it seems void main was never (ever) considered valid, and the only reason it shows up is because compilers weren't willing to call people on their bullshit.
Personally, I don't think I've ever NOT used int main(int argc, char **argv) with EXIT_SUCCESS and EXIT_FAILURE (since it feels hacky to just return a magic number).
yeh, that's what it does,
it's tricky, but is available (and useful) in any language that supports closures (java go sit in the corner with the dunce cap, again).
it's very nice when you when you're overriding some methods in classes, such as (in python) handling certain HTTP errors.
Say, you're doing a REST API, and you need to handle the 300 series differently than spec'd. Make the class for one of the errors and then:
http_error_301 = http_error_303 = http_error_307 = http_error_302
ezpz :-)
Joe's Stream.
Am I breaking normalization somewhere? If not, how the hell do I express that in SQL?
EDIT: Basically I guess I'm asking if a partially null composite foreign key is legit.
EDIT: If you are curious, for my final Databases project I'm implementing a Point of Sale system for a pizza place, and the issue is trying to store something like
Ticket #552, Line Item #2: Large Meatocalypse Pizza with Extra Cheese and No Ham
Here's my schema so far:
What are you trying to accomplish?
A nullable column in a foreign key is allowable (at least in some DBMS) but that means the reference is not enforced, so what are you hoping to gain?
edit: Actually, that seems like it might work if you're trying to do this:
For every C, if foo is null, make sure id is in A, if foo is not null, make sure id+foo is in B?
If so, if you can create two foreign keys (one on id -> A, one on id+foo ->B) and foo is nullable, that should work, since the B FK will be ignored for referential integrity but the A FK will still be enforced.
If it is allowed at all, when you create a composite key that has nullable fields, if any field is null then NO reference is checked or maintained.
Which basically means what I was saying in the edit. You have A FK, which has no nullable, so is mandatory / enforced, and then B FK, which is enforced iif there are no nulls, otherwise simply ignored.
In MSAccess
I have a combo box, called cbFO, storing the ID values, that range from 0 to 6.
I have a query, that takes the input from cbFO and returns the results that apply. So for example:
Query setup:
Will give me most of what I want. But I created a new FO, called CENTRAL OFFICE with an ID of 0. Now I want in my criteria field to check to see if cbFO = 0 (that is, CENTRAL OFFICE is selected), give me all the records.
I tried something like:
to check and see if, the combo box has CENTRAL OFFICE (which has ID 0) as the selection, return ALL records, else return whatever combo box has selected...But it's not working correctly. Gives me an error about it being too complicated.
What am I doing wrong?
Edit:
Nevermind, solved it, I'm an idiot. Just changed the criteria to:
Criteria: [forms]![Form1]![cbFO] Or [Forms]![Form1]![cbFO] Like "0"
Don't assume bad intentions over neglect and misunderstanding.
Are they actually? We don't have the context to know that.
Which is why the majority of SQL/database posts and H&As are solved after I get someone to be specific. :P
Abstract examples usually just hide the real issue.
I should be able to avoid partially null foreign keys now.
Well, Monkey Ball posted posted his schema in an edit, so you can look at that.
edit: err... what i wrote might not be applicable...
Don't assume bad intentions over neglect and misunderstanding.