• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 14:03
CET 20:03
KST 04:03
  • 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 Revival - 2025 Season Finals Preview8RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12
Community News
Weekly Cups (Jan 5-11): Clem wins big offline, Trigger upsets0$21,000 Rongyi Cup Season 3 announced (Jan 22-Feb 7)12Weekly Cups (Dec 29-Jan 4): Protoss rolls, 2v2 returns7[BSL21] Non-Korean Championship - Starts Jan 103SC2 All-Star Invitational: Jan 17-1822
StarCraft 2
General
When will we find out if there are more tournament SC2 Spotted on the EWC 2026 list? Weekly Cups (Jan 5-11): Clem wins big offline, Trigger upsets Weekly Cups (Dec 29-Jan 4): Protoss rolls, 2v2 returns Spontaneous hotkey change zerg
Tourneys
$25,000 Streamerzone StarCraft Pro Series announced $21,000 Rongyi Cup Season 3 announced (Jan 22-Feb 7) WardiTV Winter Cup WardiTV Mondays SC2 AI Tournament 2026
Strategy
Simple Questions Simple Answers
Custom Maps
Map Editor closed ?
External Content
Mutation # 508 Violent Night Mutation # 507 Well Trained Mutation # 506 Warp Zone Mutation # 505 Rise From Ashes
Brood War
General
[ASL21] Potential Map Candidates Potential ASL qualifier breakthroughs? A cwal.gg Extension - Easily keep track of anyone BGH Auto Balance -> http://bghmmr.eu/ BW General Discussion
Tourneys
[Megathread] Daily Proleagues [BSL21] Grand Finals - Sunday 21:00 CET [BSL21] Non-Korean Championship - Starts Jan 10 SLON Grand Finals – Season 2
Strategy
Game Theory for Starcraft Simple Questions, Simple Answers Current Meta [G] How to get started on ladder as a new Z player
Other Games
General Games
Beyond All Reason Nintendo Switch Thread Awesome Games Done Quick 2026! Mechabellum Stormgate/Frost Giant Megathread
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
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread European Politico-economics QA Mega-thread Trading/Investing Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread
Sports
2024 - 2026 Football Thread
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List TL+ Announced
Blogs
My 2025 Magic: The Gathering…
DARKING
Physical Exercise (HIIT) Bef…
TrAiDoS
Life Update and thoughts.
FuDDx
How do archons sleep?
8882
James Bond movies ranking - pa…
Topin
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1191 users

The Big Programming Thread - Page 945

Forum Index > General Forum
Post a Reply
Prev 1 943 944 945 946 947 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.
nunez
Profile Blog Joined February 2011
Norway4003 Posts
February 12 2018 17:59 GMT
#18881
microsofts c++ compiler gives me so much grief.
what a dream it would be to work with gcc.
conspired against by a confederacy of dunces.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
February 13 2018 17:09 GMT
#18882
No mention of intel c++? It's been a while, but damn, that difference in performance back then...
If you have a good reason to disagree with the above, please tell me. Thank you.
sabas123
Profile Blog Joined December 2010
Netherlands3122 Posts
February 13 2018 19:18 GMT
#18883
On February 14 2018 02:09 spinesheath wrote:
No mention of intel c++? It's been a while, but damn, that difference in performance back then...

Has anybody here ever worked with an intel compiler? I know they generate faster binaries, however never heard how they compare with regards to other aspects like error handling.
The harder it becomes, the more you should focus on the basics.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
Last Edited: 2018-02-14 17:33:37
February 14 2018 17:32 GMT
#18884
I compared performance of ms, gcc and intel compiled code for a molecular dynamics simulation as part of my bachelor's thesis. The software ran on the lrz cluster in munich. Obviously I wasn't very concerned with other aspects, but for performance, it was a rather clear intel > ms > gcc.

