• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 05:00
CEST 11:00
KST 18:00
  • 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 Season 1 - Final Week6[ASL19] Finals Recap: Standing Tall12HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0
Community News
Esports World Cup 2025 - Brackets Revealed10Weekly Cups (July 7-13): Classic continues to roll3Team TLMC #5 - Submission extension3Firefly given lifetime ban by ESIC following match-fixing investigation17$25,000 Streamerzone StarCraft Pro Series announced7
StarCraft 2
General
Weekly Cups (July 7-13): Classic continues to roll Esports World Cup 2025 - Brackets Revealed The GOAT ranking of GOAT rankings Team TLMC #5 - Submission extension Who will win EWC 2025?
Tourneys
RSL: Revival, a new crowdfunded tournament series FEL Cracov 2025 (July 27) - $8000 live event $5,100+ SEL Season 2 Championship (SC: Evo) WardiTV Mondays Sparkling Tuna Cup - Weekly Open Tournament
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
External Content
Mutation # 482 Wheel of Misfortune Mutation # 481 Fear and Lava Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ BW General Discussion Flash Announces (and Retracts) Hiatus From ASL Starcraft in widescreen A cwal.gg Extension - Easily keep track of anyone
Tourneys
Cosmonarchy Pro Showmatches [Megathread] Daily Proleagues CSL Xiamen International Invitational [BSL20] Non-Korean Championship 4x BSL + 4x China
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Path of Exile Nintendo Switch Thread Stormgate/Frost Giant Megathread CCLP - Command & Conquer League Project The PlayStation 5
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
Russo-Ukrainian War Thread Stop Killing Games - European Citizens Initiative US Politics Mega-thread Summer Games Done Quick 2025! Things Aren’t Peaceful in Palestine
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Movie Discussion! [Manga] One Piece Anime Discussion Thread [\m/] Heavy Metal Thread
Sports
Formula 1 Discussion TeamLiquid Health and Fitness Initiative For 2023 2024 - 2025 Football Thread NBA General Discussion NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Men Take Risks, Women Win Ga…
TrAiDoS
momentary artworks from des…
tankgirl
from making sc maps to makin…
Husyelt
StarCraft improvement
iopq
Trip to the Zoo
micronesia
Customize Sidebar...

Website Feedback

Closed Threads



Active: 537 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
Spain17976 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
Spain17976 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
Next event in 1h
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Nina 200
mcanning 118
StarCraft: Brood War
Zeus 892
sSak 46
Shinee 11
yabsab 10
Shine 10
Bale 5
PianO 0
Dota 2
XaKoH 563
XcaliburYe332
canceldota155
League of Legends
JimRising 533
Counter-Strike
Stewie2K1298
shoxiejesuss582
Super Smash Bros
Mew2King126
Other Games
summit1g11982
singsing838
Fuzer 241
SortOf127
Happy52
Trikslyr34
Organizations
Other Games
gamesdonequick3432
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 13 non-featured ]
StarCraft 2
• Berry_CruncH358
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota2172
League of Legends
• Lourlo1160
Upcoming Events
Replay Cast
1h
WardiTV European League
7h
ShoWTimE vs sebesdes
Percival vs NightPhoenix
Shameless vs Nicoract
Krystianer vs Scarlett
ByuN vs uThermal
Harstem vs HeRoMaRinE
PiGosaur Monday
15h
uThermal 2v2 Circuit
1d 7h
Replay Cast
1d 15h
The PondCast
2 days
WardiTV European League
2 days
Replay Cast
2 days
Epic.LAN
3 days
CranKy Ducklings
4 days
[ Show More ]
Epic.LAN
4 days
CSO Contender
4 days
BSL20 Non-Korean Champi…
4 days
Bonyth vs Sziky
Dewalt vs Hawk
Hawk vs QiaoGege
Sziky vs Dewalt
Mihu vs Bonyth
Zhanhun vs QiaoGege
QiaoGege vs Fengzi
Sparkling Tuna Cup
5 days
Online Event
5 days
BSL20 Non-Korean Champi…
5 days
Bonyth vs Zhanhun
Dewalt vs Mihu
Hawk vs Sziky
Sziky vs QiaoGege
Mihu vs Hawk
Zhanhun vs Dewalt
Fengzi vs Bonyth
Liquipedia Results

Completed

2025 ACS Season 2: Qualifier
RSL Revival: Season 1
Murky Cup #2

Ongoing

JPL Season 2
BSL 2v2 Season 3
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Jiahua Invitational
BSL20 Non-Korean Championship
Championship of Russia 2025
FISSURE Playground #1
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

Upcoming

CSL Xiamen Invitational
CSL Xiamen Invitational: ShowMatche
2025 ACS Season 2
CSLPRO Last Chance 2025
CSLPRO Chat StarLAN 3
BSL Season 21
K-Championship
RSL Revival: Season 2
SEL Season 2 Championship
uThermal 2v2 Main Event
FEL Cracov 2025
Esports World Cup 2025
Underdog Cup #2
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
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.