• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 03:29
CEST 09:29
KST 16:29
  • 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
Code S Season 1 - RO8 Preview6[ASL21] Ro8 Preview Pt2: Progenitors8Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun13[ASL21] Ro8 Preview Pt1: Inheritors16[ASL21] Ro16 Preview Pt2: All Star10
Community News
Maestros of The Game 2 announcement and schedule !7Weekly Cups (April 27-May 4): Clem takes triple0RSL Revival: Season 5 - Qualifiers and Main Event12Code S Season 1 (2026) - RO12 Results12026 GSL Season 1 Qualifiers25
StarCraft 2
General
Code S Season 1 - RO8 Preview Behind the Blue - Team Liquid History Book Weekly Cups (April 27-May 4): Clem takes triple Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool Code S Season 1 (2026) - RO12 Results
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament Sea Duckling Open (Global, Bronze-Diamond) Maestros of The Game 2 announcement and schedule ! GSL Code S Season 1 (2026) RSL Revival: Season 5 - Qualifiers and Main Event
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players
External Content
Mutation # 524 Death and Taxes The PondCast: SC2 News & Results Mutation # 523 Firewall Mutation # 522 Flip My Base
Brood War
General
Quality of life changes in BW that you will like ? Why there arent any 256x256 pro maps? BGH Auto Balance -> http://bghmmr.eu/ RepMastered™: replay sharing and analyzer site Tulbo's ASL S21 Ro8 Post-Review
Tourneys
[ASL21] Ro8 Day 4 [ASL21] Ro8 Day 3 Escore Tournament StarCraft Season 2 [Megathread] Daily Proleagues
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates What's the deal with APM & what's its true value Any training maps people recommend?
Other Games
General Games
Path of Exile Stormgate/Frost Giant Megathread Nintendo Switch Thread Daigo vs Menard Best of 10 OutLive 25 (RTS Game)
Dota 2
The Story of Wings Gaming
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
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
US Politics Mega-thread The Letting Off Steam Thread European Politico-economics QA Mega-thread UK Politics Mega-thread Canadian Politics Mega-thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [Req][Books] Good Fantasy/SciFi books
Sports
2024 - 2026 Football Thread McBoner: A hockey love story Formula 1 Discussion
World Cup 2022
Tech Support
streaming software Strange computer issues (software) [G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
How EEG Data Can Predict Gam…
TrAiDoS
ramps on octagon
StaticNine
Funny Nicknames
LUCKY_NOOB
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1445 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
Poland17743 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 2h 31m
[ Submit Event ]
Live Streams
Refresh
StarCraft: Brood War
Britney 33679
GuemChi 2715
JulyZerg 87
Shinee 74
Movie 56
zelot 37
yabsab 35
Mind 26
Bale 14
Shine 6
Dota 2
monkeys_forever263
NeuroSwarm149
League of Legends
JimRising 675
Counter-Strike
Stewie2K965
Other Games
summit1g11636
WinterStarcraft501
amsayoshi61
Organizations
Counter-Strike
PGL23125
Other Games
gamesdonequick2405
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 14 non-featured ]
StarCraft 2
• Berry_CruncH197
• Sammyuel 31
• LUISG 8
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Stunt580
Upcoming Events
Sparkling Tuna Cup
2h 31m
RSL Revival
2h 31m
Cure vs Zoun
Clem vs Lambo
WardiTV Invitational
4h 31m
ByuN vs Rogue
Solar vs Ryung
Zoun vs Percival
Cure vs SHIN
BSL
11h 31m
Dewalt vs DragOn
Aether vs Jimin
GSL
1d
Afreeca Starleague
1d 2h
Soma vs Leta
Wardi Open
1d 4h
Monday Night Weeklies
1d 8h
OSC
1d 16h
CranKy Ducklings
2 days
[ Show More ]
Afreeca Starleague
2 days
Light vs Flash
Replay Cast
3 days
Replay Cast
3 days
The PondCast
4 days
Replay Cast
4 days
RSL Revival
5 days
Korean StarCraft League
5 days
RSL Revival
6 days
BSL
6 days
Liquipedia Results

Completed

Escore Tournament S2: W6
WardiTV TLMC #16
Nations Cup 2026

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
Acropolis #4
KK 2v2 League Season 1
BSL 22 Non-Korean Championship
SCTL 2026 Spring
RSL Revival: Season 5
2026 GSL S1
PGL Astana 2026
BLAST Rivals Spring 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2

Upcoming

YSL S3
Escore Tournament S2: W7
Escore Tournament S2: W8
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
Maestros of the Game 2
2026 GSL S2
BLAST Bounty Summer 2026: Closed Qualifier
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 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.