« first day (1817 days earlier)      last day (3117 days later) » 

1:30 AM
How do i open files parallely with await ?
as in the await/async version of
Promise.all(fs.open("pathToFile.txt"),fs.open("NotpathToFile.txt")).then( (content1, content2) => console.log( content1, content2 ));
 
let [content1, content2] = await Promise.all(fs.open("pathToFile.txt"),fs.open("NotpathToFile.txt"));
 
Yeah really ?
so there is no good way of doing it ?
 
I think that IS a good way.
 
i expected something more nicer
but this shall do
 
You don't need more than one way when promises are designed to be composable.
 
1:32 AM
so i will just do
await Promise.all([list_of_promises])
 
yea, if you want to fire off a bunch of concurrent requests/operations.
 
2:19 AM
Oookay softtinks, calm down
 
lol
 
that's a virus
 
That's dell's backup utility
 
@Luggage i for reason expected something like
 
it's actually scraping your hard drive for interesting image/video collections
 
2:21 AM
await (p1, p2, p3)
 
@ʞɔᴉN oh no my porn
 
silly me
 
i didn't say that that's disgusting
 
 
1 hour later…
3:30 AM
URGENT HELP NEEDED HELP ME NOW
should something like Express be listed as a dependency if I am writing, say, a custom middleware module?
I assume that if you use this module you already have express in your app, but obviously if I want to include a standalone example/test server then express would be necessary I guess
nvm I figured it out, didn't need your help anyways
useless wankers
 
4:04 AM
 
 
2 hours later…
6:20 AM
@NullPoiиteя o/
ew @ new codepen
 
@ʞɔᴉN No
It should be a peerDependency but that's deprecated and will be removed from npm 3
 
Is there a way to keep the transform of a canvas ?
Like keep on moving the canvas 1px left ? after every iteration ?
 
So you'd need to rely on the user having express as a dependency.
 
@MadaraUchiha does that even make sense ?
 
@Abhishrek \o
 
user3119231
6:37 AM
morning!
 
user3119231
any way to create a link/url shortcut on home/desktop? -> with js!
 
@Abhishrek nnooo! It's so cool!
 
looks ew to me
 
I really enjoy it
 
