The Big Programming Thread - Page 879
Forum Index > General Forum |
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. | ||
Hanh
146 Posts
| ||
dsyxelic
United States1417 Posts
i dont think i even understand what those 2 were asking for | ||
Hanh
146 Posts
| ||
Deleted User 3420
24492 Posts
| ||
plasmidghost
Belgium16168 Posts
I've tried tons of fixes and I'm not sure what to do to make it work, it only does this with Python scripts. So far, I've edited the httpd config file in my Apache folder, I've granted full permissions to the Python script via icacls command in my command line, and I've set as many permissions as I can in my httpd config file to be Require all granted | ||
Hanh
146 Posts
| ||
TBO
Germany1350 Posts
Code Snipped is here: https://pastebin.com/ta4ReBSr Basically what happens is, that it works for ConcurrentDictionary, ConcurrentStack and ConcurrentQueue but fails for ConcurrentBag. As far as I see they all belong in the same Namespace so I have absolutely no idea what is going on here, it says it can't find ConcurrentBag but why can it then find the others if they are all in the same namespace ![]() (It also targets the right .Net version and mscorlib.dll from what I can see (and if it didn't then the others should also not work). | ||
Hanh
146 Posts
Change to:
and it will work. | ||
TBO
Germany1350 Posts
![]() | ||
Deleted User 3420
24492 Posts
the first one asks about the (empty set )* N the second one asks about (empty set) * R It asks if these (separate question for each) are: 1.) empty 2.) finite (and thus countable) 3.) infinite and countable 4.) uncountable I feel like they are both 1 and 2 but we are only allowed to pick one answer Where is my thinking wrong? edit: my thinking was right, got a quick reply from professor, their wording was incorrect | ||
Shield
Bulgaria4824 Posts
Is there a case when it's normal for base class to return an instance of its derived classes? Kind of like factory - you pass a parameter and you get an instance of a specific derived class. I find it a bit weird, but I'm wondering if it's just me. | ||
supereddie
Netherlands151 Posts
On May 04 2017 06:34 Shield wrote: OOP question. Is there a case when it's normal for base class to return an instance of its derived classes? Kind of like factory - you pass a parameter and you get an instance of a specific derived class. I find it a bit weird, but I'm wondering if it's just me. This sounds weird to me too. How would the base class know all the derived classes (even those in different assemblies). And is it just immediate derived class? What if the derived class is also a base class? Seems to me you could better use a factory or some other pattern. | ||
Acrofales
Spain17848 Posts
On May 04 2017 06:34 Shield wrote: OOP question. Is there a case when it's normal for base class to return an instance of its derived classes? Kind of like factory - you pass a parameter and you get an instance of a specific derived class. I find it a bit weird, but I'm wondering if it's just me. Definitely not normal. Possible? Only if you know what subclasses exist. It just seems like a bizar way of doing it. It doesn't sound like coherent functionality for the superclass, and it sounds like something that should either be in each subclass, or in a factory. | ||
Acrofales
Spain17848 Posts
On May 04 2017 06:24 travis wrote: I am a bit confused about a couple questions I am being asked about countability the first one asks about the (empty set )* N the second one asks about (empty set) * R It asks if these (separate question for each) are: 1.) empty 2.) finite (and thus countable) 3.) infinite and countable 4.) uncountable I feel like they are both 1 and 2 but we are only allowed to pick one answer Where is my thinking wrong? edit: my thinking was right, got a quick reply from professor, their wording was incorrect Ok. Was going to say I agree with you, but never got around to replying. If you have to pick only one, then pick "empty", because that is the best match, but every empty set is also quite obviously a finite set. | ||
spinesheath
Germany8679 Posts
On May 04 2017 19:39 Acrofales wrote: Definitely not normal. Possible? Only if you know what subclasses exist. It just seems like a bizar way of doing it. It doesn't sound like coherent functionality for the superclass, and it sounds like something that should either be in each subclass, or in a factory. Doesn't seem weird to me, for certain setups. Obviously it wouldn't return subclasses that it shouldn't know about, that would be very strange indeed. But I find it perfectly reasonable to have a public base class that represents some sort of object used in calculations and a couple of internal subclasses that implement different behavior based on the contents of this object. The class hierarchy is sealed off by not providing any public constructors. Like say some sort of currency class that also transparently deals with undefined values (null object pattern). You wouldn't want to have a CurrencyFactory for that, you just put a factory method in the currency class. | ||
Deleted User 3420
24492 Posts
I have some hard questions about cardinality "let D be the set of all functions with domain N and co-domain Q" "Does D have the same cardinality as R" ? I don't even know where to begin with this question Another question: If F is a finite set, do Q and Q-F have the same cardinality? (I think yes for this one, it would seem to me that it is still bijective. Final one: let B be the set of numbers of the form ax + b√2 where are a and b are in Q. Do B and Z have the same cardinality? I think this one is also yes, I think they are trying to get fancy with the √2, but it's just a linear function. | ||
frogmelter
United States971 Posts
On May 05 2017 03:49 spinesheath wrote: Doesn't seem weird to me, for certain setups. Obviously it wouldn't return subclasses that it shouldn't know about, that would be very strange indeed. But I find it perfectly reasonable to have a public base class that represents some sort of object used in calculations and a couple of internal subclasses that implement different behavior based on the contents of this object. The class hierarchy is sealed off by not providing any public constructors. Like say some sort of currency class that also transparently deals with undefined values (null object pattern). You wouldn't want to have a CurrencyFactory for that, you just put a factory method in the currency class. I think you would create a util class for that and not put it in the currency class itself. Moneys.fromLong(long units, String currencyCode); | ||
CoughingHydra
177 Posts
On May 05 2017 07:23 travis wrote: *beckons at acrofales* (or anyone adventurous) I have some hard questions about cardinality "let D be the set of all functions with domain N and co-domain Q" "Does D have the same cardinality as R" ? I don't even know where to begin with this question Another question: If F is a finite set, do Q and Q-F have the same cardinality? (I think yes for this one, it would seem to me that it is still bijective. Final one: let B be the set of numbers of the form ax + b√2 where are a and b are in Q. Do B and Z have the same cardinality? I think this one is also yes, I think they are trying to get fancy with the √2, but it's just a linear function. Eh, I PMed you, but I'll post the answer here too. First, I assume that you are using the following notation. N = natural numbers, Q = rational numbers, Z = integers, R = real numbers. What does Q-F mean? The set of functions from Q to F or Q minus F? Also, I'll use P(S) = the power set of S, i.e. the set of all subsets of S, |S| = the cardinality of the set S, S_1 -> S_2 = the set of all functions from S_1 to S_2 AxB = cartesian product of A and B, i.e. the set of all pairs (a,b) ------------------------- Next, let us recall some facts I assume you know. 1) for each set S, |P(S)| > |S| 2) for each set S, |P(S)| = cardinality of the set of all functions from S to {0,1}, i.e. in our notation |P(S)| = |S -> {0,1}| 3) |N| = |Z| = |Q| = countable infinity 4) |P(N)| = (|P(Z)| = |P(Q)|) = |R| = continuum infinity Recall also that one can consider a function f:A->B as a set of pairs (x,f(x)), but that means that each f is an element of AxB, which in turn implies that for the set of all function A->B it is true that 5) A->B is a subset of P(AxB), and in particular 6) |A->B| <= |P(AxB)| Also I assume you know that |NxN| = |N|, etc. Now we are ready. ------------------------- 1. question. Yes, D has the same cardinality as the set R. Proof. |D| = |N->Q| >= |N->{0,1}| = |P(N)| = continuum = |R| Therefore |D| >= |R|. On the other hand, |D| = |N->Q| <= |P(NxQ)| = |P(NxN)| = |P(N)| = continuum = |R|, and hence |D| <= |R|. ------------------------- 2. question. I don't know what you mean by Q-F If it means Q minus F, then yes, they have the same cardinality. If it means the set of functions Q->F, then it has continuum cardinality, so it is not the same as Q. ------------------------- 3. question. Yes, they have since |Z| = |Q| <= |B| <= |QxQ| = |NxN| = |N| = |Z|. ------------------------- | ||
Deleted User 3420
24492 Posts
im gonna need to study this stuff more, it's confusing as heck | ||
Shield
Bulgaria4824 Posts
| ||
| ||