Also intel's performance analysis tools were awesome.
If you have a good reason to disagree with the above, please tell me. Thank you.
enigmaticcam
Profile Blog Joined October 2010
United States280 Posts
Last Edited: 2018-02-14 22:08:17
February 14 2018 21:42 GMT
#18885
jQuery question. Does anyone know why this doesn't work? fiddle

I have multiple scripts (in the example, just one) from which I will pick one and insert its content into a div. Inside those scripts are buttons with classes that I want to attach on-click events. However, they don't work. In the example, if you click "Insert", it will insert the content from the script to the div. Then you can see that clearly the inserted button will not have a click event attached, yet the standard button does. It also doesn't work if you use a hidden div instead of a script tag.

Any help would be greatly appreciated!
Lmui
Profile Joined November 2010
Canada6220 Posts
Last Edited: 2018-02-14 22:24:44
February 14 2018 22:22 GMT
#18886
On February 15 2018 06:42 enigmaticcam wrote:
jQuery question. Does anyone know why this doesn't work? fiddle

I have multiple scripts (in the example, just one) from which I will pick one and insert its content into a div. Inside those scripts are buttons with classes that I want to attach on-click events. However, they don't work. In the example, if you click "Insert", it will insert the content from the script to the div. Then you can see that clearly the inserted button will not have a click event attached, yet the standard button does. It also doesn't work if you use a hidden div instead of a script tag.

Any help would be greatly appreciated!


Open up the Chrome console when you click it - it shows this:

Uncaught SyntaxError: Unexpected token < .(index):67

The issue is with the apostrophe in "Doesn't"

Remove the apostrophe and it works (or escape it).

edit:: Nvm - still syntax errors
enigmaticcam
Profile Blog Joined October 2010
United States280 Posts
February 14 2018 22:33 GMT
#18887
On February 15 2018 07:22 Lmui wrote:

Open up the Chrome console when you click it - it shows this:

Uncaught SyntaxError: Unexpected token < .(index):67

The issue is with the apostrophe in "Doesn't"

Remove the apostrophe and it works (or escape it).

edit:: Nvm - still syntax errors

I'm using chrome and don't get any syntax errors. I tried removing the apostrophe, and still no luck.
tofucake
Profile Blog Joined October 2009
Hyrule19188 Posts
Last Edited: 2018-02-14 22:44:24
February 14 2018 22:37 GMT
#18888
https://jsfiddle.net/dnz5kc6c/29/

using .on like that only works for elements on the page at load. You have to do
$(document).on('click', 'selector', function() {});
to attach events to inserted elements

jquery changed from an old way of doing things to new in 1.7 and basically just overloaded .on to do 3 separate things depending on arguments.

see http://api.jquery.com/bind/ (what you were doing) vs http://api.jquery.com/delegate/ (what you needed to be doing)
Liquipediaasante sana squash banana
Lmui
Profile Joined November 2010
Canada6220 Posts
February 14 2018 22:40 GMT
#18889
On February 15 2018 07:33 enigmaticcam wrote:
Show nested quote +
On February 15 2018 07:22 Lmui wrote:

Open up the Chrome console when you click it - it shows this:

Uncaught SyntaxError: Unexpected token < .(index):67

The issue is with the apostrophe in "Doesn't"

Remove the apostrophe and it works (or escape it).

edit:: Nvm - still syntax errors

I'm using chrome and don't get any syntax errors. I tried removing the apostrophe, and still no luck.


From Chrome -> F12, there's a tab called "Event Listeners"

The new button doesn't have the onclick event listener associated.

https://stackoverflow.com/questions/21968922/how-to-add-script-to-a-button-in-html-in-same-file

Found this - I guess you need to add the on-click event to the new button.
Acrofales
Profile Joined August 2010
Spain18180 Posts
February 14 2018 22:42 GMT
#18890
On February 15 2018 06:42 enigmaticcam wrote:
jQuery question. Does anyone know why this doesn't work? fiddle

