• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 02:57
CET 08:57
KST 16:57
  • 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 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10
Community News
Weekly 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 win3RSL Season 3: RO16 results & RO8 bracket13
StarCraft 2
General
Chinese SC2 server to reopen; live all-star event in Hangzhou Maestros of the Game: Live Finals Preview (RO4) BGE Stara Zagora 2026 announced Weekly Cups (Nov 24-30): MaxPax, Clem, herO win SC2 Proleague Discontinued; SKT, KT, SGK, CJ disband
Tourneys
StarCraft Evolution League (SC Evo Biweekly) RSL Offline Finals Info - Dec 13 and 14! RSL Offline FInals Sea Duckling Open (Global, Bronze-Diamond) $5,000+ WardiTV 2025 Championship
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress Mutation # 500 Fright night Mutation # 499 Chilling Adaptation
Brood War
General
BW General Discussion Which season is the best in ASL? Data analysis on 70 million replays BGH Auto Balance -> http://bghmmr.eu/ [ASL20] Ask the mapmakers — Drop your questions
Tourneys
[BSL21] RO16 Group D - Sunday 21:00 CET [BSL21] RO16 Group A - Saturday 21:00 CET [Megathread] Daily Proleagues [BSL21] RO16 Group B - Sunday 21:00 CET
Strategy
Current Meta Game Theory for Starcraft How to stay on top of macro? PvZ map balance
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread ZeroSpace Megathread The Perfect Game Path of Exile
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 TL Mafia Community Thread
Community
General
Russo-Ukrainian War Thread US Politics Mega-thread Things Aren’t Peaceful in Palestine The Big Programming Thread Artificial Intelligence Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
[Manga] One Piece Movie Discussion! Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Where to ask questions and add stream? The Automated Ban List
Blogs
Physical Exertion During Gam…
TrAiDoS
James Bond movies ranking - pa…
Topin
Thanks for the RSL
Hildegard
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1475 users

The Big Programming Thread - Page 520

Forum Index > General Forum
Post a Reply
Prev 1 518 519 520 521 522 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.
dapierow
Profile Blog Joined April 2010
Serbia1316 Posts
September 17 2014 22:22 GMT
#10381
Hey guys! looking for a bit of help with conceptualizing two objects each holding a reference to a list of the other object.

Im not sure whether to store a reference of the list or the actual list itself in each object. And do I initialize the the list in the constructor or call a method?

basically im reading in a large database file, that's split into two parts, each part creates numerous amounts of the same object.

Now the part I'm having confusion with: each object holds a list that associates itself to numerous specific objects in the other part of the database file and vice versa. So I really have no idea how to initialize each list for each object.
Eat.Sleep.Starcraft 2
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
Last Edited: 2014-09-18 02:06:31
September 18 2014 02:03 GMT
#10382
--- Nuked ---
icystorage
Profile Blog Joined November 2008
Jollibee19350 Posts
September 18 2014 02:36 GMT
#10383
http://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered
LiquidDota StaffAre you ready for a Miracle-? We are! The International 2017 Champions!
Ben...
Profile Joined January 2011
Canada3485 Posts
September 18 2014 06:11 GMT
#10384
On September 18 2014 11:36 icystorage wrote:
http://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered

Officially naming all of my exceptions up from now on.
"Cliiiiiiiiiiiiiiiiide" -Tastosis
nunez
Profile Blog Joined February 2011
Norway4003 Posts
Last Edited: 2014-09-18 16:02:47
September 18 2014 15:40 GMT
#10385
musings on cpp parameter pack expansion

why can't you expand parameter packs like so:
template<class type> int function0(){}

template<class... types>
void function1(){
function0<types>()...;
}

i think it would be nice if it was equivalent to (comma operator on result of function calls):
template<class type> int function0(){}

template<class... types>
void function1(){
function0<typename type_at<0,types...>::type>(),
function0<typename type_at<1,types...>::type>(),
...
function0<typename type_at<sizeof...(types)-1,types...>::type>();
}

if function0's return type was not void you could do:
template<class... types> eat(types...){}

template<class type> int function0(){}

