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
Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Biowarfare posted:

I definitely had webpages indexed on google with content in the description only visible by executing a setTimeout(eval($.ajax())) blob, this was in late 2013.

Ah, that's good. Last I tried it didn't work, and the generally accepted SEO wisdom was that those weren't run, but now that I think about it that was quite a while ago.

Adbot
ADBOT LOVES YOU

Impotence
Nov 8, 2010
Lipstick Apathy

Subjunctive posted:

Ah, that's good. Last I tried it didn't work, and the generally accepted SEO wisdom was that those weren't run, but now that I think about it that was quite a while ago.

Google is effectively the only crawler that executes advanced js, supports ipv6, supports ssl (including ecdhe-only cipher sets). But then again according to my analytics, all other search enigne traffic sending referrers is 99% google, 1% <everything else>, so :v: (edit: the 99% is before i started doing js stuff too)

Also before I get yelled at for using eval, it was for anti-scraping against some really abusive bots and bad users, settimeout and js were one of the ways to defeat curl/etc and make them have to actually work for it, and/or use additional resources like a headless browser (which was also generally detectable). I'd attach a timeout to the session like 376, render the template, and have settimeout request it in <obfuscated math adding up to 600>, if the clearly visible $.ajax URL was requested before that, the IP gets blacklisted and served completely invalid / wildly random data and response just to pollute their db - it was funny seeing them try things like regex out the "real data url" and then fail miserably at it

Impotence fucked around with this message at 01:16 on Sep 20, 2015

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Biowarfare posted:

But then again according to my analytics, all other search enigne traffic sending referrers is 99% google, 1% <everything else>, so :v:

Well, if your site can only be indexed (well) by Google, then that's what you'd expect. :v:

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.

Suspicious Dish posted:

it makes it a whole lot harder. yes, i know about the crazy #! thing
seriously, is this 2011? who writes webapps this way anymore?

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
microsoft, apple, google, reddit, twitter, github, tumblr, yahoo

literally every web app i can think of is not a spa

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

gmail is pretty close. FB plays URL tricks, but it's largely a SPA for most things.

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

Vulture Culture posted:

seriously, is this 2011? who writes webapps this way anymore?

Yep, that's why no one cares about isomorphic, err universal JavaScript... Except that's not true, everyone cares about universal JavaScript these days because you can't just ship everything to the client and expect a good user experience, from search optimisation to initial page load performance, resilience when the JavaScript defers due to a lovely network, SPAs are just not the magic bullet you seem to think they are.

German Joey
Dec 18, 2004
Speaking of lovely network performance, is there any easy way to test websocket poo poo on the client side when my websocket server is still running on the localhost? I want to make sure that all my socket handlers still gracefully reconnect and resync when the websocket connection is temporarily lost without actually killing the websocket server. Is there something like a pass-through proxy I can set up to do this?

Impotence
Nov 8, 2010
Lipstick Apathy

German Joey posted:

Speaking of lovely network performance, is there any easy way to test websocket poo poo on the client side when my websocket server is still running on the localhost? I want to make sure that all my socket handlers still gracefully reconnect and resync when the websocket connection is temporarily lost without actually killing the websocket server. Is there something like a pass-through proxy I can set up to do this?

https://jagt.github.io/clumsy/ maybe?

also you have no idea how confusing it is to randomly encounter maplestory avatars in cobol

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.
There's also Network Link Conditioner on Mac and tc on Linux.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Maluco Marinero posted:

Yep, that's why no one cares about isomorphic, err universal JavaScript... Except that's not true, everyone cares about universal JavaScript these days because you can't just ship everything to the client and expect a good user experience, from search optimisation to initial page load performance, resilience when the JavaScript defers due to a lovely network, SPAs are just not the magic bullet you seem to think they are.

I think Vulture Culture was specifically talking about using hash fragments in the url to fake real urls instead of using pushState to manage urls directly?

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.

Maluco Marinero posted:

Yep, that's why no one cares about isomorphic, err universal JavaScript... Except that's not true, everyone cares about universal JavaScript these days because you can't just ship everything to the client and expect a good user experience, from search optimisation to initial page load performance, resilience when the JavaScript defers due to a lovely network, SPAs are just not the magic bullet you seem to think they are.
I was talking about #/whatever URL routing, which nobody does because of exactly the things you're mentioning

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
Been playing with react (holy poo poo it's good) and I a question:

code:
// Say I've got a simple Button component:
var Button = React.createClass({
  render: function(){
    return(
      <a href="#" { ...someProps } >
        {innerHTML}      
    </a>
    );
  }
})

// Is there a way to set it up with 

<Button someProps>
  <span>InnerHTML</span> // or any other arbitrary html
</Button>

// so that it renders
<a href="#"> <span>innerHTML</span></a>
nm, the answer was {this.props.children}

DONT THREAD ON ME fucked around with this message at 22:45 on Sep 21, 2015

German Joey
Dec 18, 2004

Biowarfare posted:

https://jagt.github.io/clumsy/ maybe?

also you have no idea how confusing it is to randomly encounter maplestory avatars in cobol

...scared?

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

MALE SHOEGAZE posted:

Been playing with react (holy poo poo it's good) and I a question:

code:
// Say I've got a simple Button component:
var Button = React.createClass({
  render: function(){
    return(
      <a href="#" { ...someProps } >
        {innerHTML}      
    </a>
    );
  }
})

// Is there a way to set it up with 

<Button someProps>
  <span>InnerHTML</span> // or any other arbitrary html
</Button>

// so that it renders
<a href="#"> <span>innerHTML</span></a>
nm, the answer was {this.props.children}

And if you need to change / add props to the kid(s):

JavaScript code:
var Button = React.createClass({
  render: function() {
    return(
      <a href="#" { ...someProps } >
        React.cloneElement(this.props.children, {someProp: aValue})      
      </a>
    );
  }
})

Huzanko
Aug 4, 2015

by FactsAreUseless

Maluco Marinero posted:

Yep, that's why no one cares about isomorphic, err universal JavaScript... Except that's not true, everyone cares about universal JavaScript these days because you can't just ship everything to the client and expect a good user experience, from search optimisation to initial page load performance, resilience when the JavaScript defers due to a lovely network, SPAs are just not the magic bullet you seem to think they are.

It's fairly easy to make an SPA performant, if you're not a complete idiot, and there are plenty of SEO modules out there for commonly used SPA frameworks. Also I think you'll find that users are perfectly happy to trade a performance hit every page-load for a slightly larger initial performance hit; this is fairly well trod ground.

Like I said, people who hate on JS and related tools are huge babies or they're just afraid of JS's popularity or something. I don't get it.

Just use the right tool for the right job and don't be a moron.

Huzanko fucked around with this message at 18:42 on Sep 22, 2015

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Noam Chomsky posted:

Like I said, people who hate on JS and related tools are huge babies or they're just afraid of JS's popularity or something. I don't get it.

You really think that people who have several pages worth of posts over several years, and who probably do JS for a living, criticize (parts of) the ecosystem only because they're afraid of JS?

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me

Wheany posted:

You really think that people who have several pages worth of posts over several years, and who probably do JS for a living, criticize (parts of) the ecosystem only because they're afraid of JS?

He's oversimplifying, like most posts that complain about JS do.

Huzanko
Aug 4, 2015

by FactsAreUseless

Wheany posted:

You really think that people who have several pages worth of posts over several years, and who probably do JS for a living, criticize (parts of) the ecosystem only because they're afraid of JS?

I work with JS, and a host of other things, for a living. I've been writing JavaScript for about 10 years now and for the past two years I've been professionally coding Angular SPAs for enterprise clients. I think I'm qualified to have an opinion on it, thanks.

I don't know if people who complain about JS are afraid of it but it sure as hell seems like it most of the time. There is absolutely endless bitching about it to be found in every nerdy corner of the internet. It has its flaws but I don't think I've ever seen a language so voraciously hated by so many whiners. But, JavaScript was the first language I really learned - I've since picked up others - so I guess I've just been working around the shortcomings for so long that I just don't care; the features other languages posses are just gravy to me.

Huzanko fucked around with this message at 21:48 on Sep 22, 2015

Knifegrab
Jul 30, 2014

Gadzooks! I'm terrified of this little child who is going to stab me with a knife. I must wrest the knife away from his control and therefore gain the upperhand.
So here is a stupid question. If I wanted to find a good webhost to set up a decent lamp stack, where would I start. Currently I've only done a setup on a fedora core VM. In the past I used 1and1 for php and mysql webhosting but I am looking for node js and postgres.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

If you haven't seen a language hated as much as JS, you must have missed the heydays of Perl and Java vitriol.

Criticizing an aspect of JS, or an aspect of one way to employ it, need not be motivated by fear or jealousy, or even a dislike of the language. For those with significant exposure to many development environments and languages, it can simply be a wish that JS had a facility or ease that they've found elsewhere. That's where many aspects of JS came from, after all: we borrowed (usually) good ideas from elsewhere.

From my perspective you're a relative newcomer to the language, heh, but I certainly have criticisms of both the language and different strategies for employing it. I'm certainly not afraid of JavaScript's influence; indeed, I've devoted much of my career to increasing that influence in different ways. That someone criticizes something I've helped build, or something I like, doesn't mean they're criticizing me, so I don't feel the need to assume ill intent on their part.

Knifegrab
Jul 30, 2014

Gadzooks! I'm terrified of this little child who is going to stab me with a knife. I must wrest the knife away from his control and therefore gain the upperhand.

Subjunctive posted:

If you haven't seen a language hated as much as JS, you must have missed the heydays of Perl and Java vitriol.

Criticizing an aspect of JS, or an aspect of one way to employ it, need not be motivated by fear or jealousy, or even a dislike of the language. For those with significant exposure to many development environments and languages, it can simply be a wish that JS had a facility or ease that they've found elsewhere. That's where many aspects of JS came from, after all: we borrowed (usually) good ideas from elsewhere.

From my perspective you're a relative newcomer to the language, heh, but I certainly have criticisms of both the language and different strategies for employing it. I'm certainly not afraid of JavaScript's influence; indeed, I've devoted much of my career to increasing that influence in different ways. That someone criticizes something I've helped build, or something I like, doesn't mean they're criticizing me, so I don't feel the need to assume ill intent on their part.

To be fair, I still hate Java. JS is great though, so far its by far my favorite language (I have (now) LUA, PHP, Java, Lisp and some C/C++ under my belt).

Edit: TO clarify, under my belt means I'm a total newb scrub and literally know nothing Jr. Developer.

German Joey
Dec 18, 2004

Noam Chomsky posted:

Just use the right tool for the right job and don't be a moron.

Right, hence, don't use javascript if you can help it.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

German Joey posted:

Right, hence, don't use javascript if you can help it.

:laugh:

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.

Knifegrab posted:

So here is a stupid question. If I wanted to find a good webhost to set up a decent lamp stack, where would I start. Currently I've only done a setup on a fedora core VM. In the past I used 1and1 for php and mysql webhosting but I am looking for node js and postgres.
1. LAMP is an acronym describing a specific stack, Node.js and Postgres aren't part of it
2. http://forums.somethingawful.com/showthread.php?threadid=3289126

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
Javascript has first class functions and is therefore better than more fun than many alternatives.

German Joey
Dec 18, 2004

MALE SHOEGAZE posted:

Javascript has first class functions and is therefore better than more fun than many alternatives.

more like its one saving grace. but better than what? C++? PHP? we're dredging pretty bottom of the barrel here! if only it had a real scope implementation and an object model that didn't both require extreme abuse of these aforementioned first class functions, then it might actually be enjoyable to code in this horrible loving language! but probably not! THE WEB! GOTTA LOVE IT!!!!!!!!!!

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

You want something other than lexical scope? Dynamic scope would be much worse, I think, so I'm curious as to what you have in mind.

Which object model facilities do you find yourself wanting? Classes provide more traditional syntax, and proxies+reflect give a pretty rich meta-object protocol (though you have to implement defadvice or similar yourself if you want it).

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Subjunctive posted:

You want something other than lexical scope? Dynamic scope would be much worse, I think, so I'm curious as to what you have in mind.

Which object model facilities do you find yourself wanting? Classes provide more traditional syntax, and proxies+reflect give a pretty rich meta-object protocol (though you have to implement defadvice or similar yourself if you want it).

If the scope rules aren't the same as in $CURLY_BRACE_LANGUAGE_I_PERSONALLY_LEANED_FIRST it's obviously not right and totally fake I mean come on this is obvious :colbert:

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Munkeymon posted:

If the scope rules aren't the same as in $CURLY_BRACE_LANGUAGE_I_PERSONALLY_LEANED_FIRST it's obviously not right and totally fake I mean come on this is obvious :colbert:

With let and use strict it basically is the same as those Algol descendants though. (Explicit this for member access in methods, but that's hardly unusual these days.)

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Subjunctive posted:

With let and use strict it basically is the same as those Algol descendants though. (Explicit this for member access in methods, but that's hardly unusual these days.)

Yeah :\ Is it weird that I'm a little disappointed that let is being added to the language? I mean, it'll help interpreters be more aggressive about garbage collection, right? Otherwise it just seems like a bunch of people just bitched and moaned about how it was too different and "Different bad! Bad! No like different! :saddowns:"

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Munkeymon posted:

Yeah :\ Is it weird that I'm a little disappointed that let is being added to the language? I mean, it'll help interpreters be more aggressive about garbage collection, right? Otherwise it just seems like a bunch of people just bitched and moaned about how it was too different and "Different bad! Bad! No like different! :saddowns:"

let doesn't really improve things for garbage collection very much (a bit in cases where you create a lot of garbage in one loop without reusing variables or something?), but binding-per-execution is useful for avoiding traps like the common:

code:
for (var i = 1; i <= 5; i++) {
  items[i].onclick = function (ev) {
    console.log("Item " + i + " is clicked.");
  };
}
in which all items log 5. That's not a scope issue, though: the scope differences for let are really that they are block-scoped and not hoisted.

It also removes the redeclaration behaviour, which can be a footgun in the case of large functions with closures.

E: let also introduces the concept of a "temporal dead zone", which is :black101:

Subjunctive fucked around with this message at 16:01 on Sep 23, 2015

obstipator
Nov 8, 2009

by FactsAreUseless
nodejs is my fav language :q:

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

so close to metal

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Subjunctive posted:

let doesn't really improve things for garbage collection very much (a bit in cases where you create a lot of garbage in one loop without reusing variables or something?), but binding-per-execution is useful for avoiding traps like the common:

code:
for (var i = 1; i <= 5; i++) {
  items[i].onclick = function (ev) {
    console.log("Item " + i + " is clicked.");
  };
}
in which all items log 5. That's not a scope issue, though: the scope differences for let are really that they are block-scoped and not hoisted.

But it doesn't make the naive expected behavior standard, so it doesn't actually help in that case because you still have to understand what's going on and proactively do something to fix the value in the inner function. It'll just change the standard answer to the question to include a let j = i;

quote:

It also removes the redeclaration behaviour, which can be a footgun in the case of large functions with closures.

OK, that's cool and good.

quote:

E: let also introduces the concept of a "temporal dead zone", which is :black101:

It's also another thing for newbs to misunderstand :v:

geeves
Sep 16, 2004

Subjunctive posted:

let doesn't really improve things for garbage collection very much (a bit in cases where you create a lot of garbage in one loop without reusing variables or something?), but binding-per-execution is useful for avoiding traps like the common:

code:
for (var i = 1; i <= 5; i++) {
  items[i].onclick = function (ev) {
    console.log("Item " + i + " is clicked.");
  };
}


I use this as one of my interview questions and ask them, "What's wrong, if anything at all?"

2 out of maybe 14 or 15 candidates this past summer (for a senior-level / managerial position) got the answer right. One asked why I didn't just use jQuery :downs:

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Newbs should just use let all the time. We actually had "let is the new var" T-shirts in 2010 or so.

ROFLburger
Jan 12, 2006

Question!

There are a lot of jsdoc parsers that can evaluate comments in js files and generate JSON describing the code. What can I use to easily parse this JSON and make pretty jsdocs?

Huzanko
Aug 4, 2015

by FactsAreUseless

Subjunctive posted:

If you haven't seen a language hated as much as JS, you must have missed the heydays of Perl and Java vitriol.

Criticizing an aspect of JS, or an aspect of one way to employ it, need not be motivated by fear or jealousy, or even a dislike of the language. For those with significant exposure to many development environments and languages, it can simply be a wish that JS had a facility or ease that they've found elsewhere. That's where many aspects of JS came from, after all: we borrowed (usually) good ideas from elsewhere.

From my perspective you're a relative newcomer to the language, heh, but I certainly have criticisms of both the language and different strategies for employing it. I'm certainly not afraid of JavaScript's influence; indeed, I've devoted much of my career to increasing that influence in different ways. That someone criticizes something I've helped build, or something I like, doesn't mean they're criticizing me, so I don't feel the need to assume ill intent on their part.

I should've been more clear. I am not saying JS is beyond criticism; I am saying that I have a growing dislike of the fact that it being imperfect is used as an argument for never using it, despite all languages and tools being imperfect.

Adbot
ADBOT LOVES YOU

ExcessBLarg!
Sep 1, 2001

Noam Chomsky posted:

I am saying that I have a growing dislike of the fact that it being imperfect is used as an argument for never using it, despite all languages and tools being imperfect.
That's an argument for not introducing JavaScript places where there already exists superior languages and tools. Namely, Node.js and, perhaps specifically, the push to replace everything with the MEAN stack.

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