I have multiple scripts (in the example, just one) from which I will pick one and insert its content into a div. Inside those scripts are buttons with classes that I want to attach on-click events. However, they don't work. In the example, if you click "Insert", it will insert the content from the script to the div. Then you can see that clearly the inserted button will not have a click event attached, yet the standard button does. It also doesn't work if you use a hidden div instead of a script tag.

Any help would be greatly appreciated!

Your button is between script tags, for starters.

Easiest way of doing this is setting it to display:none at the start and then toggling it in your javascript.

But the syntax error is because your button is inside the script tags. And the button is html, not javascript.
Excludos
Profile Blog Joined April 2010
Norway8230 Posts
February 14 2018 22:50 GMT
#18891
On February 15 2018 07:42 Acrofales wrote:
Show nested quote +
On February 15 2018 06:42 enigmaticcam wrote:
jQuery question. Does anyone know why this doesn't work? fiddle

I have multiple scripts (in the example, just one) from which I will pick one and insert its content into a div. Inside those scripts are buttons with classes that I want to attach on-click events. However, they don't work. In the example, if you click "Insert", it will insert the content from the script to the div. Then you can see that clearly the inserted button will not have a click event attached, yet the standard button does. It also doesn't work if you use a hidden div instead of a script tag.

Any help would be greatly appreciated!

Your button is between script tags, for starters.

Easiest way of doing this is setting it to display:none at the start and then toggling it in your javascript.

But the syntax error is because your button is inside the script tags. And the button is html, not javascript.


That doesn't matter. Html inserts from script is fine. What does matter, however, is what tofucake pointed out. Button isn't initiated from start, and thus the onclick in its current form won't work.

Generally tho, inserting elements after the fact isn't a good practice to begin with. If possible you want to load everything at start, and show/hide. Obviously doesn't matter much for just a single button, but loading in elements after the fact makes for a slower page and bad user experience.
enigmaticcam
Profile Blog Joined October 2010
United States280 Posts
February 14 2018 23:00 GMT
#18892
I had a div that I wanted to show one of several different things depending on what the user clicks. Initially I thought I could just put each individual thing in a separate script and insert it into the div. But perhaps it would be better to have them all as hidden divs inside the parent div, and just show/hide what I need?
Acrofales
Profile Joined August 2010
Spain18180 Posts
Last Edited: 2018-02-14 23:19:39
February 14 2018 23:19 GMT
#18893
On February 15 2018 07:50 Excludos wrote:
Show nested quote +
On February 15 2018 07:42 Acrofales wrote:
On February 15 2018 06:42 enigmaticcam wrote:
jQuery question. Does anyone know why this doesn't work? fiddle

I have multiple scripts (in the example, just one) from which I will pick one and insert its content into a div. Inside those scripts are buttons with classes that I want to attach on-click events. However, they don't work. In the example, if you click "Insert", it will insert the content from the script to the div. Then you can see that clearly the inserted button will not have a click event attached, yet the standard button does. It also doesn't work if you use a hidden div instead of a script tag.

Any help would be greatly appreciated!

Your button is between script tags, for starters.

Easiest way of doing this is setting it to display:none at the start and then toggling it in your javascript.

But the syntax error is because your button is inside the script tags. And the button is html, not javascript.


That doesn't matter. Html inserts from script is fine. What does matter, however, is what tofucake pointed out. Button isn't initiated from start, and thus the onclick in its current form won't work.

Generally tho, inserting elements after the fact isn't a good practice to begin with. If possible you want to load everything at start, and show/hide. Obviously doesn't matter much for just a single button, but loading in elements after the fact makes for a slower page and bad user experience.

I was referring to this bit:

<script id="MenuOption1" type="text/javascript">
<button type="button" class="MyButton">Doesn't Work</button>
</script>


That doesn't insert a button. That just gives a syntax error. Of course you *can* insert a button with javascript, but that's not how you do it. Other than that, we're in agreement.
Acrofales
Profile Joined August 2010
Spain18180 Posts
February 15 2018 00:11 GMT
#18894
On February 15 2018 08:00 enigmaticcam wrote:
I had a div that I wanted to show one of several different things depending on what the user clicks. Initially I thought I could just put each individual thing in a separate script and insert it into the div. But perhaps it would be better to have them all as hidden divs inside the parent div, and just show/hide what I need?