7:07 AM
Anyone who can guide me on javascript time stamps? Basically I want to convert milliseconds(coming in ajax's response) to some thing like this format "20-JAN-15 10:02:05AM". wanted to confirm if that will have some interference with my browser's locale?
 
@HumptyDumpty 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.
 
Thanks Oliver.. But unfortunatley I can't use external plugins. But, what would be the default locale that it picks up while carrying out the conversion? Browser's locale?
 
@HumptyDumpty Depends. If you feed a unix timestamp into a Date object, it will be the correct date, represented in the browsers timezone and locale if you don't specify which options you want when extracting information from the Date
 
I see.. Thanks Roel. I should better carry out the conversion on the server side only then.. Thanks..
 
7:20 AM
@HumptyDumpty It is way more friendly for a user to see times in their own timezone, though, but whatever floats your boat. I mean, American time means absolutely nothing to someone in Europe. They can see a time and think "Yeah whenever the fuck that was".
 
@RoelvanUden Which is what I think about half the time I see a timestamp online
Because unless there's an explicit timezone there it's anyone's guess
 
Indeed. Unless you are on a regional site, e.g. for me, a Dutch site uses CET :P
 
Well, you assume they do but what if they don't?
unless they tell you they use CET you can never know 100%
 
Then I'm fucked. Simply :P
 
^SO gets it right
 
user3119231
 
@Maurize Meh, just a sprite sheet :P
 
user3119231
Yeah, but high resolution sprite sheet . HIGH RESOLUTION Y KNOW?
 
@Maurize U MEAN U KNOW NO?
Also, the new codepen sucks!
I liked the old one better
 
user3119231
Yeh, seems like it has some issues..
 
user3119231
7:40 AM
I thought I am the only one
 
user3119231
Would be funny if you make a code like this instead of password: codepen.io/tomdanvers/pen/gaWmMG
 
user3119231
So user have to insert their email adress and then they have to unlock their account:D
 
the circles should move to the closest number when you release the mouse
 
user3119231
yeah fake physics are nice :D
 
7:58 AM
> We couldn't have asked for a better group of students to spend the next few months with. They came from a diverse range of backgrounds and genders - 69% identified as male, 31% identified as female. Each student came to Beyond Coding for a different reason. We met graduates, career changers, self-taught techies, and part-timers looking for full-time roles just to name a few.
(From StackOverflow blog)
Am I the only one bothered by this PC?
 
PC?
 
political correctness
 
You talking about the identified bit?
 
Yes.
There are only two genders listed there that sum up to 100%, and the identified bit doesn't do anything but PC. If someone identifies as X you either find that legitimate or not. Assuming you do (assuming they do), you can just call them by whatever gender they chose to identify by.
 
Yeah, I don't get it either. Though I blame the people that would complain if it wasn't pc
 
8:03 AM
So they could have just written that there are 31% females and 69% males, and it's also not a diverse range of genders.
@BenFortune but it's not offensive even the slightest to just say there were 69% males and 31% females. It's not like they're discriminating anyone here.
Heck, why would anyone even ever think that SO discriminates gay people, transsexuals or transvestites? Or people who identify as X?
 
I am not bordered by it. Identify is a relatively accurate verb here.
 
@Sheepy s/bordered/bothered/
 
Thanks. Yes.
 
function(s) {
  return [].indexOf.call(document.querySelectorAll(s), this) !== -1;
};
what does this do?
 
8:11 AM
@argentum47 what do you think it's doing?
 
I am not sure of the indexOf part .. is it like, get all the elements matching , lets say a className and then checking if e.target is present in the list ?
 
function(s) {
    return document.querySelectorAll(s).indexOf(this) !== -1;
};
would you understand it better like this? ^
 
ah.. I see. ok thanks.
 
the indexOf method doesn't exist on NodeLists
with the call trick, you can apply it on NodeLists though... you take the method on an array, and you call it on the NodeList. It works because NodeLists are array-like.
 
Using Array.prototype.indexOf will save you a new Array.
 
8:13 AM
yeah, that part I understand.. converting nodeList to array
 
no no no, it doesn't convert the nodelist to an array
 
No. You do not convert NodeList to Array. Big difference here.
 
oh, i see
 
it calls the indexOf method on a nodelist, tricking indexOf into thinking it's an array
because it has indices and a length property, so indexOf thinks it's fine
 
8:16 AM
so, because nodelists look like an array, indexOf will happily work on it.
 
IndexOf doesn't care whether its this is really an array. You can look up the spec for its algorithm.
But most (if not all) array prototype functions has been updated to work with any array like object.
So you can also use map, filter, reduce, includes, slice, splice, etc.
 
meh, you have Array.from now
 
Though splice won't work on strings.
 
@FlorianMargaine Performance penalty.
 
@Sheepy .call is expensive too
@KingMob that's because strings are immutable
 
8:20 AM
Indeed.
 
call is less expensive than before now. As long as it is less expensive than creating a new Array and copying over each elements.
 
That guy... Uses bullets points everywhere
 
Wow. Good edit. I don't have that kind of patient.
 
There's a meta post about him specifically: meta.stackoverflow.com/questions/307481/bulletpoints-everywhere
 
@Cerbrus The avatar similarity is kinda weird
 
8:24 AM
Wolves gotta stick together
 
@Cerbrus Quite annoying, but that guy has some amazing answers
 
> High everyone
 
@BenFortune I agree
His answers are awesome, but incredibly hard to read
 
8/11 of his questions are structured the same, with bullet points. As are most of his answers from what I've seen :|
 
1
A: What algorithm should I use for high-performance large integer division?

Spektre[moved from mine comments to be more readable] I do not know the multiplicative inverse algorithm but it sounds like modification of Montgomery Reduction or Barrett's Reduction. I do bigint divisions a bit differently see bignum division especially take a look at the approximation divider an...

Next victim
 
user3119231
 
Something's messed up
 
I got error
TypeError: callback is not a function
But
It's on chrome only
not in the firefox
 
> the firefox
Code?
 
app.service('setUpdateService', function ($http, getAlert, $rootScope) {
    this.set = function (updates, url, callback) {
callback();
}
 
And how are you calling it?
 
8:37 AM
setUpdateService.set($scope.verifiedList[index], 'update', function(success){
        	$scope.verifiedList[index].SM_Verified = success;
        });
 
print the callback and see what it is
 
Full
is there anything wrong ?
it seems not
 
And done with that edit xD
 
You have too much time :P Great edit
 
Every answer of his links (at least) one other answer of his
That has the same problem...
 
8:45 AM
That's quite a feat.
In fact I think I never linked my own answers!
 
Typical mistakes for non-native english speakers: "A little more hard"
Kinda fun editing his stuff
 
Any C# pros? How can I inherit/copy methods from a static class?
Do I just need to create a method and just call the other one inside?
 
@BenFortune I am not a pro, but is it possible to create a delegate type property that initiates to the target method? Keep in mind that creating a wrapper method should be simpler.
 
Yeah, sounds like calling it would be much simpler.
 
9:03 AM
130
Q: Why can't I inherit static classes?

UserI have several classes that do not really need any state. From the organizational point of view, I would like to put them into hierarchy. But it seems I can't declare inheritance for static classes. Something like that: public static class Base { } public static class Inherited : Base { } w...

 
@OliverSalzburg I worded it wrong :P I know you can't inherit static classes, I wanted to know if there was an easy way to reference a method from another static class
 
My answer: Because C# is not JavaScript. Join us. Resistance is futile.
 
it also makes less sense to inherit static anything, no? coz static is initialized once at the start kindof.
damn I suck at technical parts. I say one thing I understand another thing.. :(
 
Yes. But Ben just wanted to reference (copy) a static method.
 
I just wrapped them instead
    public static Bitmap CreateBoostBitmap(MainModel mainModel)
    {
        return OrionController.CreateBoostBitmap(mainModel);
    }
    public static byte[] BitmapToByteArray(Bitmap b)
    {
        return OrionController.BitmapToByteArray(b);
    }
 
9:08 AM
This is also why there is technically no static method in JavaScript. JS has no class - illusion is just illusion - and thus no static method. In fact, JS doesn't even distinguish between property and method. "Methods" are just properties with function values.
However, when you apply the illusion of class, JavaScript is amazing. You can inherit static methods. You can swap out static methods. You can even change class hierarchy on the fly.
 
@BenFortune Ah, I see. Why replicate the method in the first place though?
 
@OliverSalzburg There's another method, which is different to the other controller
It's probably far easier for it to not be static, but it's not my code :)
 
We always declared every method static that didn't reference this
 
user3119231
Tried visual studio 2015 + cordova -> Works like me lazy fuck
 
The author has an MVC pattern going with winforms
Only been using C# for a couple weeks, still much to learn :p
 
9:19 AM
0
Q: What is the difference between Javascript and Typescript?

Kailash PThis may be the simple question, but I am not clear about this two. Can anyone explain the difference between this two?

Downvote... Closevote
Comment, delete, whatever
Just make it go away please :P
 
It is, but this one really should just be delted
I already CV'd as too broad, can't Mjölnir.
If you would type the title of this question to Google instead of SO, with fewer clicks you would have an answer instantly. — alek kowalczyk 18 secs ago
That should be a close-vote reason
 
The duplicate is indeed marked as too board (opps, actually it is opinion based). But I'd prefer duplicate when both are valid.
 
9:44 AM
hello everyone
the .click function doesn´t work in ipad, so i have tryied to use this: $(myVariable).on("click touchstart", function() but it doesn´t work to...does anyone knows what is the function that works?
 
The function, by itself, works. It is other matters. Maybe your selector is wrong. Maybe the time of selection is wrong (e.g. before the elements are created). Maybe some other click consumed your click event. Maybe there is another element covering your target. Maybe it works but your function is not working.
 
if (r == true) { ... } else if (r == false){ ... }
 
Damn I should use bullet points!
 
user3119231
@Sheepy *bullet time
 
9:54 AM
just realised i can replace every instance of _.first in my code with destructuring.
 
user3119231
10:20 AM
just refreshed this page because I thought it freezed.
 
@Cerbrus what's wrong with a submit event :/
 
10:47 AM
github.com/staltz/flux-challenge/pull/1#issuecomment-146090593 sigh Guy organizes a complicated "competition" for front-enders, with proper spec and all, competition gets insta-traction, but said Guy doesn't understand a simple XHR error and can't spin up a local dev server.
 
hi all, looking for help finding a tool/way to easily select a json node and return the path to the node using a dotted notation ex level1.level2.value
 
user5020521
hi guys can anyone tell me what I'm doing wrong? jsfiddle.net/VtxA8/344
 
user5020521
I don't ask anybody to do the job for me just advice
 
@Riccardo990 What's the error
 
user5020521
I want to open a link on onClick event
 
10:55 AM
that's not what I asked, what's the error, as reported by the console
 
@Riccardo990 look at your console logs it says general is not defined
 
user5020521
the error is that fn is not a function
 
@ChoclateLove 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.
 
user5020521
besides 'i' is not a function
 
user5020521
i is not defined *
 
10:58 AM
@Riccardo990 The error is actually 'general' is not a function. You're calling general from the html.
@Riccardo990 General tip: Don't use the onclick attribute of an html element
@Riccardo990 Use document.getElementById('id', function() {}); instead
 
user5020521
thank you @Cereal I'm gonna try it now
 
@Cereal wait, what
 
@Cereal I'm curious what that does
 
@AwalGarg Roaaah
I can't edit
 
11:00 AM
??
 
document.getElementById('id').addEventListener('click', function() {} );
 
If you can't edit, should we star it instead?
 
I just got out of bed
@ivarni I hate you so much
 
user5020521
can I attach document.getElementById to var Link ?
 
T.T
 
11:01 AM
haha, np. was just slightly startled
 
@Riccardo990 I made an error. Check above
@Riccardo990 document.getElementById(id) returns an element for a given ID.
 
user5020521
and that is what I need I suppose
 
@Riccardo990 you can attach a click event with addEventListener('click', function() {});
So, var demo = document.getElementById('demo');
Would give you the demo element in the variable demo
Then you can attach an event listener with demo.addEventListener('click', function(e) {});
Inside the function() {}, you would put any code you want run on click
 
user5020521
so I do replace var div with var demo
 
user5020521
and inside the createAnchor function I pass the div
 
11:04 AM
That bit isn't important. Variable names are only for the reader
they can be whatever you want
 
user5020521
tha'ts true I use them to have clearer code
 
I need to head to work
I'll be back and probably more angry in 30 mins
 
.... whadidisee
 
11:20 AM
Hi, does anybody know about a plugin for Gulp that passes file down the stream and at the same time concats its content to a file (A similar utility for this is called `tee` in UNIX). I mean something like this:

gulp.src('/scripts/*.ts').
// do some TypeScript parsing here; not important
.pipe(passFileToTheNextPipeAndBesidesConcatItsContentToFile('all.js'));
.pipe(gulp.dest('/build/scripts'));

It's very uncommon scenario but I really know why I need this (trus me, I'm a programmer :-))).
npmjs.com/package/gulp-concat-util ... ah! this has a passthrough option :)
 
