• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 21:08
CEST 03:08
KST 10:08
  • 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
[ASL19] Finals Recap: Standing Tall10HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0TL Team Map Contest #5: Presented by Monster Energy6
Community News
Weekly Cups (June 30 - July 6): Classic Doubles2[BSL20] Non-Korean Championship 4x BSL + 4x China9Flash Announces Hiatus From ASL66Weekly Cups (June 23-29): Reynor in world title form?14FEL Cracov 2025 (July 27) - $8000 live event22
StarCraft 2
General
The GOAT ranking of GOAT rankings The SCII GOAT: A statistical Evaluation Weekly Cups (June 23-29): Reynor in world title form? Weekly Cups (June 30 - July 6): Classic Doubles Program: SC2 / XSplit / OBS Scene Switcher
Tourneys
RSL: Revival, a new crowdfunded tournament series FEL Cracov 2025 (July 27) - $8000 live event Sparkling Tuna Cup - Weekly Open Tournament WardiTV Mondays Korean Starcraft League Week 77
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 481 Fear and Lava Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ ASL20 Preliminary Maps [ASL19] Finals Recap: Standing Tall SC uni coach streams logging into betting site Flash Announces Hiatus From ASL
Tourneys
[BSL20] Non-Korean Championship 4x BSL + 4x China [BSL20] Grand Finals - Sunday 20:00 CET CSL Xiamen International Invitational The Casual Games of the Week Thread
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread Path of Exile What do you want from future RTS games? Beyond All Reason
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
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread Summer Games Done Quick 2025! Russo-Ukrainian War Thread Stop Killing Games - European Citizens Initiative Summer Games Done Quick 2024!
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [\m/] Heavy Metal Thread
Sports
Formula 1 Discussion 2024 - 2025 Football Thread NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023 NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Culture Clash in Video Games…
TrAiDoS
from making sc maps to makin…
Husyelt
Blog #2
tankgirl
StarCraft improvement
iopq
Trip to the Zoo
micronesia
Customize Sidebar...

Website Feedback

Closed Threads



Active: 701 users

The Big Programming Thread - Page 879

Forum Index > General Forum
Post a Reply
Prev 1 877 878 879 880 881 1031 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
Spain17971 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
Spain17971 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 1031 Next
Please log in or register to reply.
Live Events Refresh
Replay Cast
00:00
Korean StarCraft League #77
CranKy Ducklings119
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
PiGStarcraft404
Livibee 121
ProTech69
RuFF_SC2 54
Vindicta 14
StarCraft: Brood War
MaD[AoV]35
Bale 30
Icarus 4
Dota 2
monkeys_forever369
NeuroSwarm124
League of Legends
JimRising 609
Counter-Strike
summit1g10964
tarik_tv5375
taco 413
Super Smash Bros
Mew2King137
Other Games
shahzam904
Maynarde150
Day[9].tv122
ToD96
JuggernautJason95
Organizations
Other Games
gamesdonequick49546
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 22 non-featured ]
StarCraft 2
• HeavenSC 26
• davetesta25
• Berry_CruncH23
• Mapu3
• Kozan
• sooper7s
• Migwel
• AfreecaTV YouTube
• LaughNgamezSOOP
• intothetv
• IndyKCrew
StarCraft: Brood War
• Pr0nogo 1
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota2652
League of Legends
• Jankos1484
• TFBlade562
• Stunt241
Other Games
• Scarra1671
• WagamamaTV189
• Day9tv122
Upcoming Events
Sparkling Tuna Cup
8h 52m
WardiTV European League
14h 52m
MaNa vs sebesdes
Mixu vs Fjant
ByuN vs HeRoMaRinE
ShoWTimE vs goblin
Gerald vs Babymarine
Krystianer vs YoungYakov
PiGosaur Monday
22h 52m
The PondCast
1d 8h
WardiTV European League
1d 10h
Jumy vs NightPhoenix
Percival vs Nicoract
ArT vs HiGhDrA
MaxPax vs Harstem
Scarlett vs Shameless
SKillous vs uThermal
uThermal 2v2 Circuit
1d 14h
Replay Cast
1d 22h
RSL Revival
2 days
ByuN vs SHIN
Clem vs Reynor
Replay Cast
2 days
RSL Revival
3 days
Classic vs Cure
[ Show More ]
FEL
3 days
RSL Revival
4 days
FEL
4 days
FEL
4 days
CSO Cup
4 days
BSL20 Non-Korean Champi…
4 days
Bonyth vs QiaoGege
Dewalt vs Fengzi
Hawk vs Zhanhun
Sziky vs Mihu
Mihu vs QiaoGege
Zhanhun vs Sziky
Fengzi vs Hawk
Sparkling Tuna Cup
5 days
RSL Revival
5 days
FEL
5 days
BSL20 Non-Korean Champi…
5 days
Bonyth vs Dewalt
QiaoGege vs Dewalt
Hawk vs Bonyth
Sziky vs Fengzi
Mihu vs Zhanhun
QiaoGege vs Zhanhun
Fengzi vs Mihu
Liquipedia Results

Completed

BSL Season 20
HSC XXVII
Heroes 10 EU

Ongoing

JPL Season 2
BSL 2v2 Season 3
Acropolis #3
KCM Race Survival 2025 Season 2
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Jiahua Invitational
Championship of Russia 2025
RSL Revival: Season 1
Murky Cup #2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025

Upcoming

2025 ACS Season 2: Qualifier
CSLPRO Last Chance 2025
CSL Xiamen Invitational
2025 ACS Season 2
CSLPRO Chat StarLAN 3
K-Championship
uThermal 2v2 Main Event
SEL Season 2 Championship
FEL Cracov 2025
Esports World Cup 2025
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
FISSURE Playground #1
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.