Probably, yes. Or maybe you want to divide your page up into different parts, which you can then load with Ajax, depending on what the user wants to see. Without it being a lot clearer what you're trying to achieve, we can't really help you.

In general, though, if we're not talking about loading content dynamically, it's better to show/hide elements than to insert them at runtime. Moreover, it allows you to associate all your onClick actions all at once when the page is loaded, rather than having to add those at runtime, which is (1) fucking ugly coding, and (2) slow.
enigmaticcam
Profile Blog Joined October 2010
United States280 Posts
February 15 2018 00:18 GMT
#18895
Okay, thank you. I've always steered away from javascript as much as I can, but I've decided to try to use it more for better performance for the user. So I'm kind of stumbling my way through it as I figure out what I'm doing. I was able to get it to work using your suggestion by hiding the divs and only showing the one currently selected. Appreciate the help, everyone!
phar
Profile Joined August 2011
United States1080 Posts
Last Edited: 2018-02-15 02:18:41
February 15 2018 02:11 GMT
#18896
On February 15 2018 02:32 spinesheath wrote:
I compared performance of ms, gcc and intel compiled code for a molecular dynamics simulation as part of my bachelor's thesis. The software ran on the lrz cluster in munich. Obviously I wasn't very concerned with other aspects, but for performance, it was a rather clear intel > ms > gcc.

Also intel's performance analysis tools were awesome.

Today I would take llvm clang over gcc. Way faster, and much nicer for analysis tools on account of not completely fucking with the AST.

I think, though I haven't checked recently, that clang is also faster than icc now.
Who after all is today speaking about the destruction of the Armenians?
nunez
Profile Blog Joined February 2011
Norway4003 Posts
Last Edited: 2018-02-15 10:47:26
February 15 2018 10:33 GMT
#18897
2017 end of year test at phoronix shows gcc producing generally faster binaries than clang, but compiling slightly slower. i would like to see the compilation of some larger project though, like chromium or firefox (those were the ones that took the longest to compile when i was running gentoo). compilation time is medium important, but the test doesn't show a severe difference, and in practice i have seen long compilation times be mostly a result of code structure (library includes, dependencies, project structure (one binary vs ten binaries), template instantiations, project settings) and bad IDE habits.

in terms of feature completeness they are also quite close. since gcc already has concepts it is an easy choice (disregarding context) for me, and probably for any other advanced c++ programmer who uses template meta-programming. i don't know what 'analysis tools' you're talking about, but the *grinds does not work with the AST. maybe syntax and aesthetics? that is not a big concern for me and my regexi. i only have a tiny familiarity in working with the AST's of both, but i don't think i found any of them daunting.

my grief with the microsoft compiler has been crashing and bad error reporting, stone-age level in terms development of the language (relative to gcc / clang), slowness of bugfixing. they are supposed to be getting better and i am optimistic, it's not as awful as it used to be a one / two years ago.

i remember one of their updates breaking alias templates (std::enable_if_t<T> vs typename std::enable_if<T>::type), with the compiler all of a sudden just dying mid-compilation with the diagnostic 'compiler crashed'. i had to use the elimination method on the entire project to find out what was causing the error.

i also remember how when a typename gets "too long" and is mangled, if the compiler got a linker error involving this symbol, it would print some garbled numbers and letters instead of the symbol-name, inviting you to play the guessing game.

this will take a long time to forget, but getting std::variant will help (boost::variant is stone-age at compile-time, but fast at run-time).
conspired against by a confederacy of dunces.
ShoCkeyy
Profile Blog Joined July 2008
7815 Posts
February 15 2018 20:23 GMT
#18898
Anybody that works with Angular2 can you PM me? I need help with a dialog :/
Life?
Manit0u
Profile Blog Joined August 2004
Poland17596 Posts
February 16 2018 09:43 GMT
#18899
Fun fact: if you send this sequence of chars