template<class... types>
void function1(){
eat(function0<types>()...);
}

or:
template<class type> int function0(){}

template<class... types>
void function1(){
auto dummy={function0<types>()...};
}

but it's awkward (and doesn't work for void) and this seems like an oversight (unlike expanding parameter packs into switch cases like i posted earlier which probably is more difficult).

another workaround that works for void return type as well is:
template<class type> void function0(){}

template<class... types>
void function1(){

static constexpr std::array<
void(*)(),
sizeof...(types)
> functions{ function0<types>... };

for(auto function:functions) function();

}


note that the type of the array needs to be explicit and not deduced (by auto) because deduction fails, not just because i like being explicit about types (maybe you should be able to give it a hint auto(array<_1,_2>)).

also it would be sweet if you could reverse parameter packs like so:
template<class type> void function0(){}

template<class... types>
void function1(){

static constexpr std::array<
void(*)(),
sizeof...(types)
> functions{ function0<types>... };

for(auto function:functions) function();


static constexpr std::array<
void(*)(),
sizeof...(types)
> reversed_functions{ ...function0<types> };

for(auto reversed_function:reversed_functions) reversed_function();
}

that the first reversed_function call is function0 instantiated with the last type in the parameter pack, and so on.

recursive expansion would also be sweet, but i haven't managed to come up with a good syntax (using @ for now). that is, the expansion (and the reverse expansion) would be equivalent to:
	(function<types>@)()
	function0<typename type_at<sizeof...(types)-1>::type>(
...
function0<typename type_at<1>::type>(
function0<typename type_at<0>::type>()
)
)

and reversed:
	(@function<types>)()
	function0<typename type_at<0>::type>(
...
function0<typename type_at<sizeof...(types)-2>::type>(
function0<typename type_at<sizeof...(types)-1>::type>()
)
)
conspired against by a confederacy of dunces.
ferdkuh
Profile Joined January 2013
10 Posts
September 18 2014 16:35 GMT
#10386
On September 18 2014 07:22 dapierow wrote:
Hey guys! looking for a bit of help with conceptualizing two objects each holding a reference to a list of the other object.

Im not sure whether to store a reference of the list or the actual list itself in each object. And do I initialize the the list in the constructor or call a method?

basically im reading in a large database file, that's split into two parts, each part creates numerous amounts of the same object.

Now the part I'm having confusion with: each object holds a list that associates itself to numerous specific objects in the other part of the database file and vice versa. So I really have no idea how to initialize each list for each object.


I am not entirely sure if I completely understand what you are trying to do, but a nice way to deal with circular references is to use lazy initialization, i.e. don't initialize the value when you create your object but when it is first accessed.

If the language you are using has built-in support for lazy values, the solution can look very elegant, e.g. for Scala here: http://stackoverflow.com/questions/7507965/instantiating-immutable-paired-objects.
If not, it still works but requires more effort from your side and does not look as "clean".
Manit0u
Profile Blog Joined August 2004
Poland17496 Posts
September 19 2014 13:51 GMT
#10387
On September 18 2014 11:36 icystorage wrote:
http://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered


Run into this today:


// for through products
foreach ($products as $product) {
...
}


Cpt. Obvious strikes again.
Time is precious. Waste it wisely.
Rotodyne
Profile Blog Joined July 2005
United States2263 Posts
September 19 2014 15:19 GMT
#10388
On September 19 2014 22:51 Manit0u wrote:
Show nested quote +
On September 18 2014 11:36 icystorage wrote:
http://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered


Run into this today:


// for through products
foreach ($products as $product) {
...
}


Cpt. Obvious strikes again.


Looks like something I would have done in my younger years....or 10 months ago. Might even be my code.

I can only play starcraft when I am shit canned. IPXZERG is a god.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
September 19 2014 15:48 GMT
#10389
On September 19 2014 22:51 Manit0u wrote:
Show nested quote +
On September 18 2014 11:36 icystorage wrote:
http://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered


Run into this today:


// for through products
foreach ($products as $product) {
...
}


Cpt. Obvious strikes again.

