« first day (1138 days earlier)      last day (4033 days later) » 

21:00
the implicit return and light weight declaration reduces surprisingly a lot of the boilerplate
Also the this binding.
@rlemon never gonna.
right yea
they're recently talking about =>* for generator functions
It's super useful - I hate coding in environments that don't let me do ES6 ^^
21:02
well =>* only makes the initial declaration shorter but not the body
like Promise.coroutine( () =>* {}) vs Promise.coroutine(function*(){})
// proposed generator arrows...

// Irregular
() =*>

// Hostile to ! (async function)
() => * { ...yield... }

// Not good
() => * (yield a, yield b)

// Ok if 1 token
x *=> x * x;

// Bad (ASI)
*() => ...

// Hostile to !
(x) =* {...}
yeah it's mostly to get rid of the function keyword
#### Consensus/Resolution

- No addition, revisit for ES7
but with promises => reduces a lot of code because of implicit return etc
^ no generators expressions in ES6 @FlorianMargaine
@Esailija it reduces a lot of code in map/reduce/filter constructs too. Personally I think map/filter should return a generator and not an array too.
21:05
-10
Q: Why does my user name keep changing?

user243032My username keeps being changed to a default username. It's the second time this happens. What might cause this?

    analytics.disableForIsrael().then(() => {
        model.loadClient();
    }).then((c) => {
        client = c;
        analytics.reportIEMode(client.id);
        setTimeout(function () {
             model.getSearchableStocks(client.id);
        }, 0); // prefetch list of searchable stocks.
        setPermissionsAndDetectFirstUsage(client);
    }).then(loadUserId).then((c) => {
        var uiFuture = initializeUserInterface(c);
        var servicesFuture = initializeServerData(c, pageDataParser);
#### Consensus/Resolution

- ES6 spec needs to spec that Promises are serviced in a FIFO queue
- Other non ES6 tasks might be interleaved arbitrarily
- Interleaving of the Promise queue by other non ES6 operations
checking how the code looks with ES6 => ^*2
@Esailija do you understand how they'd work otherwise? I mean - what alternatives are there?
what is they?
21:06
Promises
@FlorianMargaine first arrow can be expression not block :P
.then(() =>
    model.loadClient())
that was too much on one line :P
yeah I guess
@BenjaminGruenbaum FIFO queue is obvious yes
21:08
that's what I thought
Hi all, is there anybody experienced with jquery qtip that can give me some help here: stackoverflow.com/questions/20222691/…
using $.post(), do I have to stringify the JSON?  Example:
$.post('/javaServlet?action=writeJSON', myJSON);
@FlorianMargaine it looks very good to me since there is no return
not sure it doesn't bug though
arrow functions return last statement right?
like in CS
21:10
yeah
so you need to return promises
  try{
      async () => {
        await analytics.disableForIsrael();
        client = await model.loadClient();
        analytics.reportIEMode(client.id);
        Task.defer(model.getSearchableStocks(client.id));
        await client.setPermissionsAndDetectFirstUsage();

        var uiFuture = initializeUserInterface(client);
        var serviceFuture = initializeServerData(client,@Inject PageDataParser);
        var [views,pageData] = await Task.WhenAll(uiFuture,servicesFuture);
        fillUiWithData(page,views.pageView,views.view,pageData);
@FlorianMargaine ^
@jbolanos if you don't, it will try to post the object url-encoded, not json-encoded (by default, at least)
yeah that's way better
The problem is like @Esailija said catch is broken, so if I want to handle I/O failure here (I do in fact in serviceFuture based on exception type), but it's implicit here since this flow is too high level) - I'm stuck.
21:12
@1110 What jQuery version are you using? 2.x doesn't support IE8 and code using jQuery should be browser-independent
has anyone had any issue with putting javascript into the head using async and defer?
<script async defer src="js/jquery-2.0.3.min.js"></script>
@jbolanos it might not be available when you need it :-)
I hate IE
arrows can do much better though
@jbolanos jQuery 2.x doesn't support IE8
21:13
analytics.disableForIsrael().then(() =>
    model.loadClient())
.then((c) => {
    client = c;
    analytics.reportIEMode(client.id);
    delay(0).then(() => model.getSearchableStocks(client.id));
    setPermissionsAndDetectFirstUsage(client);
}).then(loadUserId).then((c) => {
    var uiFuture = initializeUserInterface(c);
    var servicesFuture = initializeServerData(c, pageDataParser);
    analytics.reportSupportedWebsiteAnalytics(page, c.id);
    [uiFuture, servicesFuture]
}).spread((views, pageData) => {
@JanDvorak I don't support IE 8 either :D
there is no need for .all if you call .spread
@Esailija benji's code is prettier though
@jbolanos thumbs up for that :-)
@Esailija delay(0).then(() => model.getSearchableStocks(client.id)); can be delay(0).then(model.getSearchableStocks.bind(model,client.id)) fwiw
21:14
@JanDvorak I got the go ahead to tell IE8 users to go eff themselves
it's shorter without bind :D
That's not even shorter -_-' damn you bind y u so heavy
Yeah
@JanDvorak 1.6.4 that is version that I have to use
@jbolanos I prefer "enter at yer own risk" signs :-)
@FlorianMargaine yea but not by huge margin as you can see
21:15
@1110 I think you should upgrade
@JanDvorak I throw up a screen that says 'Browser not supported'
@jbolanos Youtube does "browser not supported. Enter anyways? [y/n]
@Esailija can I return an array of promises like that without Promise.all and have it automatically do .all for me?
I didn't know that.
it doesn't call automatically but .spread does
Try Jquery 1.8 @1110
21:16
when .spread and the value is an array, if the array contains promises, they are waited for
-ms-word-wrap: normal | break-word;
ummm
get rid of normal |
@1110 anyways, the jQuery version doesn't explain why IE fails. The next candidate is CSS
@Esailija so if I follow a .then with a .spread I don't need to explicitly call promise.all?
@JanDvorak I can't managers doesn't allow :( it just doesn't show arrow and no multiline in IE 8/9
took me two seconds of looking at the css to spot what looks like the issue
looks like someone copied too much from the list of available options
21:17
@BenjaminGruenbaum if you call spread on a promise that is resolved to an array of promises the spread automatically waits for the array to be fully resolved
so yes basically
nice, didn't know that.
it even awaits for thenables
@1110 if you didn't catch on. My last 4/5 messages were for you
21:17
return [$.get("/")] works too
I want annotations for DI :/
@rlemon :) I will try it now :)
but let's imagine you didn't call spread but then
function(foo,@Inject[Car] car){ // get car from DIC , maybe I should write that.
    somePromise.then(() =>
        Promise.all([$.get("/"), $.get("/foo")])
    .then((arr) => {

    });
can still be done more sugary
    somePromise.then(() =>
        [$.get("/"), $.get("/foo")]
    .all().then((arr) => {

    });
basically .spread is implicitly saying same as .all().spread()
where as .then of course isn't
21:21
yeah, .then doing that would make no sense
Hello
@JanDvorak that just shows a lack of commitment on Youtube's part. :)
Yay! There's a bug in a 200+ line SQL stored procedure! YAAAAAAAAY!
-_-
@RyanKinal have fun
@JanDvorak @qwerty Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
21:23
!!welcome qwerty
And it only occurs intermittently! YAAAAAAAAAY!
Maybe I'll just do DI with comments or strings or whatever :/
the async code is 17 lines, the arrow code is 18 lines
@JanDvorak I have been here before :-P
@1110 did it work out?
21:24
hey rlemon, wondering, any idea why this code isnt working? jsfiddle.net/kRtvw/7
nope
but at least you didn't actually ping me
so cheers
@Demorus why ask him specifically?
ya lol
i usually ask him :D
by the way, I learned responsive design, finally!
@Esailija it's not the number of lines, the code is just clearer without all those returns
there is no returns
21:25
@JanDvorak bffs.
@Esailija the async reads like sequential code though - that can be considered a big plus.
@Demorus just use my plugin ;)
so now I adapt my designs for 240px to retina
sorry, I mean all those callbacks
well the code is sequential too, line after line
21:25
you switch indentation all the time by using then
It's a dumb argument though there's no choice really. Promises beat callbacks and async isn't available any time soon.
I'm not saying it's bad
just that it's clearer
@BenjaminGruenbaum yeah true
@Esailija nested callbacks create pyramidal indentation. then is much better, but async is even better
@rlemon checking it out
21:27
well throw in error handling and parallelism
@Demorus i'm bad at explaining shit in blog posts... sourcoder.blogspot.ca/2013/01/…
but you can try and follow it
@JanDvorak the problem with nested callbacks was never the 'pyramid of doom' (seriously, you can just not use anonymous methods and it's gone).
@rlemon by the way. Im about to learn about javascript nodes
it's really really easy to miss out on parallelism when using generators
you wait for all the requests before starting proceessing even though they can be processed in parallel
@rlemon sure, I will.
21:27
The problems are as Petka says that you need iteration constructs (like what async.js does) and error handling (which is hard to get right on callbacks anyway)
@rlemon Ha "sourcoder" I get it :-D
@BenjaminGruenbaum yeah... but you basically end up with goto handleResponse; handleResponse: ...
@Esailija you don't wait for all the requests with callbacks either - it's not even ugly. It's mainly the error handling.
sour coder xD
21:28
for example this code misses out on parallelism gist.github.com/jmar777/62369db022a7a99ca7d9/#comment-958917
@JanDvorak not really?
rlemon.ca <- this tagline is intentionally left almost blank.
I was torn between that and about://code as a tagline
@rlemon is that also you?
@BenjaminGruenbaum named callbacks are basicaly just asynchronous GOTOs
ok it is haha
21:29
@BenjaminGruenbaum no it's really easy to just call Task.WhenAll
i think about://code is a clever tagline for a programming blog
@Esailija In C# it is :P
@JanDvorak no they're not?
find me 10 examples that use WhenAll I guarantee 90% of them miss out on parallelism
@JanDvorak anonymous callbacks are too in this case
I miss goto's
21:30
Not any more than other code I mean.
@rlemon I use them in C, feels good
I love named callbacks anyways, be they goto's or not.
@rlemon now that is a good tagline :-D
@rlemon Come to C#
if you want parallelism you must never yield
user1596138
21:30
@rlemon I will destroy you.
@Esailija I use WhenAll all the time, it never misses out on parallelism. C# has pretty good non blocking I/O constructs now. Tasks are like promises. Also, let us not forget C# is multi threaded.
@Jhawins you love it!
user1596138
Oh god!
I bet that was the first legitimate rickrolling you've had in a while.
@BenjaminGruenbaum I mean, sometimes I end up with named callbacks chained in such a way that a gotolist is the best model for the mess.
21:31
So even your tasks are blocking one thread when they're doing their yielding or whatnot, all I/O can run on a separate thread.
no I meant local parallelism in the generator
user1596138
This DBMS/CMS /all these other changes are supposed to launch tomorrow! It's thanksgiving. I will be 2 hours from here.
@JanDvorak If your point is that it can get really messy really fast - I can't say I disagree.
say in a generator you get 10 website's contents and parsethem
I like how that video, and all of the moon landing conspiracy videos, all got way more views than each of the actual moon landing footage videos combined.
21:32
@Jhawins well, you had a staging environment to deliver first, right?
user1596138
Automated release === Fuck!
Fun fact - I actually do that but with hundreds of thousands of pages.
@Shea do you have a link to the original footage?
user1596138
@FlorianMargaine Yeah, but it isn't a perfect mirror of the real system. Also I didn't have a lot of data until this week, so the only actual testing has been in the last 4 days.
if you used yield WhenAll then you missed out on parallelism
21:33
@rlemon jsfiddle.net/pk9aG/11 works fine even when applying overflow:scroll or auto to your body
user1596138
It's not going to work flawlessly and nobody else here even knows what <br> does.
@rlemon im wondering how come your script works?
2
because I'm awesome
db.Urls.Select(x=>x.UrlString).AsParallel().Select(DownloadUrl).Select(CsQueryParseUrl).WriteOutwardsSomeplace();
21:34
I always wonder how my scripts work - when they work
user1596138
Boss just asked me if he could call me with problems tomorrow. No, you can't. It's fucking Thanksgiving and there's no good reason to do this tomorrow.
@Jhawins that, I can't argue with.
There's also original CBS coverage here and here
tomorrow is going to be great.
@Shea thanks
21:34
most of our clients are in the US
no support calls :)
@Esailija that's usually the code. AsParallel() is smart enough to do a producer consumer on its own so it pipes the urls onward into the parsing without waiting for all of them to download first.
np
user1596138
Yeah, I'll take exactly 1 phone call for work tomorrow. After that, "Guess I don't get good reception at the farm"
OOOO, I have an idea, can Bluebird do that for me (pretty please?)
but that's not generator code.. you can do that in any where
21:35
That'd totally kick ass in Node
well I literally just did that in the gist I linked
> /watch?v=kXhy7ZsiR50 This is the real first moonwalk!!
lol (it's Michael Jackson)
you may notice that it's not even useful to have the generator there
@Esailija no - that's not automagic :P
the code would be simpler if it didn't even use generators
@BenjaminGruenbaum it's equivaletn except you don't even have to call AsPArallel()
21:37
Not really :
user1596138
I'll literally just be eating and shooting things all day haha.
// mine
db.Urls.Select(x=>x.UrlString).AsParallel().Select(DownloadUrl).Select(CsQueryParseUrl).WriteOutwardsSomeplace();

// Yours
db.Urls.Select(x=>x.UrlString).AsParallel().Select(x=>DownloadUrl(x).ContinueWith(CsQueryParseUrl)).WriteOutwardsSomeplace();
The .Select... .Select bit doesn't wait for everything to map, it does producer consumer queues automatically.
@Demorus http://jsfiddle.net/rlemon/kRtvw/8/ ok so why yours didn't work and a few tips from rlemon:

1) you cannot kill overflow and still expect to be able to scroll in all browsers. I couldn't in Chrome. so the button never appears.

2) you were animating scrollTop for the wrapper element. This needs to be done for the body and html elements.

3) custom scroll bars are a bad idea. not all browsers allow them, and different OS's do scroll bars differently. Best to let the browser / OS decide how the scroll bars look.
@Esailija just saying - being able to do that would be pretty boss - since like you said there is no good reason to wait for all of them to finish first.
it does not wait for all to finish at all
21:41
Neither of them waits. Only the first one is more expressive.
if you wanted to obfuscated asynchronity you can make asParallel() that returns a proxy that does the same thing
What? What's obfuscated here? It acts as expected in both cases..
but point is that neither code gets any benefit from await/async.. if you expressed that as naturally with loops and awaits it would not be as parallel
Of course, async - await doesn't help you at all if you want to parallel multiple things, that's why WhenAll (which like I said is kind of like Promise.All) exists.
fuck you online banks... can't you figure out how to properly handle my browsers back button by now?!
21:45
We're past that - I want to be able to have .map() chains that don't block in Bluebird now ^^
what do you mean not blocking
Currently, what's the flow of: promiseCollection.map(firstMapper).map(secondMapper) ?
do you mean the promise method map or array method map?
Do elements that finish passing through the first mapper get passed to the second even if not all the elements returned from promiseOfArray have passed through firstMapper?
@Esailija promise
yea that waits for the previous to map fully
21:48
I know, I RTFC'd ;)
but you can use array map if you want in parallel
Yeah, but that'd be more like the second solution I had. I just said it'd be cool if I could do that more easily since this is essentially what people usually want when they chain maps.
yep I even freed one bit a few days ago
so it could be done
21:51
Ah cool lol
there is room for a free boolean now
From the bit map
if you read the code there is "shouldDefer" in .map
in that case it would mark the boolean that it is shouldBeDeferring
and it defers if user doesn't call another .map next
(or some other method that can pipeline)
21:53
I have a bunch of .then(success, fail) by the way - thought I should let you know that. Probably over a hundred of em
Also a bunch of new Promise(
you can .then(success).catch(fail)
They're just a part of the migration process of course - a way to bridge to callbacks until the porting is complete.
.then(success, fail) fail here doesn't catch errors in success
but most would expect it does
I wouldn't. The current behavior makes more sense.
<3 promises.
21:55
anyway is there some other pipeline function other than .map?
it sounds like 30 minute job to implement this..
ok maybe not D:
so .map and .filter
I will also make a new category for those
"Pipelining functions"
what do you think?
or something
Technically, a form of the other collection methods would be useful but only if they work.
21:57
parallel functions?
That is, if I .map(..).some(..) and only one promise made it through map - if it matches the .some(..) I want to know.
(Of course, I think all this should be opt-in if you add it)
Pretty much all the collections functions can benefit from this, but only .map and .filter take collections and return collections one at a time afaik.
Of course, a cancellation token backwards would be super sweet (If I'm doing .some after two .map calls and one promise made it through the two maps and caused my .some to resolve, I might not want the rest of the promises to even get to the second map. That's a might though, it's just something that's a) somewhat common and b) pretty hard to implement from userland.
In C# you have a cancellation token - I guess a Promise.CancellationError can work here and that it's good enough.
The problem is - how do I cancel the second map midway if I don't have a reference to it - C# doesn't give you a good way that's not closures and breaking it to two promises. TBH I don't see a good one either.
ok good stuff, finally something major to implement
btw .some is not anything like Array#some
it's like .all except for N number of promises where N = .length in .all case
.all = waits for all items to fulfill
.some = waits for N items to fulfill
.any = waits for 1 item to fulfill
@Esailija oh yeah, I mixed some/any . I did that in real code twice today too ^^
22:15
@jAndy bs, lions have like 4 mates
Ok...
@Esailija shouldn't you release v1.0 before implementing those?
!!afk signing my life over
@Shea Just go already!
@FlorianMargaine why
@CapricaSix bitch
22:16
because v1.0 means people can start using it
it's just a psychological barrier that you'd get rid of
it means: it's stable, you can use it in production
do you see the irony
node itself is not 1.0
:D
didn't IP start essentially at v4?
22:17
hm, no?
and I don't want to waste a 1.0 .. in major version change one can make backwards incompatible changes
if I have no such changes then it would go to waste :P
major version change could also mean a major rewrite
@Esailija 1.0 mostly means: "it's out there" to me, it's not really related to backwards incompatible changes
yea but I mean as the author you can make whatever changes you want in a major version
but I don't have such changes in mind atm
1.0 = first public release
22:23
@FlorianMargaine "passes all the spec tests on all browsers, as well as whatever online tests I could throw at it" means a lot more than "it has a 1 in front of it" to me.
if not counting benjamin it's in production use in at least 3 companies..yay
that I know of
also some moderately popular node ORM switched to bluebird
that could mean more...
Site says they use when
ctrl+f for bluebird
Ah, they need to update that page then ^^ they have references to when too.
new Book({'ISBN-13': '9780440180296'}).fetch({
  withRelated: ['genre', 'editions']
}).then(function(book) {
  console.log(book.related('genre').toJSON());
  console.log(book.related('editions').toJSON());
  console.log(book.toJSON());
});
22:26
yea I noticed lol
ORMs for node need to start being able to generate schemas from DB.
JSHibernate
I don't see any when
@FlorianMargaine when.js is promise implementation.. it would also use same syntax
as in .then
ah yeah
I thought he meant the method when in the examples
22:28
@Esailija ?
@BenjaminGruenbaum we need JSHibernate :D?
like NHibernate and Hibernate
but for JS
let's call it Jibernate
Ah, lol.
Proxies totally fix half the problem though.
Follow the trail and use an existing solid SQL driver, support .map (projection) .filter (where) and .reduce (aggregation) and add plurality. Stuff like .sum .count etc would work nicely too.
Overall - it'd be really nice, but totally too much work and not interesting enough to code :P
db().Users.filter(u=>u.Posts.Subject.contains("fubar")).map(u=>u.Name);
This wouldn't be impossible, but would be very hard to get right in JS
(with proxies I mean, this can also be pretty fast since once you compile the query once you're rather solid)
user1994804
Hi everyone, Im pretty novice with PHP and XML (I know just enough to be dangerous ;) and while following a couple tutorials, I built a Pagination system for my existing site but I am getting null returned and I've read about every post on S/O and as far as I can tell all my code is right on with other posts, yet I'm still gettting null
user1994804
Sorry, getting null from responseXML
user1994804
22:34
I'll create a fiddle...
user1994804
Actually... I don't believe a fiddle would suit
user1994804
I am working with 2 php files but my issue is JS related I believe. That's why Im posting here
user1994804
Maybe you guys can do something with:
user1994804
I am getting a 200 from the AJAX query
user1994804
if(xmlHttp.status==200){ //200 confirms the request reached php and came back successfully
				try {
					//alert('200 returned');
					//alert(xmlHttp.responseXML);
					ads = xmlHttp.responseXML;
					results_box.innerHTML += "Status 4: Request Completed Successfully and Response Ready<br>";
					results_box.innerHTML += ads;
				} catch(e) {
					alert(e.toString());
				}
				} else {
				alert(xmlHttp.statusText);
			}
22:38
Eww, ads
user1994804
If I uncomment either alert, they both alert but the second one only shows "null"
user1994804
No...
user1994804
Thats my shorthand
user1994804
for current widgets
@YourAdrenalineFix try alert(xmlHttp.responseText)
user1994804
22:39
@FlorianMargaine I have tried that
user1994804
Thats how it was from the tutorials
user1994804
but this is a hybrid now
user1994804
beyond the tut's
user1994804
and im stuck
so reponseText is null too?
22:41
@YourAdrenalineFix was that tutorial inside a site called w3schools? If so - that might explain a thing or two.
user1994804
Wow
user1994804
@FlorianMargaine I just tried the responseText change again
user1994804
and I swear it didn't do this last time
user1994804
Now I seem to be getting something...
user1994804
Gimme a sec to look at this
22:43
Probably a hardware problem then
user1994804
Plz
yeah, some cosmic ray issue I suppose
user1994804
LOL
@YourAdrenalineFix look at the network tab of your dev tools, you'll see what the http requests return at least
Flipped the pixels so that it wrote null instead of some text, obviously
user1994804
22:44
I Love It
hey, there really were some cosmic ray issues for some people out there.
user1994804
@FlorianMargaine Great tip on the network tab
@YourAdrenalineFix also, learn to use the debugger in your dev tools, on the sources tab
user1994804
You guys are all wayyyyyy ahead of me
it lets you inspect variables et al
a colleague at work uses the debugger
user1994804
22:45
I'm still trying to catch a breather to look at what was output
but he sets a breakpoint in every line he wants to look at. If there is a function with 10 lines, he adds a breakpoint on every line.
user1994804
w/out you guys thinking i left
user1994804
I Thank You All Immensely
user1994804
BRB
user1994804
22:51
I think I rmbr what happened when I tried responseText last time
user1994804
I was presented with a TON of undefined offset errors
user1994804
so I ran the other way
user1994804
Rmbr Im novice
user1994804
Now I'm back to all those errors but don't know what to do, All the variables are defined above
user1994804
the line that's causing the errors
user1994804
22:54
Any Ideas;'
user1994804
?
user1994804
(Punctuation accidental)
@rlemon my scrollbar works on al systems (mobile, windows, mac). It is also compatible with all browsers except ie8
@YourAdrenalineFix read the tutorial on MDN on how AJAX works.
guys
you should consider using vw unit
the coolest thing is that with some javascript I even managed to make it work on older browsers. The relative vw unit really rocks
23:15
see ya - happy gobble gobble if that's your thing
23:41
@Demorus check it on Ubuntu + Unity
I can (almost) promise you it doesn't look the same :/

« first day (1138 days earlier)      last day (4033 days later) »