U+0C1C U+0C4D U+0C1E U+200C U+0C3E

to any user using OSX/iOS it will crash the app that tried to display it (sometimes even creating the loop of death). Twitter, GMail, WhatsApp, Outlook, trying to display it in Safari etc.

There's a problem with parsing some unicode in Apple products.
Time is precious. Waste it wisely.
Excludos
Profile Blog Joined April 2010
Norway8230 Posts
Last Edited: 2018-02-16 10:22:08
February 16 2018 10:20 GMT
#18900
I'm not sure if this is the right place to vent, but maybe you could take it as a cautionary tale of why you should ALWAYS ALWAYS ALWAYS make your program modular.

So the place I work at is a bit weird in that we don't have proper project leaders. So I was told a month ago to start working on something, and have been hammering on the keyboard since then.

Then, quite randomly, I'm told that someone else have been told to work on the exact same thing. I go talk to him, and by a random stroke of luck, we've each completed different parts of the project, so together we actually have a working product. All I need to do now is merge my code into his. I take a look at it, and it's a fucking disaster! Everything is ingrained into itself. I can't change a single variable without ruining something in a completely different class. I have been struggling for hours and literally can not find a single way to use any of my code into his or vice versa. He's also completely forgotten to take into account how the user is suppose to interact with his system.

At this rate, I'm not sure what is faster: Continue struggling with this merge or just throw out his part of the code completely. I'm fucking pissed.
Prev 1 943 944 945 946 947 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 5h 57m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
UpATreeSC 303
JuggernautJason142
White-Ra 122
BRAT_OK 121
SC2Nice 43
MindelVK 34
StarCraft: Brood War
Shuttle 413
firebathero 138
Mong 113
Dewaltoss 98
scan(afreeca) 19
Dota 2
qojqva4099
Counter-Strike
FalleN 826
Heroes of the Storm
Liquid`Hasu464
Other Games
Grubby4567
Gorgc2931
Liquid`RaSZi2156
B2W.Neo1619
FrodaN923
Beastyqt643
ceh9473
Fuzer 326
ArmadaUGS275
DeMusliM243
QueenE127
mouzStarbuck48
Mew2King35
Organizations
Other Games
gamesdonequick3446
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 18 non-featured ]
StarCraft 2
• StrangeGG 65
• IndyKCrew
• sooper7s
• AfreecaTV YouTube
• Migwel
• intothetv
• LaughNgamezSOOP
• Kozan
StarCraft: Brood War
• HerbMon 28
• FirePhoenix10
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• WagamamaTV537
League of Legends
• Nemesis3001
• TFBlade1115
• Shiphtur517
Other Games
• imaqtpie1439
Upcoming Events
PiGosaur Cup
5h 57m
WardiTV Invitational
16h 57m
The PondCast
1d 14h
OSC
1d 16h
OSC
2 days
All Star Teams
3 days
INnoVation vs soO
sOs vs Scarlett
uThermal 2v2 Circuit
3 days
All Star Teams
4 days
MMA vs DongRaeGu
Rogue vs Oliveira
Sparkling Tuna Cup
4 days
OSC
4 days
[ Show More ]
Replay Cast
5 days
Wardi Open
5 days
Liquipedia Results

Completed

Proleague 2026-01-12
Big Gabe Cup #3
NA Kuram Kup

Ongoing

C-Race Season 1
IPSL Winter 2025-26
BSL 21 Non-Korean Championship
CSL 2025 WINTER (S19)
OSC Championship Season 13
Underdog Cup #3
BLAST Bounty Winter Qual
eXTREMESLAND 2025
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025

Upcoming

Escore Tournament S1: W4
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Rongyi Cup S3
Thunderfire SC2 All-star 2025
Nations Cup 2026
BLAST Open Spring 2026
ESL Pro League Season 23
ESL Pro League Season 23
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 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.