|
KARMA! posted:Why would a toString on a function even work? Because Javascript.
|
# ? Jul 12, 2014 18:46 |
|
|
# ? May 21, 2024 00:20 |
|
Internet Janitor posted:eithedog: The readme does address this. A line continuation using \ will not insert newlines automatically when you continue the string on another line. You'd need \n\. Oh, sorry, didn't read the comments, I've read the code you posted. Are there any situations when manipulating HTML actually needs \n? It works because the functions source actually contains the comments and you can access the functions code, per: code:
canis minor fucked around with this message at 19:24 on Jul 12, 2014 |
# ? Jul 12, 2014 18:58 |
|
KARMA! posted:Why would a toString on a function even work? I tried making it not work at one point, and it broke a bunch of sites including eBay that were decompiling, manipulating the source, and then recompiling the function. Opera used to have a ton of web compat issues because they didn't produce legal source (it was a parse error, something like "function () { [ecmascript source] }"). IIRC ES3 required that it at least parse. I think prototype and jQuery also used decompilation, one of them in order to recompile in the context of another frame. eithedog posted:Oh, sorry, didn't read the comments, I've read the code you posted. Are there any situations when manipulating HTML actually needs \n? You need whitespace at least. JavaScript code:
gives you <ahref='about :blank'>, which isn't what you want. Subjunctive fucked around with this message at 04:16 on Jul 13, 2014 |
# ? Jul 13, 2014 04:10 |
|
5.1 at least requires it to be a valid FunctionDeclaration, but it doesn't say anything explicit about it being semantically equivalent to the original ;-) (I suppose stuff like function() { [native code] } is justifiable by host functions having an own [[DefaultValue]] for hint=String?) Expecting comments to be retained is sort of extra unreasonable in my book since it means you pretty much have to keep pointers into source code around even if your IR is something like an AST that's high-level enough to reconstruct from. I am probably horror-level paranoid about memory usage in high-count data structures, though.
|
# ? Jul 13, 2014 05:15 |
|
Subjunctive posted:I think prototype and jQuery also used decompilation, one of them in order to recompile in the context of another frame. Isn't this the sort of situation bind() is meant for, or am I misunderstanding the issue?
|
# ? Jul 13, 2014 05:41 |
|
Internet Janitor posted:Isn't this the sort of situation bind() is meant for, or am I misunderstanding the issue? "Different frame" as in, an iframe or whatever. In terms of memory use, it's a pointer and a length per function-statement (not per function instance), which you can stick out of the critical path (e.g. off in the AST which is only looked at if you need line numbers for a stack-trace or need to recompile because your optimistic optimizations were invalidated) to use the function declaration as it's written in the source. This seems way easier than decompiling your AST into semantically equivalent code every time.
|
# ? Jul 13, 2014 08:08 |
|
Jabor posted:"Different frame" as in, an iframe or whatever. It is easier, but also requires you to preserve eval source and pin cache entries in memory, etc. Firefox decompiles bytecode (or did through the previous engine iteration, at least) because keeping the source around was a meaningful memory issue when the engine was first deployed. We talked about source preservation instead, but it can be a lot of memory in some cases, and we already had the decompiler. In your model, you have to preserve the AST, too, and they can be a meaningful size.
|
# ? Jul 13, 2014 13:05 |
|
The guy I have to work with broke the CI server (as in, like, totally hosed and now it won't run on any branch at all) and all he had to say was, almost literally, 'it works on my machine'.
|
# ? Jul 13, 2014 17:14 |
|
I keep thinking that projects written in Javascript is a fad that will go away, and then I see something like this: http://breach.cc/
|
# ? Jul 13, 2014 17:38 |
|
If all you know how to use is a hammer ...
|
# ? Jul 13, 2014 17:53 |
|
Javascript is a pretty crummy language in many respects, but as far as being stuck with a universal scripting language we could've done so much worse. If I could only use one programming language for the rest of my life and my choices were Perl, PHP, Python, Ruby or Javascript I think I'd go with Javascript. The sheer force of people hammering their heads against it even seems to be slowly making the language less hosed up. The more I think about it the easier it is for me to understand why Node.js exists.
|
# ? Jul 13, 2014 18:47 |
|
fritz posted:The guy I have to work with broke the CI server (as in, like, totally hosed and now it won't run on any branch at all) and all he had to say was, almost literally, 'it works on my machine'. Yeah, there's basically a call and response if someone blocks deploy: "aw man, it worked on my dev server" "np, we'll just route all the users to your dev server"
|
# ? Jul 13, 2014 18:50 |
Cheekio posted:I keep thinking that projects written in Javascript is a fad that will go away, and then I see something like this: http://breach.cc/ A browser written in JS? Ehh... ...oh, it's not actually written in JS, it's just another Chromium frontend. So it's a browser user interface written in JS. And for some reason HTML5 too. Hasn't Mozilla done that exact thing for 10+ years?
|
|
# ? Jul 13, 2014 18:54 |
|
I learned today that MATLAB, in the year of our lord 2014, doesn't support placing a title over a group of subplots. An official answer from MathWorks is that it's simply impossible. The workaround is to hack in an additional tiny set of axes with a text box inside of it.
|
# ? Jul 13, 2014 19:50 |
|
Subjunctive posted:Yeah, there's basically a call and response if someone blocks deploy: This is a dude who if he's not being actively obstinate or abusive I just work around him, and it's either I fix the CI server or the ceo does because he's just going to mess it up more.
|
# ? Jul 13, 2014 20:16 |
|
Subjunctive posted:Yeah, there's basically a call and response if someone blocks deploy: Even better when it's not hosted: "we'll just ship them your laptop then"
|
# ? Jul 14, 2014 15:45 |
|
Designers are the worst.code:
substitute fucked around with this message at 15:54 on Jul 14, 2014 |
# ? Jul 14, 2014 15:50 |
|
substitute posted:Designers are the worst. How much of a PITA is it for them to change the markup that's emitted for just those cases?
|
# ? Jul 14, 2014 15:59 |
|
Subjunctive posted:How much of a PITA is it for them to change the markup that's emitted for just those cases? They're already doing all that work to add the derp class to the body. You want the to do more? You monster.
|
# ? Jul 14, 2014 16:02 |
|
Lumpy posted:They're already doing all that work to add the derp class to the body. You want the to do more? You monster. Our designers have access to code and indeed do change it. The results are... interesting.
|
# ? Jul 14, 2014 16:49 |
|
I want to add something to a program I use (Dwarf Therapist), and it's written in Qt. Haven't used it before, but that's fine, I can pick up a toolkit without too much trouble I'm sure. It uses modified C++ syntax to express its signal/slot stuff, the plugin that lets VS cope with that poo poo doesn't work with Express, and getting the toy QtCreator IDE to produce a 32-bit binary required 2 reinstalls of the whole thing to excise all knowledge of 64-bit architectures. Maybe there was a way to force it to 32-bit, but I couldn't find it in the docs that were pretty much all for older versions and/or dead because the links point at dead Nokia-hosted sites.
|
# ? Jul 14, 2014 17:54 |
|
What does the Qt VS plugin do? I've used Qt for years and can't imagine needing any kind of IDE plugin to "cope" with the signal/slot syntax. I'm all for trying it if it makes my life easier somehow though.
|
# ? Jul 14, 2014 18:01 |
|
Since Qt uses its own magic preprocessor to add features to C++ you could almost argue that it is a distinct language from C++.
|
# ? Jul 14, 2014 18:38 |
|
Dicky B posted:What does the Qt VS plugin do? I've used Qt for years and can't imagine needing any kind of IDE plugin to "cope" with the signal/slot syntax. I'm all for trying it if it makes my life easier somehow though. It looked like VC was choking on the slots: declarations, but my setup was a mess by that point and I don't really have any familiarity. The plugin looks like it just does ancillary stuff around debugging and build machinations, so I guess I must not have needed it in order to do the stuff with the thing. http://qt-project.org/faq/answer/what_is_the_qt_visual_studio_add-in
|
# ? Jul 14, 2014 18:41 |
|
Realistically you only need to run the preprocessor (moc or what was it) over those files, and that and linking with some visual UI designer thing is all the plugin does. If you run qmake from the commandline you can make it poop out Visual Studio project files.
|
# ? Jul 14, 2014 18:44 |
|
substitute posted:Designers are the worst. I thought the choice of ordered vs. unordered list just indicated whether the order of the items matters. As in, if it's an unordered list then the list items' order can be changed and it doesn't matter. I see no reason why you shouldn't use bullets but still care about the order of the list items.
|
# ? Jul 14, 2014 18:45 |
|
e- the hell am I posting in here for
baka kaba fucked around with this message at 20:01 on Jul 14, 2014 |
# ? Jul 14, 2014 19:30 |
|
Hammerite posted:I thought the choice of ordered vs. unordered list just indicated whether the order of the items matters. As in, if it's an unordered list then the list items' order can be changed and it doesn't matter. I see no reason why you shouldn't use bullets but still care about the order of the list items. Then you should use ul instead of hacking css to do it with ol, but worse.
|
# ? Jul 14, 2014 19:42 |
|
baka kaba posted:Me again, with the unit tests (in Java specifically). Don't test get/set methods unless they actually have some sort of logic in them; it's wasted effort if they don't. That said, I'd write test cases for the get/set methods as one cohesive unit. Your only concern is that if you put value X in, you get value Y out. It doesn't matter if it's mutating as part of the get operation or the set operation. Other parts of your application might care about that distinction, but you'll write other tests that will cover that aspect. In C#, the relationship between get/set is a little bit clearer because it has properties, so you'd have public string Foo {get;set;} instead of two explicit methods to retrieve/mutate some private _foo member. Don't go crazy with mocks. Purists will tell you to mock out every single thing that goes into every single class, but there are going to be times when that's impractical or silly. Apply common sense liberally. Java actually has an easier time with mocks since everything is virtual by default, so you don't need to sprinkle virtual keywords everywhere or rely heavily on single-implementation interfaces like you would in C#. New Yorp New Yorp fucked around with this message at 20:04 on Jul 14, 2014 |
# ? Jul 14, 2014 20:01 |
|
HardDisk posted:Then you should use ul instead of hacking css to do it with ol, but worse. I'll try this again. ul is an unordered list. Therefore if you care about the order of the items, isn't it appropriate to use ol (ordered list) even if you want to display the list items with bullets? I mean, I think I was pretty clear in my post before. If you think I'm wrong, then fine, say so, but it seems like what I was saying went straight over your head.
|
# ? Jul 14, 2014 20:08 |
|
Hammerite posted:I'll try this again. ul is an unordered list. Therefore if you care about the order of the items, isn't it appropriate to use ol (ordered list) even if you want to display the list items with bullets? So your argument is that if you want to display the steps to make a meal with bullets for whatever reason, you'd use ol and style the items to use bullets since the items are still logically ordered? I can sort of see that.
|
# ? Jul 14, 2014 20:26 |
|
Ithaqua posted:Don't test get/set methods unless they actually have some sort of logic in them; it's wasted effort if they don't. That said, I'd write test cases for the get/set methods as one cohesive unit. Your only concern is that if you put value X in, you get value Y out. It doesn't matter if it's mutating as part of the get operation or the set operation. Other parts of your application might care about that distinction, but you'll write other tests that will cover that aspect. Cheers, I posted that in completely the wrong thread so uh thanks for the genuine reply! I've just been trying to get into the 'don't have tests relying on other tests' mentality, and this feels like it completely violates that idea. It seems mostly harmless when your methods are simple, but when they're not (or if they get more complex later) it could introduce problems where the cause isn't immediately obvious. That's what I'm worried about really. But yeah, wrong thread!
|
# ? Jul 14, 2014 20:26 |
|
HardDisk posted:Then you should use ul instead of hacking css to do it with ol, but worse. No, the point is that "order" is semantic ("these are our top concerns, in descending order of urgency"), and independent of whether or not sequential labeling is how you want to present it. This seems like an entirely appropriate use of CSS, since it's controlling presentation and the markup expresses semantics. It's one of the motivations for list-style's range of values IIRC. e;fb
|
# ? Jul 14, 2014 20:29 |
|
Internet Janitor posted:Since Qt uses its own magic preprocessor to add features to C++ you could almost argue that it is a distinct language from C++. Theres no magic preprocessor, signals/slots is standard preprocessor stuff which is also used by boost::signals. The declarations like Q_OBJECT are also expanded by the standard preprocessor. moc automatically generates C++ code for classes containing Q_OBJECT and other macros in scanned headers - you're free to create the C++ metaobject functions yourself if you hate maintainability.
|
# ? Jul 14, 2014 20:34 |
|
fritz posted:The guy I have to work with broke the CI server (as in, like, totally hosed and now it won't run on any branch at all) and all he had to say was, almost literally, 'it works on my machine'. He pushed the same broken branch and now it's broken again in exactly the same way, and I'm not gonna fix it this time.
|
# ? Jul 14, 2014 20:35 |
|
baka kaba posted:Cheers, I posted that in completely the wrong thread so uh thanks for the genuine reply! I've just been trying to get into the 'don't have tests relying on other tests' mentality, and this feels like it completely violates that idea. It seems mostly harmless when your methods are simple, but when they're not (or if they get more complex later) it could introduce problems where the cause isn't immediately obvious. That's what I'm worried about really. But yeah, wrong thread! One last derail, then: The idea you have of not coupling tests is correct, but I think your understanding is a bit off. It's not the end of the world if you change the behavior of your property accessor methods and it breaks down-stream tests -- that's an indication that something isn't working the way it should be! You should be minimizing the extent to which that happens by mocking dependencies, but like I said, it's not always going to be worthwhile to mock every single dependency. The actual problem when you have tests depend on other tests is when those tests mess with global state, and other tests depend on that state. Each test should be starting from the exact same point and constructing the artifacts it needs to run successfully. This is why singletons are anathema to good unit testing practices -- they represent global state and can be a huge pain in the rear end to test around.
|
# ? Jul 14, 2014 20:42 |
|
hobbesmaster posted:Theres no magic preprocessor, signals/slots is standard preprocessor stuff which is also used by boost::signals. The declarations like Q_OBJECT are also expanded by the standard preprocessor. moc automatically generates C++ code for classes containing Q_OBJECT and other macros in scanned headers - you're free to create the C++ metaobject functions yourself if you hate maintainability. I thought it was choking on the "slots: " pieces in the C++ files, but as has become eminently clear I may in fact be the Qt PEBKAC hazard. Tool ergonomics are still lovely, though.
|
# ? Jul 14, 2014 20:59 |
|
I wasn't trying to direct the snark at you. Sorry for that. I see now. I still think there's something wrong when you want to present something with an order and not order it somehow (not accounting for the positioning in the page, which is a type of order in itself). I just wouldn't expect a bulleted list to be a ol tag in any page, but I'll have to live with that.
|
# ? Jul 14, 2014 21:04 |
|
Subjunctive posted:I thought it was choking on the "slots: " pieces in the C++ files, but as has become eminently clear I may in fact be the Qt PEBKAC hazard. Tool ergonomics are still lovely, though. Just use Qt creator, the visual studio plugin has always seemed a bit broken. Its supposed to read in qmake .pro files and manage qt versions and such but seems to be more trouble than its worth to me. Intellisense can be quite confused by Qt's macros, while Qt Creator's completion isn't as good as intellisense its pretty decent.
|
# ? Jul 14, 2014 21:11 |
|
|
# ? May 21, 2024 00:20 |
|
HardDisk posted:I see now. I still think there's something wrong when you want to present something with an order and not order it somehow (not accounting for the positioning in the page, which is a type of order in itself). I think *most* ordering you encounter in communication is unlabeled, because sequence of reading or hearing carries the ordering information. "Today we're going to 1) finish the code review, then 2) have lunch, then 3) write a witty post on SA" wouldn't be totally awkward, but is uncommon. hobbesmaster posted:Just use Qt creator, the visual studio plugin has always seemed a bit broken. Its supposed to read in qmake .pro files and manage qt versions and such but seems to be more trouble than its worth to me. Yeah, I started with QtCreator, but it insisted on building 64-bit and wouldn't let me pick the 32-bit runtime once I forced it to find the 32-bit compiler and...yeah, I said a swear or two. I'll try again after a glass of wine later this week and see if I get there, because I'd really like to add this thing to the program!
|
# ? Jul 14, 2014 21:42 |