I'm back
does anyone know if dim computer screens could causem igraines?
 
Just typos.
 
crl
!!s/m\ /\ m/
 
@crl does anyone know if di mcomputer screens could causem igraines? (source)
@crl does anyone know if di\ mcomputer screens could causem igraines? (source)
 
crl
11:31 AM
ah sorry didn't see it catched another match
 
I looked it up, apparently your screen should be the same brightness as your surroundings. If whites look like a dull grey, your screen is actually too dim
!!punched or regular
 
@Cereal punched
 
Hey, it works now
 
crl
@Cereal what kind of migraine is it? If it's sinusitis you can use something like a neti pot
but if it's something else, no idea, it could be a vision problem too
 
@crl Not sinuses. Dunno what kind it is. Every once and awhile, I'll get crippling migraines for a week or two, then it goes away
I mean, obviously there's something triggering it
Dunno what it is
I got feedback that my front end pages "Looked too similar"
How does one remedy that
 
11:41 AM
get a junior to write them
 
crl
put a random different background on each
 
Hey guys,
Do you know if there a way to do something like this in backbone —>

collection.where( {uri : !=undefined } )
 
crl
maybe collection.where(function(o){return o.uri!==undefined}), but I don't know backbone
 
@KendallFrey Maybe I can hire a random indian guy off the street
@AwalGarg Hey you
 
