• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 06:16
CET 12:16
KST 20:16
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
RSL Revival - 2025 Season Finals Preview5RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12
Community News
Weekly Cups (Dec 1-7): Clem doubles, Solar gets over the hump1Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2BGE Stara Zagora 2026 announced15[BSL21] Ro.16 Group Stage (C->B->A->D)4Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win3
StarCraft 2
General
RSL Revival - 2025 Season Finals Preview Weekly Cups (Dec 1-7): Clem doubles, Solar gets over the hump Chinese SC2 server to reopen; live all-star event in Hangzhou Maestros of the Game: Live Finals Preview (RO4) BGE Stara Zagora 2026 announced
Tourneys
RSL Offline Finals Info - Dec 13 and 14! Tenacious Turtle Tussle 2025 RSL Offline Finals Dates + Ticket Sales! Sparkling Tuna Cup - Weekly Open Tournament StarCraft2.fi 15th Anniversary Cup
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 503 Fowl Play Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress Mutation # 500 Fright night
Brood War
General
FlaSh on: Biggest Problem With SnOw's Playstyle BGH Auto Balance -> http://bghmmr.eu/ [BSL21] RO8 Bracket & Prediction Contest BW General Discussion Let's talk about Metropolis
Tourneys
[ASL20] Grand Finals [BSL21] RO8 - Day 2 - Sunday 21:00 CET [BSL21] RO8 - Day 1 - Saturday 21:00 CET Small VOD Thread 2.0
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates Current Meta Game Theory for Starcraft
Other Games
General Games
Dawn of War IV Path of Exile Stormgate/Frost Giant Megathread Awesome Games Done Quick 2026! Nintendo Switch Thread
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas Survivor II: The Amazon Sengoku Mafia TL Mafia Community Thread
Community
General
Things Aren’t Peaceful in Palestine US Politics Mega-thread Russo-Ukrainian War Thread YouTube Thread European Politico-economics QA Mega-thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece Movie Discussion!
Sports
Formula 1 Discussion 2024 - 2026 Football Thread
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
TL+ Announced Where to ask questions and add stream?
Blogs
How Sleep Deprivation Affect…
TrAiDoS
I decided to write a webnov…
DjKniteX
James Bond movies ranking - pa…
Topin
Thanks for the RSL
Hildegard
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1360 users

The Big Programming Thread - Page 879

Forum Index > General Forum
Post a Reply
Prev 1 877 878 879 880 881 1032 Next
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
Profile Joined June 2016
146 Posts
April 30 2017 16:48 GMT
#17561
Think about what a node should do when visited and what value should bubble up, and you will be OK.
dsyxelic
Profile Joined May 2010
United States1417 Posts
April 30 2017 19:11 GMT
#17562
dang your assignments are nutty
i dont think i even understand what those 2 were asking for
TL/SKT
Hanh
Profile Joined June 2016
146 Posts
May 01 2017 08:23 GMT
#17563
I didn't want to give the solution away so this was just a hint. Basically, the problem can be solved by a tree traversal with specific actions performed on the nodes and data passed around.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
Last Edited: 2017-05-01 16:48:11
May 01 2017 16:47 GMT
#17564
Yeah that's what I am doing but I am having trouble with the "data passed around" part. The timing of when to do what. Gonna give it another go today for a couple hours before I study for an exam. my brain was so exhausted last weekend, I have been going at school work / studying about 12h a day for the last week, I don't think it's supposed to be this much - sometimes I feel stupid LOL
plasmidghost
Profile Blog Joined April 2011
Belgium16168 Posts
Last Edited: 2017-05-01 21:54:43
May 01 2017 21:52 GMT
#17565
Is anyone here familiar with Apache 2.4? I'm using XAMPP on Windows 7 to run an Apache server that connects via a Python script to my MySQL database and outputs data to a user's browser and I keep getting a 500 server error, with the message being End of script output before headers: script.py
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
Yugoslavia will always live on in my heart
Hanh
Profile Joined June 2016
146 Posts
May 02 2017 02:14 GMT
#17566
Your script is supposed to output headers, a blank line and then the html. Does it do that?
TBO
Profile Joined September 2009
Germany1350 Posts
Last Edited: 2017-05-03 13:18:03
May 03 2017 12:31 GMT
#17567
I have a C# Reflection question / weird Issue. If anyone has an Idea what's going on I would be very grateful:
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
Profile Joined June 2016
146 Posts
May 03 2017 13:44 GMT
#17568
ConcurrentBag is in the System.dll assembly, not mscorlib.

Change to:

String[] referenceAssemblies = { "System.dll" };
CompilerParameters cp = new CompilerParameters(referenceAssemblies);

