• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 00:30
CEST 06:30
KST 13:30
  • 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
Classic Games #3: Rogue vs Serral at BlizzCon9[ASL20] Ro16 Preview Pt1: Ascent10Maestros of the Game: Week 1/Play-in Preview12[ASL20] Ro24 Preview Pt2: Take-Off7[ASL20] Ro24 Preview Pt1: Runway13
Community News
SC4ALL $6,000 Open LAN in Philadelphia7Weekly Cups (Sept 1-7): MaxPax rebounds & Clem saga continues25LiuLi Cup - September 2025 Tournaments3Weekly Cups (August 25-31): Clem's Last Straw?39Weekly Cups (Aug 18-24): herO dethrones MaxPax6
StarCraft 2
General
Weekly Cups (Sept 1-7): MaxPax rebounds & Clem saga continues #1: Maru - Greatest Players of All Time Team Liquid Map Contest #21 - Presented by Monster Energy Classic Games #3: Rogue vs Serral at BlizzCon What happened to Singapore/Brazil servers?
Tourneys
Maestros of The Game—$20k event w/ live finals in Paris RSL: Revival, a new crowdfunded tournament series Sparkling Tuna Cup - Weekly Open Tournament SC4ALL $6,000 Open LAN in Philadelphia LANified! 37: Groundswell, BYOC LAN, Nov 28-30 2025
Strategy
Custom Maps
External Content
Mutation # 490 Masters of Midnight Mutation # 489 Bannable Offense Mutation # 488 What Goes Around Mutation # 487 Think Fast
Brood War
General
Pros React To: SoulKey's 5-Peat Challenge ASL20 General Discussion BW General Discussion BGH Auto Balance -> http://bghmmr.eu/ BSL Team Wars - Bonyth, Dewalt, Hawk & Sziky teams
Tourneys
[ASL20] Ro16 Group A [ASL20] Ro16 Group B [Megathread] Daily Proleagues SC4ALL $1,500 Open Bracket LAN
Strategy
Simple Questions, Simple Answers Muta micro map competition Fighting Spirit mining rates [G] Mineral Boosting
Other Games
General Games
Borderlands 3 Stormgate/Frost Giant Megathread Nintendo Switch Thread Path of Exile General RTS Discussion Thread
Dota 2
LiquidDota to reintegrate into TL.net 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
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine The Games Industry And ATVI UK Politics Mega-thread
Fan Clubs
The Happy Fan Club!
Media & Entertainment
Movie Discussion! [Manga] One Piece Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion MLB/Baseball 2023
World Cup 2022
Tech Support
Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread High temperatures on bridge(s)
TL Community
BarCraft in Tokyo Japan for ASL Season5 Final The Automated Ban List
Blogs
The Personality of a Spender…
TrAiDoS
A very expensive lesson on ma…
Garnet
hello world
radishsoup
Lemme tell you a thing o…
JoinTheRain
RTS Design in Hypercoven
a11
Evil Gacha Games and the…
ffswowsucks
Customize Sidebar...

Website Feedback

Closed Threads



Active: 3278 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
Spain18047 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
Spain18047 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 5h 30m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
NeuroSwarm 171
StarCraft: Brood War
Sea 4260
NaDa 70
sSak 40
Noble 17
Icarus 8
Dota 2
LuMiX1
League of Legends
JimRising 649
Super Smash Bros
hungrybox748
Other Games
summit1g6738
WinterStarcraft433
ViBE171
XaKoH 132
Organizations
Other Games
gamesdonequick2258
BasetradeTV26
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• Berry_CruncH254
• practicex 32
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• Diggity6
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Other Games
• Scarra1675
Upcoming Events
RSL Revival
5h 30m
Maestros of the Game
12h 30m
BSL Team Wars
14h 30m
Afreeca Starleague
1d 5h
Snow vs Sharp
Jaedong vs Mini
Wardi Open
1d 6h
Sparkling Tuna Cup
2 days
Afreeca Starleague
2 days
Light vs Speed
Larva vs Soma
LiuLi Cup
3 days
The PondCast
4 days
Korean StarCraft League
5 days
[ Show More ]
[BSL 2025] Weekly
6 days
BSL Team Wars
6 days
Liquipedia Results

Completed

Proleague 2025-09-10
SEL Season 2 Championship
HCC Europe

Ongoing

BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Points
ASL Season 20
CSL 2025 AUTUMN (S18)
LASL Season 20
RSL Revival: Season 2
Maestros of the Game
Chzzk MurlocKing SC1 vs SC2 Cup #2
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

Upcoming

2025 Chongqing Offline CUP
BSL Polish World Championship 2025
IPSL Winter 2025-26
BSL Season 21
SC4ALL: Brood War
BSL 21 Team A
SC4ALL: StarCraft II
EC S1
SL Budapest Major 2025
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
MESA Nomadic Masters Fall
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 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.