11:46 AM
@Cereal our diagnostic would be less valid than a doctor's one
 
@KarelG went to the doctor, she gave me a whole bunch of sample migraine medication and told me to tell her which one works
lol
 
tell her ALL OF THEM and get rich on the aftermarket
 
@crl Already try this, but it returns an empty array, thanks anyway !
 
@ivarni :o genius
I need more resolution
grumble
 
dafuq ...
is that even allowed ?
 
11:53 AM
Who knows. One of them worked
Found it right after my drug plan expired
\o/
 
could it not be that you have cluster headache ?
i know someone which has frequent periodes of headaches
 
From what I've read, it would hurt more if it was a cluster headache
hasn't driven me to suicide yet, anyway
 
like if all headaches leads to suicide
 
No, I meant cluster headache sufferers have a higher tendency to commit suicide
 
crl
@Cereal you could try the natural way: more sport and more vitamins (fruits)
not been (physically) ill since a while
 
12:00 PM
i have done a test at a neurologist once because i had a month of headache which doesn't go away, despite medicine
he did a scan, and concluded that there were too many activity around <latin name>
 
crl
hypothalamus
 
the only good cure is to use the computer less often (i was an avid pc user back then)
now, i'm feeling good. Didn't got headaches like that anymore
 
Well I work in front of a computer 8 hours a day
 