and it will work.
TBO
Profile Joined September 2009
Germany1350 Posts
May 03 2017 13:52 GMT
#17569
Oh thanks a lot! I feel stupid now But kinda odd that all the others are in mscorlib and this one isn't, but there is probably a reason for it.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
Last Edited: 2017-05-03 22:46:05
May 03 2017 21:24 GMT
#17570
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


Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2017-05-03 21:35:16
May 03 2017 21:34 GMT
#17571
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.
supereddie
Profile Joined March 2011
Netherlands151 Posts
May 04 2017 08:57 GMT
#17572
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.
"Do not try to make difficult things possible, but make simple things simple." - David Platt on Software Design
Acrofales
Profile Joined August 2010
Spain18145 Posts
Last Edited: 2017-05-04 10:39:23
May 04 2017 10:39 GMT
#17573
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
Profile Joined August 2010
Spain18145 Posts
May 04 2017 10:40 GMT
#17574
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
Profile Blog Joined June 2009
Germany8679 Posts
May 04 2017 18:49 GMT
#17575
On May 04 2017 19:39 Acrofales wrote:
Show nested quote +
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.

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.
If you have a good reason to disagree with the above, please tell me. Thank you.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
Last Edited: 2017-05-04 22:23:33
May 04 2017 22:23 GMT
#17576
*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.
frogmelter
Profile Blog Joined April 2009
United States971 Posts
May 04 2017 23:19 GMT
#17577
On May 05 2017 03:49 spinesheath wrote:
Show nested quote +
On May 04 2017 19:39 Acrofales wrote:
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.

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);
TL+ Member
CoughingHydra
Profile Blog Joined May 2012
177 Posts
May 05 2017 21:47 GMT
#17578
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
Profile Blog Joined May 2003
24492 Posts
May 05 2017 23:18 GMT
#17579
thank you dude i love you

im gonna need to study this stuff more, it's confusing as heck
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
May 07 2017 21:18 GMT
#17580
About 2 months until I finish a part-time maths course. After that, hooray for free time and time to read some software/programming books. It's difficult when I go to work too. :D
Prev 1 877 878 879 880 881 1032 Next
Please log in or register to reply.
Live Events Refresh
StarCraft2.fi
10:00
15V Cup / Offline Finals
starcraft2fi 168
LiquipediaDiscussion
RSL Revival
04:30
Last Chance Qualifier
Maru vs ReynorLIVE!
Tasteless1590
Crank 1282
RotterdaM672
IndyStarCraft 244
CranKy Ducklings111
3DClanTV 108
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Tasteless 1590
Crank 1282
RotterdaM 672
IndyStarCraft 244
StarCraft: Brood War
Horang2 2218
Jaedong 1040
Killer 461
BeSt 390
Stork 358
actioN 332
Hyun 236
Last 198
firebathero 184
Rush 170
[ Show more ]
Mini 120
Larva 90
Leta 88
sorry 60
Aegong 52
Mind 46
hero 44
soO 43
ToSsGirL 41
Mong 34
zelot 33
Sacsri 21
Movie 20
Bale 16
Shine 10
yabsab 9
Dota 2
singsing2156
Gorgc1965
XcaliburYe438
canceldota65
League of Legends
JimRising 375
C9.Mang0361
rGuardiaN38
Counter-Strike
edward45
Heroes of the Storm
Khaldor163
Other Games
summit1g8755
FrodaN1395
B2W.Neo692
Hui .191
XaKoH 137
Mew2King74
KnowMe56
MindelVK15
Trikslyr10
Organizations
Other Games
gamesdonequick663
StarCraft: Brood War
lovetv 9
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 15 non-featured ]
StarCraft 2
• Berry_CruncH181
• intothetv
• LaughNgamezSOOP
• AfreecaTV YouTube
• sooper7s
• Migwel
• Kozan
• IndyKCrew
StarCraft: Brood War
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• lizZardDota279
League of Legends
• Jankos2056
• Stunt692
Other Games
• Scarra406
Upcoming Events
IPSL
5h 44m
Sziky vs JDConan
OSC
5h 44m
Solar vs Percival
Gerald vs Nicoract
Creator vs ByuN
BSL 21
8h 44m
Sziky vs StRyKeR
Hawk vs Dewalt
RSL Revival
17h 14m
Classic vs TBD
herO vs Zoun
WardiTV 2025
1d 1h
herO vs ShoWTimE
SHIN vs herO
Clem vs herO
SHIN vs Clem
SHIN vs ShoWTimE
Clem vs ShoWTimE
IPSL
1d 5h
Tarson vs DragOn
BSL 21
1d 8h
Tech vs Cross
Bonyth vs eOnzErG
Replay Cast
1d 21h
Wardi Open
2 days
Monday Night Weeklies
2 days
[ Show More ]
Sparkling Tuna Cup
2 days
Replay Cast
4 days
The PondCast
4 days
CranKy Ducklings
6 days
Liquipedia Results

Completed

Acropolis #4 - TS3
RSL Revival: Season 3
Kuram Kup

Ongoing

IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
Slon Tour Season 2
WardiTV 2025
RSL Offline Finals
META Madness #9
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Big Gabe Cup #3
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.