• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 04:02
CEST 10:02
KST 17:02
  • 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
[ASL22] Ro16 Preview: Rough Waters10[ASL22] Ro24 Preview: Siren's Call8[ASL22] Ro24 Preview: Summer's End9Serral wins HomeStory Cup 2915Serral wins Maestros of the Game 244
Community News
StarCraft open world shooter announced at BlizzCon56Weekly Cups (Aug 30-Sep 7): herO thrives amid growing schism10Official StarCraft website teases new content ahead of BlizzCon?166Stellar Fest TWO the Moon (Dec 16-20)9Weekly Cups (August 24-30): Patches' balance mod takes over3
StarCraft 2
General
StarCraft open world shooter announced at BlizzCon How do you feel about the StarCraft shooter announcement at BlizzCon 2026? Balance hotfix patch 5.0.16b (July 16) Team Liquid Map Contest #22: Results and Winners Weekly Cups (Aug 30-Sep 7): herO thrives amid growing schism
Tourneys
RSL goes to London! 2026 Offline Finals Nov 21-22 KSL Week #92 IntoTheTV X SOOP SC2 League : Weekly & Monthly 2026 GSTL Announcement Sparkling Tuna Cup - Weekly Open Tournament
Strategy
[G] Having the right mentality to improve
Custom Maps
Nexus Wars 2021 GUIDE [M] (2) Industrial Park
External Content
Mutation # 542 The Ascended Mutation # 541 Binary Choice The PondCast: SC2 News & Results Mutation # 540 Dodge This
Brood War
General
Official StarCraft website teases new content ahead of BlizzCon? BGH Auto Balance -> http://bghmmr.eu/ Broodwar Prediction Market Practice Partners (Official) [D] Brainstorming a balance patch for Brood war
Tourneys
[ASL22] Ro16 Group B [ASL22] Ro16 Group A Escore Tournament - Season 3 Small VOD Thread 2.0
Strategy
Replay Review Process - What do you do? Simple Questions, Simple Answers Odyssey Mineral Stack Saturation Game Theory for Starcraft
Other Games
General Games
Diablo IV EVE Corporation Nintendo Switch Thread [Maplestory Hardcore] Let's Play~!! General RTS Discussion Thread
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
[TL LoL EUW IHs] Teemo shall perish TSM pausing esports and CLG Dead
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Community Thread
Community
General
US Politics Mega-thread Trading/Investing Thread UK Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread
Fan Clubs
MarineLorD Fan Club The Creator Fan Club The ShoWTimE Fan Club
Media & Entertainment
Diablo Animated Series on Netflix Movie Discussion!
Sports
Football (Soccer) Thread TeamLiquid Health and Fitness Initiative For 2023 MLB/Baseball 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Northern Ireland Global Starcraft
Blogs
Virtual Romance, Real-Life C…
TrAiDoS
Regacy Esports:Our Goa…
regacyesports
Dreaming of BW patches (mod…
c3rberUs
LOCKPICKING NOOB
LUCKY_NOOB
Customize Sidebar...

Website Feedback

Closed Threads



Active: 6397 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
Poland17843 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
Next event in 1h 58m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Trap 9
StarCraft: Brood War
Shuttle 6028
actioN 381
910 85
Aegong 59
yabsab 23
Dota 2
ODPixel419
XcaliburYe253
Counter-Strike
byalli309
Other Games
summit1g15129
mouzStarbuck313
KnowMe173
Dewaltoss36
Organizations
Other Games
BasetradeTV236
StarCraft: Brood War
UltimateBattle 18
[ Show 11 non-featured ]
StarCraft 2
• Berry_CruncH368
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Migwel
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota2195
League of Legends
• Jankos1929
Upcoming Events
Sparkling Tuna Cup
1h 58m
WardiTV Invitational
2h 58m
ByuN vs Percival
Cure vs Classic
Shopify Rebellion Sundays
6h 58m
Spirit vs Mixu
Clem vs TBD
RSL Revival
7h 58m
Serral vs Rogue
BlizzCon
10h 28m
IdrA vs MC
Replay Cast
15h 58m
Afreeca Starleague
1d 1h
Light vs JyJ
Soulkey vs hero
WardiTV Weekly
1d 2h
Monday Night Weeklies
1d 7h
Afreeca Starleague
2 days
Snow vs Shinee
Shine vs EffOrt
[ Show More ]
GSL
2 days
PiGosaur Cup
2 days
The PondCast
3 days
Kung Fu Cup
3 days
Replay Cast
3 days
KCM Race Survival
4 days
IntoTheTV X SOOP
4 days
Replay Cast
4 days
IntoTheTV X SOOP
5 days
Replay Cast
5 days
GSL
6 days
Replay Cast
6 days
Liquipedia Results

Completed

Acropolis #5 - TRS
PiG Sty Festival 8.0
Big Dog Cup 2026 Div 1

Ongoing

KCM Race Survival 2026 Season 3
K-JUNGMAN
ASL Season 22
Super Anchor Qualifying S3
CSL 2026 AUTUMN (S22)
Acropolis #5
Blizzard Classic Cup 2026
Blizzard Classic Cup 2026
RSL Revival: Season 6
Calamity Invitational
FISSURE Playground #3
BLAST Open Fall 2026
Esports World Cup 2026
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026

Upcoming

Acropolis #5 - GSA
Acropolis #5 - GSB
Acropolis #5 - GSC
SC4ALL II: Brood War
HSC XXX
Stellar Fest 2: Lunar Cup
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
RSL Offline Finals
PGL Major Singapore 2026
Stake Ranked Episode 6
BLAST Rivals Fall 2026
IEM Beijing 2026
Stake Ranked Episode 5
PGL Masters Bucharest 2026
1win Private Club #2
Thunderpick World Champ. '26
ESL Pro League Season 24
Stake Ranked Episode 4
1win Private Club #1
Logitech G Play Connect 2026
SL StarSeries Fall 2026
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 © 2026 TLnet. All Rights Reserved.