Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Don't use a XHTML doctype if you're not going to even try to write actual XHTML. The body tag isn't option in XHTML, you have to set the namespace, have to escape <, and document.write isn't supported in XHTML for reasons that should be very obvious if you think about how it and XML work.

All you have to do is generate all but the last die roll in the loop, then do the last one outside the loop and print everything out how you are.

Adbot
ADBOT LOVES YOU

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

fletcher posted:

Is there any performance difference between using arrays vs. using JSON?

Err... JSON is the serialized form of javascript arrays (and objects, strings, etc.). Unless you're doing something insane like directly working with it in string form rather than serializing and deserializing it, your question makes no sense.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
What that statement is doing should be instantly obvious if you have any understanding of how javascript objects work. It's stupid to do things in a way other than the absolutely most basic when the "benefit" is that you save typing 15 characters, but it really shouldn't cause confusion.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

RussianManiac posted:

is there any sycnrhonizatino in javacsript? Do most browsers implement pure user level threads for JS or do some of them actually might execute in parallel?
Javascript was originally explicitly designed to be single-threaded, as the sorts of things it was intended for don't need threads and they vastly complicate things. HTML5 is adding worker threads, but for now no browsers natively support threads in javascript at all.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
The mouseover event works correctly for the blue (but not the black) lines for me with Opera 10.50. The click event works for both types of lines.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
It doesn't actually "work" in any browser; it's just that trying to navigate to something that can't possibly be interpreted as a URL results in nothing happening, which is what the author presumably wanted anyway. The only difference is that Firefox complains more visibly about the error.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Yes, that's absolutely valid (if ill-advised); the expression just has to evaluate to a string (or thing that can be converted to a string), which function() { return false; } does not.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

geeves posted:

I admit I don't like the way it looks. Perhaps because I would never do that in Java.
Yes, but that's because the golden rule of Java is to never pass up a chance to be pointlessly verbose.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
document.write also isn't supported in xhtml, although I suppose you're obviously serving the page as html as it isn't well-formed xml either.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Not really. Polling is a bit less fragile, but that's basically the same idea. WebSockets make duplex communication possible, but won't be a realistic option any time soon.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Your question would be a lot easier to answer if you gave some indication of what results is.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
I assume it was initially a placeholder name that never got changed, since the alternative is just too dumb.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
A closure only has to be formed when a function outlives its upvalues' scopes. In the specific case of Javascript, since functions are the only scoping mechanism, conceptually closures only have to be created when returning from functions (and the function is either being returned or has been stored in a variable in a surviving scope). In practice, I'd expect most implementations to create the closure at the same time as the instantiation of the anonymous function.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Gnack posted:

Because it's clearer. Labelling data just makes sense, I'm surprised this is at all controversial.
The URL should already be clearly labeling the data.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Mogomra posted:

Is it even really a "feature" as much as it was one browser assuming that people writing JavaScript are mouth-breathing sub-humans, and then every other browser thinking they needed to do that too or else they'd break the internet?
ASI was an intentional part of the original design of Javascript. It just wasn't quite done correctly since Eich only had a few days to hack together Javascript.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Jabor posted:

I have no idea why anyone would need sub-cent precision for a POS terminal. Does anyone actually care that they end up paying $15/item instead of $14.995 when they get nominally 50% off?
The only thing that comes to mind would be gas for the 9/10 cent pricing, but that's probably not going to involve a standard POS.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
I thought CoffeeScript was dumb, then I actually worked on a project that uses it and discovered that it cuts the line count in half while making code significantly more readable. I can't really imagine ever choosing to use pure JS over it for a non-toy project.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Mogomra posted:

I was bored, and what the heck else do you use String.Empty for?
It was marginally faster than "" in C# 1.0 (to a degree that is unlikely to have ever mattered in any application ever created). These days it's just there for people who love making everything as verbose as possible.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Wheany posted:

I get that you're not serious. That said, aren't strings in C# immutable, like in Java and Javascript? And because of that, don't Java string literals get translated into static code and every instance of a particular string literal is the same instance? Is that not the case in C#?

If it is, then string.Empty is the same as every "" in code.

You used to be able to change the value of string.Empty via reflection, but not the value of "". Barring stupid shenanigans like that, they do compile to the same thing (after the JIT gets to it; the IL is different).

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
IE10 is significantly faster at basically everything than IE8/9, so that part is totally normal. SVG rendering being faster with the dev tools open is weird, though.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Just use PHP if you really want to write PHP.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Ethereal posted:

I'm a big fan of the Mocha framework with Chai matchers.

Are there even any other realistic options? Mocha+Chai+Sinon seems to be what everyone uses.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
TypeScript'a a superset of Javascript, so trying to use it to avoid learning JS would be rather foolish.

It's one of the better compiles-to-JS langauge, and if you're writing a lot of JS and don't like CoffeeScript-style languages I would strong recommend it.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Where does this whole "I don't want to learn JS" perception come from? I know JS well, and that's why I don't want to use it given other options. ClosureScript and Dart are the only compiles-to-JS language I've seen that even pretend to try to be usable by someone who doesn't already know JS.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
You don't have any chained ifs there. Only the last condition failing will result in the form not submitting, not any of them but the first.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
I have come to dread doing anything involving Google APIs or Google libraries. They're frequently shockingly bad, and when they aren't, the documentation is.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
The problem with that approach is it creates a new copy of each function for each instance of the class, which massively increases memory usage. From a design perspective I'm a fan since it means you get private variables, but it just doesn't scale very well.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
No, it is impossible. That is why none of the libraries written in JS actually work.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Misogynist posted:

Opera's been WebKit-based for awhile now - where are you afraid of it falling behind?

Opera 12, not the entirely unrelated blink-based browser.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Doc Hawkins posted:

my experience was that the integration with the javascript ecosystem was essentially absent.
I'm not entirely convinced that's a problem. There are equivalents to (or bindings for) most of the major JS libraries, and if not being able to use a library that's only saving you a few dozen lines of code isn't made up for by using a better language, then it probably wouldn't be worth learning ClojureScript even if the library difference didn't exist.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Strong Sauce posted:

It's not recommended to use AppCache. Completely unusable. http://alistapart.com/article/application-cache-is-a-douchebag

Did you actually read that article, or did you just laugh at the introduction then close the page? It doesn't actually try to claim that AppCache is unusable; merely that it has a bunch of gotchas you have to keep in mind.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
You're assigning to textures[i] rather than textures[i].texture. Also, use {}, not new Object().

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Chenghiz posted:

Why is it that every new hot database seems to be key/value? Are relational databases like postgresql and mssql just that perfected/done?
It's a lot easier to build a good key/value store that does one or two interesting new things than it is to build even a bad relational database.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Math.random is about as far from a CRNG as you can get. It's sometimes even worse than return 2; as it's sometimes an easy to predict PRNG that leaks state between pages.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
My general experience with things (not in JS) that try to magically handle HATEAOSy APIs is that they don't end up doing anything useful. The lack of standards means that unless you're designing the API to fit what the library wants, configuring the library is at least as much work as just rolling something yourself would be, and you probably can't get away with eagerly fetching the graph (since that may involve a very large number of requests), so all you really want is some helper methods to make it easy to resolve links.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

necrotic posted:

The main difference between Javascript's arguments and other languages is that arguments a) contains all of the passed arguments and b) is not actually an array. Any other language I can think of that supports variable argument definitions has both an explicit way of defining access to them (*args in ruby) and the list of variable arguments is not some special "object".
The overflow part being wacky and different from everything else in the language isn't that unusual. Lua's ... is mostly sane but it a data structure you don't encounter anywhere else in the language, and of course C's varargs are incredibly weird and different.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
The whole point of lodash is to be underscore but better, so I'm not sure what could be surprising about the website focusing on how it's better than underscore.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
I sometimes wish that jashkenas was the sort of person to get bored with projects and move on to other things once other people are contributing. He has a pretty solid track record at creating useful new things, but is much worse as a maintainer of things people depend on.

Adbot
ADBOT LOVES YOU

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Wheany posted:

I really dislike when frameworks do "cute" stuff like that without immediately explaining what they're doing behind the scenes.

One example is Angular using toString() on functions and then parsing the function arguments to determine the dependencies to inject.

For me the key thing is if it's immediately obvious that they're doing something cute when reading code using it. It doesn't matter how well documented something is if the code doesn't give me any reason to think I need to look at the documentation. IMO the Chai example is pointlessly clever, but it's not something I'm going to blow four hours on trying to figure out why some perfectly ordinary operation isn't working before discovering that it's because of well-hidden magic.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply