« first day (2138 days earlier)      last day (3032 days later) » 

13:00
the cool kids call it es6, the squares call it es2015
@littlepootis so you're saying if I create my class Foo, there is a construct that would allow my "toElement" function (or whatever it is called) to be invoked just by attempting to insert it? Like so: var blah = new Foo(); document.body.appendChild(blah);
?
Or would it have to be invoked using string serialization, vis-a-vis innerHTML?
nah, no.
@Vap0r yes
what hackery is this?
ES2015 is the correct name
You square.
13:02
@littlepootis yes?
or do you call ES2016 ES7?
to which?
Sorry for the dumb question, but in SQL (knex), how are you supposed to limit the number returned from a left join?
@Gant they are both correct. ES2015 is the 6th edition of ecmascript
so es6 still makes sense
you want to limit just one table?!
13:03
you don't @corv
you just use a subquery instead
^, if that is really what you want
Am I doing it wrong then>?
  db
    .select(
      'movies.id',
      'movies.title',
      'movies.synopsis',
      db.raw(`json_agg(json_build_object(\
        'id', reviews.id,\
        'title', reviews.title,\
        'review', reviews.review,\
        'score', reviews.score\
      )) as reviews`)
    )
    .from('movies')
    .leftJoin('reviews', 'movies.id', 'reviews.movie_id')
    .where('movies.id', req.params.id)
    .groupBy('movies.id')
    .first()
    .then(result => res.status(200).json(result))
    .catch(next);
well what do you want to do?
might as well just use plain SQL if you aren't generating a query from data.
Does anybody know what little pootis was talking about?
Does he actually know what he's talking about?
13:04
yeah that's a little more readable
anyway @corv
@Vap0r No and sometime, respectively.
you do something like LEFT JOIN (SELECT * FROM reviews where reviews.movie_id = movies.id LIMIT 10) reviews on reviews.id = movies.id
not sure if that works
haven't tested it
@Vap0r woah.
@littlepootis what?
I like how you went from "yes?" to "does he actually know what he's talking about" in 2 minutes.
13:08
!!woah
Good morning casuals
while I was cooking up some example code so that you'd understand what I'm talking about
now I realize I have better things to do
like watching cat videos on youtube
(he realized he didn't know what he was doing) :)
don't call me a casual you're not even mlg pro
13:09
@littlepootis alright cool
@SterlingArcher real questions: can colourblind people see the red flags in their relationships?
They look like green flags.
@rlemon dude that open MCT framework kicks so much ass
I'm pitching it to see if we have any use cases for it
yea it looks really nice.
13:15
Hello! I have one question about your workflow. Do you add to your html file as background the psd template?
MCT framework?
who's working on the KSP integration. That's what I want to know
@Everyone... thanks.
13:17
In 2 days if I pass my cert test I'll be a certified scrum master lol
Which is horrible timing because I have huge milestones to hit and I'm losing 2 days of coding for this >.<
wut? They have scrum certs now?
you should complain about it
tell them enough is enough and its time for a change!
!!afk \//\
Do you just take the test over and over again as fast as you can until you get it right?
nice.
One chance at the test. 2 days of studying
13:21
That sounds like a waterfall method test.
The project I'm scrum master for is very laid back. So it's not required for me to be certified, but my project managers want to improve me so why not. Plus it's a huge resume booster in my area
@Vap0r nahh, he sticks to the rivers and the lakes that he's used too
Something agile scrum and certification buzzwords drive companies crazy for you here
> I'll be a certified scum master ~ Sterling Archer, 2016
@rlemon lol
@SterlingArcher whereabouts is "here"?
13:22
Northern VA area/DC
The basement of the pentagon.
And I really do need an answer to that question I asked about classes in ES5, maybe I shouldn't have pissed off little pootis.
Lol so what @Luggage said, right sterling?
ask your question about classes again.
I mean.. my company does have pentagon contracts but I'm not involved in those
I didn't follow your appendNode thingy.
13:24
I work mainly with DHS and the NGA
I think he wants to automagically have a class printed nicely into a HTML element container.
but I could be wrong.
National Gallery of Assholes?
@Luggage Nude Granny Association
National Geospacial-Intelligence Agency :P
Pretty much, let's say I have a class Foo. I want it so when I try to insert the class somewhere, it recognizes it and does exactly what @rlemon just said.
13:25
I think the most you can hope for is a nice string..
Sooo..... var bar = Foo(); document.body.appendChild(bar);
@Luggage and that would work with innerHTML?
Could I modify HTMLElement instead so I could do the appendChild trick, but still have my class customization?
class Foo {
	constructor() {
  	this.a = 'b';
	}
}

document.body.innerHTML += new Foo().toString() // you want this to insert
/*
class Foo {
	constructor() {
  	this.a = 'b';
	}
}
*/
// as a string?
Personally, I don't know that appendChild takes anything other than an real node.
@Luggage node or document fragment
@rlemon no not exactly. How do I write code in this?
13:27
if you are calling .toString(), just use templating to make that string. That's how it's done
What is the advantage of needing it to feel like magic?
@Vap0r so you want to make a serialized table of the class methods and properties?
so.. like the jsdump thing that ndugger and I made?
1 message moved to Trash can
@Vap0r Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. For posting large code blocks, use a paste site like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
there is no 'toElement'
innerHTML has no concept of elements
you pass it a string which gets passed to the parser
Yeah that's my implementation.
I end up just doing document.appendChild(bar.toElement())
like @Luggage was saying
but I don't NEED it to feel like magic but I just constantly feel like I'm not doing things the right way when it comes to javascript.
Everything is so hacky.
function Slide(args) {
for (prop in args) {
this[prop] = args[prop];
}

this.error = this.error instanceof Array ? this.error : [];

this.toElement = function() {
//templating here
};

}
13:30
well, trying to obscure what is happening is wrong, to me.
Say if I have a bunch of those printed out on the page, I want a good way to maintain the state of each of those element sets.
@Luggage it wouldn't be obscuring if it was a practice that I was just ignorant to, but you're right, I don't want to add it if it's not done by anyone else lol
if you want to keep it in sync, then you definately don't want to just dump html onto the page
or you'll have to replace it ALL to keep it up-to-date
Crap then what should I do?
You aren't doing anything special, so get that out of your head. Go look up "js html template" and choose one of the 100's of tools
react, jsdom, ... anyone else have a suggestion?
Are there any implications when modifying global in Node?
13:32
I assume he (or she) wants lightweight / minimal
@Luggage didn't really think I was. Just didn't know the terminology
@Luggage he, and you're right.
Doe sit need to be very few bytes? is there an actual limit?
I have an application that has "weird" behavior, which I tracked down to a commit that added a library that adds a field to global. When I change that library to not change global, the weird behavior goes away
There isn't a limit. But I tried using jQuery and there are Raspberry Pi clients and they REALLY didn't like it.
well, jQuery is just a general purpose set of 'helpers' for things like .appendNode(). It doesn't really solve this problem.
I think there is a jquery template plugin, but f that.
13:35
@OliverSalzburg tried your answer, but unfortunately it isn't working
I mean, I'm templating alright (I think!)
scope is not getting triggered on validation change
scope's watch
but the biggest problem is that there is no relationship between the UI and the class
Is that handled in templating engines too?
@Mathematics Works for me
so.. two main directions. A funciton that generates a blob of html as a string (mustache, most template libraries), or a function that generates an object graph of html (like react, hyperscript, jsdom)
in both cases, the relationship comes from you attaching event handlers.
like.. this button click event calls myClass.doDomething()
then re-renders, perhaps
13:37
That's fine. Which do you recommend? Also, I'm not familiar with object graph
1 message moved to Trash can
@littlepootis Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. For posting large code blocks, use a paste site like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
eh
class Slide {

  constructor () {
    // do stuff
  }

  toElement () {
    var element = document.createElement("lemon");
    element.innerHTML = "sorry, slide - rlemon, 2015";
    return element;
  }

  toString () {
    return "<lemon>sorry, slide - rlemon, 2015</lemon>";
  }

}

var slide1 = new Slide();

document.body.appendChild(slide1.toElement());
// or
document.body.innerHTML += slide1;
"use pootis"; // so that pasting into dev console doesn't crash browser
I highly recommend react, but it's not small, and needs es6+jsx to really be ultra-convenient.
Or, y'know, TypeScript.
@OliverSalzburg on this browser ?
13:40
@littlepootis appreciate it.
@RoelvanUden I know TS
Sorry for being callous earlier.
@littlepootis that's ES6?
@Vap0r TypeScript
@littlepootis innerHTML on a string? Forshame.
I hope that's ES6
13:41
That is ES6.
@Vap0r ^ ok it's ES6 then
Lol
Oh I see what you're doing
That still bugs me
What have you done poot
Why does that bug you guys?
13:43
Is there any good, built in, functional ways to find or update in an array?
.forEach(), .filter(), .find()
@corvid .find
Did you hit your head again?
isn't that just finding, though? Do you find and then splice?
Nah, he just didn't do any research
13:44
filter and map
it's because I am a dumb bird
No, read above
What's browser support look like for ES6? I just tried looking it up but I never took statistics so I'm not quite sure what I'm looking at.
mutating an existing array and 'functional' don't normally go together.
um, also that
13:46
@Vap0r It boils down to: it's sad.
@Vap0r unless you are edge/chrome only, don't depend on es6 supprt. Use a condom
I mean transpiler
transpiler?
You've got to be making up words.
Babel.
Nope. Transpiler takes one languages and outputs another. It dooesn't compile, it transpiles
ES6 to es5 transpiler
13:47
@rlemon that's the one that gave me an aneurysm
@Vap0r babeljs.io solves all problems. Also makes a few, but mostly solving
Alright.
@Vap0r how? it is clear and concise
look at the top, gives you a coverage %, then you can check each feature you need one off
@rlemon exactly... I was expecting something directly convoluted.
And I can tell I won't be satisfied.
It's clear, but it makes it look like every line of code is going to work in one single random browser. It's not that bad.
13:49
@Luggage sweet.
I got one more question, but I might have used them all up.
just put in another quarter
/me inserts quarter
oh... I guess that isn't a thing. It's the thought that counts though.
Anyways, I have an application that is on display in one of our lobbies. It uses AJAX to check the meeting schedule for our meeting rooms and displays them. This application runs 24/7.
Sometimes when our services go out or network latency is particularly bad the AJAX/setTimeout loop fails, and I come in in the morning to an application that has to be rebooted.
then trap for the error so that doesn't happen?
or use setInterval
13:52
How do I catch that error? It's often an error about IO NETWORK SUSPENDED and the likes.
what ajax 'library', if any, are you using? Are you catching errors?
or something like that. can't quite remember.
@Luggage haha
"library"
use websockets
:D
it's all vanilla js
        var xhr = new XMLHttpRequest();
        xhr.open("POST", app_API);
        xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
        xhr.setRequestHeader("Accept", "application/json;");

        var self = this;
        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4) {
                if (xhr.status == 201 || xhr.status == 409) {
                    // Deal with error message from 409.
                    var data = JSON.parse(this.response);
Like that kind of.
So pretty.
It's just a matter of trapping the error and scheduling the next one.
13:53
xhr.onerror = _ => {
   logEverything();
  restartEverything();
}
ok, so XMLHttpRequest should have error events, if it not covered by onreadystatchanges
onerror.
nice
And I do plan on switching to websockets
yea.. or just base the whole thing on setInterval instead of self-calling setTimeout
I think I had trouble with setInterval but I can't remember why.
@rlemon Everything ? even the network router ? :|
13:54
because long hanging responses will stack
:32444237
@rlemon that's it!
I had to switch because of the stacking.
does XMLHttpRequest have a cancel or timeout?
timeout
the network timeout is browser / server dependant iirc
there is a way to cancel the request
not sure what it is, never used it
13:56
There's a timeout property
You could always roll your own though
And I'm running this application on a combination of Raspberry Pi 2s, 3s, and regular desktop browsers
well.. maybe a small library can do all that for you
The pi is running epiphany
use fetch
@Luggage yea, websockets :D
13:56
:D
@BenFortune STOP TRYING TO MAKE FETCH HAPPEN!
@rlemon Haha, waited for that
I ws going to suggest fetch
it's a much simpler upgrade than websockets.
I love mean girls
@rlemon I agree, would you recommend signalr if I'm in a .NET shop?
and fetch?
13:57
The movie? Me too.
Both, I guess
I suggest lemon cranberry muffins for breakfast
they're delicious
Fetch is edge+ right?
use a polyfill.
Crap then I can't use fetch.
Sweet than I can use fetch!
13:58
if it brings a reliable cancel or timeout, then it'll make things simpler. It's not websockets, but I don;t think it needs to be.
if I'm understanding his application, he's long polling where he should be just creating a socket connection
I'd really like websockets, but I'm using the exchange web service to get my meetings for this application, and I can't think of a good trigger that wouldn't just involve hitting the web service constantly on the server and returning when there is a change.
websockets is for sure the better way to do this
@rlemon see above
because I agree with you WS is the way to go.
create an observer and emit on change

« first day (2138 days earlier)      last day (3032 days later) »