> You can cut your penis into a vagina mouth butt robot
 
12:05 PM
imgur led me to that ...
// goes AWOL
 
12:19 PM
@Cereal yes kind sir
 
Hi. Has anyone successfully built a Cordova/Phonegap (or similar) hybrid desktop app that uses an NP-API plugin?
 
Not sure why anyone would. Chrome has dropped support, IE used to support it via ActiveX (If I'm correct) but I'm pretty sure ActiveX was removed with Edge
That would leave Safari and Firefox as target browsers?
 
Exactly (and there are problems with Safari on El Capitan). I'm evaluating the idea of bundling the web app, the plugin and the browser in one hybrid app.
 
So you basically need access to more native APIs than you can reach via the Cordova API?
 
meta.stackoverflow.com/questions/307513/… not sure how I feel about this. Isn't this better handled by Github already?
 
12:30 PM
Okay this question might be obvious, but is there a check for a valid string, and specifically for saving to MongoDB. Perhaps the answer is any string. I'm parsing a xls and want to be sure anything imputed can then be saved as a string.
length I suppose would be something to check, but anything else?
characters, etc?
 
@AwalGarg Ruh roh, feature bloat incoming
 
user3119231
so I create an image <img> with js and append src to it. Looks good if width is 100% BUT is there some trick like max-height: 400px to auto scale it? I mean what if a user uploads a img like 200 x 1200? :D
 
I don't have the money to buy rockband 4 on release :(
So sad
 
Be happy you aren't gonna waste money
 
@Maurize You can calculate scaling easily enough
@AwalGarg WHAT DID YOU SAY ABOUT ROCKBAND
 
12:32 PM
I don't know what rockband is, but I said what I said.
 
Found the heathen
 
@ivarni I have a lot of legacy code wrapped inside NP-API plugin, which I would like to reuse. Converting the plugin to Cordova plugin will probably work to, but I wasn't able to find a guide on this.
 
crl
!!work on jsbin or on local?
 
@crl on local
 
crl
clever girl
 
12:37 PM
@Pavlo Haven't done that before either, but I would definetely spend some time getting away from NP-API. It's a sinking ship.
 
Hey @all. Whats the best javascript framework for a single page portfolio site?
 
No.js
 
crl
vanilla.js
 
do you have experience with javascript ? if not, try bootstrap
 
@crl y u no link? vanilla-js.com
 
12:44 PM
but there is not much js involved if it's a single page site
 
docs.google.com/forms/d/… let us register on behalf of Apple and declare that Apple hates devs.
 
crl
@ivarni it's famous enough :)
 
user3119231
@Cereal something like dis shit? ratio = Math.min(screen.width / image.width, screen.height / image.height);
				image.height = image.height * ratio;
				image.width = image.width * ratio;
 
@KarelG yeah about 2 years, but have never built a site without a server side language...
 
@AwalGarg hmm, SO team ... i'm still questioning the "revolutionary" idea
but it's for later. // meeting
 
crl
12:47 PM
@KarelG he meant single page application? so there's quite much js involved
 
@crl yes thank you
@crl what framework if any would you suggest for a single page js app?
 
Since you don't seem to be in a mood of accepting rlemon's or crl's answer, I'd answer "React.js" with "React router".
 
@AwalGarg thank you
 

« first day (1817 days earlier)      last day (3117 days later) »