what a dream it would be to work with gcc.
The Big Programming Thread - Page 945
Forum Index > General Forum |
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
Norway4003 Posts
what a dream it would be to work with gcc. | ||
spinesheath
Germany8679 Posts
| ||
sabas123
Netherlands3121 Posts
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. | ||
spinesheath
Germany8679 Posts
Also intel's performance analysis tools were awesome. | ||
enigmaticcam
United States280 Posts
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
Canada6160 Posts
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
United States280 Posts
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
Hyrule18780 Posts
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) | ||
Lmui
Canada6160 Posts
On February 15 2018 07:33 enigmaticcam wrote: 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
Spain17192 Posts
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
Norway7690 Posts
On February 15 2018 07:42 Acrofales wrote: 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
United States280 Posts
| ||
Acrofales
Spain17192 Posts
On February 15 2018 07:50 Excludos wrote: 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:
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
Spain17192 Posts
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
United States280 Posts
| ||
phar
United States1080 Posts
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. | ||
nunez
Norway4003 Posts
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). | ||
ShoCkeyy
7815 Posts
| ||
Manit0u
Poland17051 Posts
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. | ||
Excludos
Norway7690 Posts
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. | ||
| ||