• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 08:56
CEST 14:56
KST 21:56
  • 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
TL.net Map Contest #21: Voting3[ASL20] Ro4 Preview: Descent6Team TLMC #5: Winners Announced!3[ASL20] Ro8 Preview Pt2: Holding On9Maestros of the Game: Live Finals Preview (RO4)5
Community News
Weekly Cups (Oct 6-12): Four star herO65.0.15 Patch Balance Hotfix (2025-10-8)70Weekly Cups (Sept 29-Oct 5): MaxPax triples up3PartinG joins SteamerZone, returns to SC2 competition325.0.15 Balance Patch Notes (Live version)119
StarCraft 2
General
5.0.15 Patch Balance Hotfix (2025-10-8) The New Patch Killed Mech! TL.net Map Contest #21: Voting Weekly Cups (Oct 6-12): Four star herO PartinG joins SteamerZone, returns to SC2 competition
Tourneys
Master Swan Open (Global Bronze-Master 2) Tenacious Turtle Tussle WardiTV Mondays SC2's Safe House 2 - October 18 & 19 Sparkling Tuna Cup - Weekly Open Tournament
Strategy
Custom Maps
External Content
Mutation # 495 Rest In Peace Mutation # 494 Unstable Environment Mutation # 493 Quick Killers Mutation # 492 Get Out More
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ Brood War web app to calculate unit interactions BSL Season 21 Whose hotkey signature is this? Any rep analyzer that shows resources situation?
Tourneys
[ASL20] Semifinal B [ASL20] Semifinal A [Megathread] Daily Proleagues [ASL20] Ro8 Day 4
Strategy
Current Meta BW - ajfirecracker Strategy & Training Siegecraft - a new perspective TvZ Theorycraft - Improving on State of the Art
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread ZeroSpace Megathread Dawn of War IV Path of Exile
Dota 2
Official 'what is Dota anymore' discussion LiquidDota to reintegrate into TL.net
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
SPIRED by.ASL Mafia {211640} TL Mafia Community Thread
Community
General
Russo-Ukrainian War Thread Men's Fashion Thread Things Aren’t Peaceful in Palestine Sex and weight loss US Politics Mega-thread
Fan Clubs
The herO Fan Club! The Happy Fan Club!
Media & Entertainment
Anime Discussion Thread [Manga] One Piece Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion MLB/Baseball 2023 NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Recent Gifted Posts
Blogs
Inbreeding: Why Do We Do It…
Peanutsc
From Tilt to Ragequit:The Ps…
TrAiDoS
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1218 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
Spain18088 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
Spain18088 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
LiuLi Cup
11:00
46
Rogue vs herOLIVE!
Clem vs Classic
WardiTV849
RotterdaM417
Rex131
Liquipedia
Afreeca Starleague
10:00
Ro4 Match 2
Soma vs BisuLIVE!
Afreeca ASL 19533
sctven
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RotterdaM 417
Lowko341
Rex 131
ProTech87
StarCraft: Brood War
Calm 12474
Rain 6422
Flash 5790
Sea 5174
Jaedong 3742
BeSt 2385
Horang2 1231
Mini 1183
EffOrt 792
Larva 659
[ Show more ]
Pusan 641
actioN 500
ZerO 431
Stork 389
firebathero 324
Hyun 268
Light 229
Barracks 150
hero 109
PianO 107
Backho 68
JYJ63
ToSsGirL 61
ggaemo 59
Rush 57
Mong 56
Aegong 55
Sharp 37
NotJumperer 32
JulyZerg 32
soO 25
yabsab 18
Terrorterran 17
Sacsri 16
Bale 16
ajuk12(nOOB) 15
scan(afreeca) 12
Killer 11
Icarus 11
HiyA 10
Noble 10
ivOry 8
SilentControl 7
Hm[arnc] 7
Dota 2
qojqva2682
Dendi1243
Gorgc739
XaKoH 367
XcaliburYe330
BananaSlamJamma180
Counter-Strike
x6flipin426
edward38
Other Games
olofmeister1066
hiko450
B2W.Neo382
crisheroes332
Pyrionflax263
DeMusliM256
Liquid`LucifroN90
Fuzer 84
oskar67
ArmadaUGS62
Codebar2
Organizations
Counter-Strike
PGL8852
StarCraft: Brood War
UltimateBattle 347
lovetv 13
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 11 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos3069
Upcoming Events
OSC
1h 4m
OSC
5h 4m
MaxPax vs Gerald
Solar vs Krystianer
PAPI vs Lemon
Ryung vs Moja
Nice vs NightPhoenix
Cham vs TBD
MaNa vs TriGGeR
PiGosaur Monday
11h 4m
OSC
1d 10h
The PondCast
1d 21h
OSC
1d 23h
Wardi Open
2 days
CranKy Ducklings
3 days
Safe House 2
4 days
Sparkling Tuna Cup
4 days
[ Show More ]
Safe House 2
5 days
Liquipedia Results

Completed

Acropolis #4 - TS2
WardiTV TLMC #15
HCC Europe

Ongoing

BSL 21 Points
ASL Season 20
CSL 2025 AUTUMN (S18)
C-Race Season 1
IPSL Winter 2025-26
EC S1
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025

Upcoming

SC4ALL: Brood War
BSL Season 21
BSL 21 Team A
RSL Offline Finals
RSL Revival: Season 3
Stellar Fest
SC4ALL: StarCraft II
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
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.