I see this every day, dozens of times. Loops, method calls, conditionals, always just stating exactly what the code says. Still better than those that state the opposite of what the code does.
If you have a good reason to disagree with the above, please tell me. Thank you.
Shenghi
Profile Joined August 2010
167 Posts
Last Edited: 2014-09-19 15:53:38
September 19 2014 15:53 GMT
#10390
On September 18 2014 11:36 icystorage wrote:
http://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered

Ran into the following today:
User *me; // Actually not me, but you.

Where me represents the currently logged in user.
People are not born stupid, they choose to be stupid. If you made that choice, please change your mind.
icystorage
Profile Blog Joined November 2008
Jollibee19350 Posts
September 19 2014 16:03 GMT
#10391
how come i dont get awesome comments at work
LiquidDota StaffAre you ready for a Miracle-? We are! The International 2017 Champions!
sob3k
Profile Blog Joined August 2009
United States7572 Posts
September 20 2014 05:33 GMT
#10392
CSS/HTML

if I want text red I can do this:

<red>Text</>


red {
color:red;
}



Is this bad? Why? Why can't I do this for everything? why even bother with div class= etc etc
In Hungry Hungry Hippos there are no such constraints—one can constantly attempt to collect marbles with one’s hippo, limited only by one’s hippo-levering capabilities.
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2014-09-20 05:56:50
September 20 2014 05:49 GMT
#10393
1. It's not as modular (html shouldn't contain styling information, that should be in css)
2. You're not following the HTML5 spec (only a limited number of html tags are part of the spec)
There is no one like you in the universe.
bangsholt
Profile Joined June 2011
Denmark138 Posts
September 20 2014 10:04 GMT
#10394
On September 20 2014 14:33 sob3k wrote:
CSS/HTML

if I want text red I can do this:

<red>Text</>


red {
color:red;
}



Is this bad? Why? Why can't I do this for everything? why even bother with div class= etc etc


Go ahead.

Build a whole web site like that, and then try to do a few changes to it.

Then you know why you don't do it like that
Scalepad
Profile Joined July 2010
Sweden366 Posts
Last Edited: 2014-09-20 17:14:52
September 20 2014 17:14 GMT
#10395
Hello. I have a question regarding LaTeX.

Long story short: I have my CV written in LaTeX but I don't know how it or its compilers work. I don't want to not use LaTeX, I just want the code->pdf shit to work. I have installed Miktex 2.9, and when I do the
cmd>dir>cd desktop>xelatex filename (as I've been instructed to do) I get an error. What do I do?

I should add that this has worked before, but I have since formatted my pc.
bangsholt
Profile Joined June 2011
Denmark138 Posts
September 20 2014 21:29 GMT
#10396
On September 21 2014 02:14 Scalepad wrote:
Hello. I have a question regarding LaTeX.

Long story short: I have my CV written in LaTeX but I don't know how it or its compilers work. I don't want to not use LaTeX, I just want the code->pdf shit to work. I have installed Miktex 2.9, and when I do the
cmd>dir>cd desktop>xelatex filename (as I've been instructed to do) I get an error. What do I do?

I should add that this has worked before, but I have since formatted my pc.


Have you tried to read and understand the error message?

It complains that you do not have the font Garamond. So either you can change font or you can install Garamond - which then should solve the problem. If it doesn't, then post again.
Scalepad
Profile Joined July 2010
Sweden366 Posts
September 21 2014 07:57 GMT
#10397
On September 21 2014 06:29 bangsholt wrote:
Show nested quote +
On September 21 2014 02:14 Scalepad wrote:
Hello. I have a question regarding LaTeX.

Long story short: I have my CV written in LaTeX but I don't know how it or its compilers work. I don't want to not use LaTeX, I just want the code->pdf shit to work. I have installed Miktex 2.9, and when I do the
cmd>dir>cd desktop>xelatex filename (as I've been instructed to do) I get an error. What do I do?

I should add that this has worked before, but I have since formatted my pc.


Have you tried to read and understand the error message?

It complains that you do not have the font Garamond. So either you can change font or you can install Garamond - which then should solve the problem. If it doesn't, then post again.

I have installed the font, but it still gives me the same error. Not sure how to go about changing the font.

+ Show Spoiler +
%Font set to Garamand
\setmainfont[Ligatures=TeX]{Garamond}
%Defines the SC-typeface
\newfontinstance\scshape[Letters=SmallCaps, Numbers=Lowercase, Ligatures=TeX]{AGaramond RegularSC}

this is the code in question. I get that you (presumably) change the font at the \setmainfont line, but what do I write in the { } brackets on the \newfontinstance\scshape line?
Blitzkrieg0
Profile Blog Joined August 2010
United States13132 Posts
September 21 2014 14:29 GMT
#10398
On September 21 2014 16:57 Scalepad wrote:
Show nested quote +
On September 21 2014 06:29 bangsholt wrote:
On September 21 2014 02:14 Scalepad wrote:
Hello. I have a question regarding LaTeX.

Long story short: I have my CV written in LaTeX but I don't know how it or its compilers work. I don't want to not use LaTeX, I just want the code->pdf shit to work. I have installed Miktex 2.9, and when I do the
cmd>dir>cd desktop>xelatex filename (as I've been instructed to do) I get an error. What do I do?

I should add that this has worked before, but I have since formatted my pc.


Have you tried to read and understand the error message?

It complains that you do not have the font Garamond. So either you can change font or you can install Garamond - which then should solve the problem. If it doesn't, then post again.

I have installed the font, but it still gives me the same error. Not sure how to go about changing the font.

+ Show Spoiler +
%Font set to Garamand
\setmainfont[Ligatures=TeX]{Garamond}
%Defines the SC-typeface
\newfontinstance\scshape[Letters=SmallCaps, Numbers=Lowercase, Ligatures=TeX]{AGaramond RegularSC}

this is the code in question. I get that you (presumably) change the font at the \setmainfont line, but what do I write in the { } brackets on the \newfontinstance\scshape line?


What did you install exactly? You might need a \usepackage{whatever} in the header to import whatever you just installed.

Another solution is to change the font to something it can actually find. Is there a reason you're using Garamond?
I'll always be your shadow and veil your eyes from states of ain soph aur.
Scalepad
Profile Joined July 2010
Sweden366 Posts
Last Edited: 2014-09-21 18:28:34
September 21 2014 14:46 GMT
#10399
On September 21 2014 23:29 Blitzkrieg0 wrote:
Show nested quote +
On September 21 2014 16:57 Scalepad wrote:
On September 21 2014 06:29 bangsholt wrote:
On September 21 2014 02:14 Scalepad wrote:
Hello. I have a question regarding LaTeX.

Long story short: I have my CV written in LaTeX but I don't know how it or its compilers work. I don't want to not use LaTeX, I just want the code->pdf shit to work. I have installed Miktex 2.9, and when I do the
cmd>dir>cd desktop>xelatex filename (as I've been instructed to do) I get an error. What do I do?

I should add that this has worked before, but I have since formatted my pc.


Have you tried to read and understand the error message?

It complains that you do not have the font Garamond. So either you can change font or you can install Garamond - which then should solve the problem. If it doesn't, then post again.

I have installed the font, but it still gives me the same error. Not sure how to go about changing the font.

+ Show Spoiler +
%Font set to Garamand
\setmainfont[Ligatures=TeX]{Garamond}
%Defines the SC-typeface
\newfontinstance\scshape[Letters=SmallCaps, Numbers=Lowercase, Ligatures=TeX]{AGaramond RegularSC}

this is the code in question. I get that you (presumably) change the font at the \setmainfont line, but what do I write in the { } brackets on the \newfontinstance\scshape line?


What did you install exactly? You might need a \usepackage{whatever} in the header to import whatever you just installed.

Another solution is to change the font to something it can actually find. Is there a reason you're using Garamond?

edit: Never mind, I solved the issue. :DDDDD
Zocat
Profile Joined April 2010
Germany2229 Posts
Last Edited: 2014-09-21 20:50:47
September 21 2014 20:48 GMT
#10400
On September 21 2014 23:46 Scalepad wrote:
Show nested quote +
On September 21 2014 23:29 Blitzkrieg0 wrote:
On September 21 2014 16:57 Scalepad wrote:
On September 21 2014 06:29 bangsholt wrote:
On September 21 2014 02:14 Scalepad wrote:
Hello. I have a question regarding LaTeX.

Long story short: I have my CV written in LaTeX but I don't know how it or its compilers work. I don't want to not use LaTeX, I just want the code->pdf shit to work. I have installed Miktex 2.9, and when I do the
cmd>dir>cd desktop>xelatex filename (as I've been instructed to do) I get an error. What do I do?

I should add that this has worked before, but I have since formatted my pc.


Have you tried to read and understand the error message?

It complains that you do not have the font Garamond. So either you can change font or you can install Garamond - which then should solve the problem. If it doesn't, then post again.

I have installed the font, but it still gives me the same error. Not sure how to go about changing the font.

+ Show Spoiler +
%Font set to Garamand
\setmainfont[Ligatures=TeX]{Garamond}
%Defines the SC-typeface
\newfontinstance\scshape[Letters=SmallCaps, Numbers=Lowercase, Ligatures=TeX]{AGaramond RegularSC}

this is the code in question. I get that you (presumably) change the font at the \setmainfont line, but what do I write in the { } brackets on the \newfontinstance\scshape line?


What did you install exactly? You might need a \usepackage{whatever} in the header to import whatever you just installed.

Another solution is to change the font to something it can actually find. Is there a reason you're using Garamond?

edit: Never mind, I solved the issue. :DDDDD


How?


Edit: To clarify; I don't really care too much, since I don't have the problem. Chances are though that some years down the line some random guy on the internet will have the same problem. He googles around and finds this thread "Oh, great someone has found the answer to my problem, but didn't post how to fix it".

Whenever you post a question online and somehow find the answer; please say how you fixed a problem. Some future human will be thankful for that.
Prev 1 518 519 520 521 522 1032 Next
Please log in or register to reply.
Live Events Refresh
Replay Cast
00:00
WardiTV Mondays #62
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SortOf 111
-ZergGirl 64
StarCraft: Brood War
Tasteless 254
Sacsri 73
Pusan 67
Shine 64
Bale 34
Dewaltoss 33
ZergMaN 32
Sharp 13
Dota 2
febbydoto212
NeuroSwarm123
canceldota30
League of Legends
JimRising 549
Reynor60
Super Smash Bros
Westballz13
Other Games
summit1g10930
WinterStarcraft550
crisheroes301
C9.Mang0293
Mew2King38
Organizations
Other Games
gamesdonequick578
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 12 non-featured ]
StarCraft 2
• Berry_CruncH189
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Lourlo1155
Upcoming Events
The PondCast
2h 3m
OSC
8h 3m
Demi vs Mixu
Nicoract vs TBD
Babymarine vs MindelVK
ForJumy vs TBD
Shameless vs Percival
Replay Cast
16h 3m
Korean StarCraft League
1d 19h
CranKy Ducklings
2 days
WardiTV 2025
2 days
SC Evo League
2 days
BSL 21
2 days
Sziky vs OyAji
Gypsy vs eOnzErG
OSC
2 days
Solar vs Creator
ByuN vs Gerald
Percival vs Babymarine
Moja vs Krystianer
EnDerr vs ForJumy
sebesdes vs Nicoract
Sparkling Tuna Cup
3 days
[ Show More ]
WardiTV 2025
3 days
OSC
3 days
BSL 21
3 days
Bonyth vs StRyKeR
Tarson vs Dandy
Replay Cast
4 days
Wardi Open
4 days
StarCraft2.fi
4 days
Monday Night Weeklies
4 days
Replay Cast
4 days
WardiTV 2025
5 days
StarCraft2.fi
5 days
PiGosaur Monday
5 days
StarCraft2.fi
6 days
Tenacious Turtle Tussle
6 days
Liquipedia Results

Completed

Proleague 2025-11-30
RSL Revival: Season 3
Light HT

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
CSCL: Masked Kings S3
Slon Tour Season 2
Acropolis #4 - TS3
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
StarSeries Fall 2025
FISSURE Playground #2

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
Kuram Kup
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.