« first day (2049 days earlier)      last day (3122 days later) » 

00:01
Meanwhile, on IRC ...
let pluginOpts; if (plugin) { pluginOpts = 'foo' } arr.map(x => { if
(plugin) { do_something_with_pluginOpts } })
They don't know what they're missing here.
> using an if statement in map
Yeah, immediately followed by 'but this looks crappy'
At least it isn't an if in a filter
It makes zero sense either way.
Jp_
Jp_
00:26
Hello, is someone using Polymer? I'm having problems with the build process. I've just created a new room if someone feels polymer offtopic. chat.stackoverflow.com/rooms/112973/polymer
@Jp_ Welcome to the JavaScript chat! Please review the room 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.
Hi! It's not OT; I've never used it though.
Jp_
Jp_
the build process is changing the scripts, puting a src attribute pointing to an external file that should be generated but I don't know it's not. The files should have the name like <component>.html_script_0.js Have you seen something like it?
You can surely guess the answer to that :-)
Jp_
Jp_
Yeah.. probably this format is very specific of Polymer, but I was hoping that some other library or framework used the same.
00:36
There's a #polymer channel on Freenode btw.
Might be worth a try.
Jp_
Jp_
Hmm.. good to know, thanks.
01:13
export function pdfReportRunner(reportName, data) {
    let reportRunner1 = spawn('node', ['lib/reports/' + reportName]);
    reportRunner1.stderr.pipe(process.stdout);

    reportRunner1.stdin.write(JSON.stringify(data, null, '\t'));
    reportRunner1.stdin.end();

    return reportRunner1.stdout;
}
// Error: write EPIPE
// at exports._errnoException (util.js:890:11)
// at WriteWrap.afterWrite (net.js:767:14)
ohh, wait.. I just realized my problem, I think. I think my other processes is not accepting all the input before it closes..
01:34
*reads message*

export function pdfNOPENOPENOPENOPENOPE
who would downvote this?? imgur.com/gallery/CX9HzJ2
02:03
@MadaraUchiha you are da best
@Meredith if you can dodge traffic, you can dodge a ball
02:44
I'm home :DDDDDD
Hi
Good morning guys
welcome back
@SomeKittens me?
@SomeKittens thanks
@SomeKittens you guys dont sleep
Hehehe
02:55
I'm PST
Pst means?
Time zone
What is the time there now?
It's genius o'clock
03:04
Hi, can i use xmlHttp post requests in js?
@Learning 20:04
@mrlemmer11 no, sorry, those were outlawed at the Council of Trent
Sadly I still know what that is from school
why is that sadly?
Stupid Council of Trent..... ( i dunno what this is actually) anyhow, so in VBA i can use those, but apparently I am using them incorrectly. Thoughts??
During Protestant Reformation, the Church came together to cement the authority of the church
They passed 4 main decrees to do so
@SomeKittens Just wished I had been discussing modern political theory rather than being lectured on something
I did come here to ask a question though: What would "Error: double colon in host identifier" mean when using MongoDB
03:08
I find these interesting
The Council of Trent?
Especially Council of Nicea
Haven't learned about that yet
I'm more interested in modern foreign policies and politics
03:19
Nevermind about the prevoius question, figured it out and it was quite a dumb mistake
Feel pretty stupid considering I spent 15 minutes on it
host::port -> host:port?
03:47
Hi guys!
I need help with childProcess
I have a bash script that I need to run from node. But this scripts requires sudo. How to make it work?
04:06
Hi
How do I use delay() with before("TEXT")
04:26
@AreWojciechowski run node as sudo, or set uid
Knu
Knu
is there a shorthand operator for x = y + x (for concatenation) in an implementation of ES or in a language compiling to js?
something like =+
Knu
Knu
no :) it's concatenation remember
`${x}{y}`
+= works too though
04:31
!!> y = 'h'; y += 'a'; y;
@phenomnomnominal "ha"
Knu
Knu
!!> x = 'A'; x += 'B'; x;
@Knu "AB"
Knu
Knu
I want BA
.split('').reverse().join('')
Knu
Knu
04:33
:)
Knu
Knu
alright I think I am gonna have to do a sweet macro for it
the only problem is the unary operator
@Knu overkill
@Knu which one?
Knu
Knu
+
true
a = +3; vs a =+ 3;
who does that anyway
They're both the same
Knu
Knu
04:38
if I add a macro they wouldn't be anymore
That's... weird syntax.
Guys
anyone tried JsSIP ?
or any other sip library ?
My reputation graph on Programmers :- i.imgur.com/ngqnwi9.png?forcedesktop=1
05:04
@rlemon Hahaha yeah, I've seen that before. It was one of the "I never expected this to be in the title of a Wikipedia article" articles
05:53
Srsly... cut&paste in Excel 2016 dumps the undo stack as a side effect???
...and any operation that removes even a single cell also removes all dependency arrows across the whole sheet, without allowing you to undo that.
Microsoft = Garbage! (just like IE)
But... animated eeeverything
06:21
@Knu there are several unary operators: ~ - + typeof
it would be silly if +10 were not allowed, right?
given C-based expression syntax
are you saying e+ should be banned too? just 2e4
Why allow something that has no effect?
I agree that you shouldn't use it, but it is grandfathered in now
Evil idea: use +function for IIFE, but also return something that has valueOf with side-effects
unary + is a red flag for a code analysis tool, I'd hope
Doesn't asm.js use that to coerce to float?
06:26
you can use it to coerce anything to number
Hello guys
any one can have a look at this question please?
0
Q: route angular js application properly

Kob_24I really dont understand what is wrong with my angular application. I managed to authenticate the application and route users to the login page when they try to access page without authentication. E.g. if a user write in the url localhost/#/adminPanel user should be redirected to localhost/#/logi...

I mean, asm.js should definitely pass all lint tests, right? Right?
yeah, on second thought, + is used a lot for coercion a = +b + +c <-- not pretty but forces numeric addition
@Kob_24 my, that's a lot of code. Surely not all of it is needed?
not vulnerable to the stupid octal problem either (anymore anyway)
if you ever see (+a !== +a) they are checking for inability to parse as number because NaN !== NaN
06:34
@JanDvorak na i dont think that all is needed i will edit my question
@Kob_24 why block the templates? They are totally useless to an attacker, I hope
if they are useful, the public directory is the least of your problems
those pages hopefully use a service or something to abstract the AJAX/REST requests. Those requests actually return the sensitive information. Make the backend's handlers for those requests check auth
so the /public/partials/people_we_are_firing page template is useless, but the REST response for /api/payroll/employees?pending_termination=1 is sensitive. that handler checks, in the server
hmm i think i get what u trying to tell. but unfortunately i never done this before so i maybe need u to show me a toturial on how to do so just to understand it.
@doug65536: Manager: "Dey be stealin' our HTML!" Dev: "But they're logged in..."
06:49
what does this whole mechanism called so i maybe try to google it
@Kob_24 how are you doing the authentication? typically you add a header to each request like Auhorization: Bearer token, where token is an impossible to guess unique value. The login endpoint provides it when you log in correctly
You can't do authentication entirely in the browser. Users have absolute control over the browser and can change variables and overwrite functions whenever they feel like it
you do it mostly in the backend. the frontend just echos back an unguessable token to prove it is really them
@doug65536 my authentication is simlar to this tutorial
super short version: login page gives you a token after you provide the correct name and password, REST requests echo it back to the server when they actually access something of significance, backend checks it only for protected endpoints, by seeing if they echoed back the correct bearer token (backend remembers what it should be for that session)
by avoiding cookies you can have multiple logins, and you have less weird scenarios where one window is logged out and other is sitting there, stale
if u look at this tutorial, its similar to what u are trying to tell .. so i follow the same approach
@Kob_24 yeah, that tutorial looks about right. express makes it very easy to do
06:58
so all my requests are secured, but not the partials pages
yeah, there is little benefit in blocking partials. You can if you really want to, but it doesn't really add security. It isn't hard to get pages out of a browser cache after someone walks away
@Kob_24 As I told you yesterday, that's not an Angular problem
you should be able to go downtown and handout the source for all the partials to passers-by, and they all still can't do anything with it
@OliverSalzburg yeah i tried to serve the app as u said... and i think it was similar to this stackoverflow.com/questions/11910956/… .. but i doesnt work for me
@Kob_24 Yeah, that approach looks like what I had in mind
07:05
true, and there is something am doing wrong...
@Kob_24 How is it not working?
am still able to be routed to partials
Morning all
@Kob_24 Then they're not served by a protected route
Can anyone please place my + sign in the middle of the circle? jsfiddle.net/ej55ac85
07:09
true
Why do we use a g_wordmap and a g_wstr variable: raw.githubusercontent.com/amnond/jscrab/master/lang/… ?
and thats the issue that iam trying to figure it out
@Kob_24 If that weren't possible, no-one would be able to use your app.
Thats taken from a js based scrabble game
@rlemon I am now, what's up?
07:10
@choz Try fa-stack-3x on the circle
@Kob_24 Then post a question about your express code, or show us that code at least ;)
@OliverSalzburg Trying
ok will try around first, if i dont solve it i iwll post a question and ask u guys,, @OliverSalzburg u the best!
@OliverSalzburg Max is fa-stack-2x.. And I am making it 1x so I can measure its not centered when i click on it..
actually this solve my problem.
app.use(function(req, res, next) {
  if (req.url.match(/^\/partials\//)) {
    return requireLogin(req, res, next);
  }
  next();
})
@OliverSalzburg Nvm I got it working :) Thanks for helping
07:17
@deostroll g_wordmap seems to be to check if a word exists. The other one can be used to search for words of a certain length.
@Cerbrus So the data is the same?
Appears to be, at first glance
 
1 hour later…
08:20
o/
Morning
Hi
can any one please tell me where i am making the mistake?
function registerClickHandler() {
  $('#clickme').click(function() {
    setTimeout(function() {
      alert(this.innerHTML);
    },200);
  });
}
this
this within the timeout callback isn't the same one as this within the click handler
I think the handler gets the same as its second argument
ok
Thank you
function registerClickHandler() {
  $('#clickme').click(function() {
    setTimeout(function() {
      alert(clickme.innerHTML);
    },200);
  });
}
this worked
08:29
If you have a reference to the element, clickme, why are you looking it up in the DOM? $(clickme) is better.
I'm also wondering what's the point of waiting 200ms for innerHTML?
i was just checking
bro i m new to js
Nice code then, if it's yours
Given the function name, I assume it's only for testing.
yes
09:11
dat customer request imgur.com/gallery/5MIK9
09:47
-2
Q: Can CSS used in JAVA SCRIPT <script></script>?

Cyber KingstonI want to use getElementById("xxx").style.color = "xxx". With this I want to change some css value. But the problem is when i use this and test all same id with this but it does't effect all id and effects only the first one. Sample code is as follow: <html> <body> <div id = "test">Test</div>

> ...when i use this and test all same id...
What is with that? 50,000 tutorials saying that ID is faster?
It is, because it only returns one element :-D
I'm trying to use jquery to see if I can have multiple id elements
Last time I checked, if jQuery sees a simple id selector, it just run getElementById.
you should use a class like that answer says. Then you can use stuff like .each to process all of the elements of that type, or .eq(N) if you had to select one
09:54
Hint: the browser has no reason to make "getElementsByClassName" any slower than "getAllElementsByID"
Just use querySelecorAll and save the result in a variable. It's not worth the nanoseconds you save by using the "proper" getElementXXYY.
or even just use anything, like thoseThings.text('thing') to set the text of all of the elements selected in thoseThings
Just use classes
Do you mean $thoseThings?
I stay away from hungarian notation
You can do the following.

    <html><body><div id = "test">Test</div><div id = "test">Test</div>
    <div id = "test">Test</div>
    <div id = "test">Test</div>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
    <script>
    $(function(){
      $("div[id=test]").attr("style","color:blue");
    })
    </script>
    </body>
    </html>
Unfortunately it is now marked as duplicate.
09:57
It's bad
don't
@doug65536 It's useful for jQuery
because the type doesn't follow from semantics
<!DOCTYPE html><div id = "test">Test</div><div id = "test">Test</div>
<div id = "test">Test</div><div id = "test">Test</div>
<script>
for ( let e of document.querySelectorAll( "#test" ) ) e.style.color = "blue";
</script>
@William
@Sheepy don't do this
@JanDvorak I don't think it is bad to use. I never use it. (many years ago I had to type out crap line LPCTSTR lpszWhatever all the time). it got ridiculous. I never try to say anything about the type in a name anymore.
09:58
+1 although That isn't IE6 compatible though @Sheepy
@JanDvorak If you mean multiple ID, I don't do that, true. Just trying to say you don't need attribute selector to work around it.
@William Your code should not either. Find an IE6 and try it.
@Sheepy Yeah. You trigger that in jQuery with $("*#foo")
@William if that is okay then stabbing your leg is okay because you can put a bandage on it and go to the hospital
you are not allowed to have duplicate ids
@doug65536 the funny thing is that #test{color:blue} works
so I would argue it is a de facto standard
because jQuery cannot use GEBI
10:01
as Sheepy pointed out.
shooting lions in the head works too, until you miss
@William It is wrong. But the spec also specify what to do when things are wrong, that's why you get the same result on all browsers (in this case, at least).
@William citation needed. Your statement is false
stuffing your bathtub drain with hamburgers works too, it will hold enough water to have a bath
if "works" is your bar, you will have problems later
de facto means in my opinino it works but it isn't supposed to be used that way. Either way it is fun to see the different ways to do such.
@doug65536 the analogy police are at the door. They would like to have a word with you
10:06
You should totally try PHP. It's not supposed to be actually used, but it's fun to make a change.
@Neil again! oh come on
Well, PHP7 finally got a proper spec that fix the variable syntax mess. And totally removed mysql. So I'd say it is finally taking itself seriously.
@doug65536 ;)
is there a simple way to check if mongoDB can be connected from nodejs using nodej's' mongo client ?
The connection issue got found when a database interaction occurs. I want to have it before doing that
@KarelG Yes, you can simply create a connection
10:09
the .connect method returns null if i read the docs :|
3
Q: How to check if MongoDB connection is alive in Node.js

ZlatkoI have an app with MongoDB as backend. When the app is started, I set up the connection and use it later on requests. But if in the mean time my db conncetion fails (ie. mongod crashes), how can I check that on the request time? To clarify a bit: currently I have an "api.js", which does db.on...

oh it returns a promise if i don't pass a callback github.com/mongodb/node-mongodb-native/blob/2.1/lib/…
10:30
how can I check if property is a deferred object ?
as you can see above
if(property === ) // dunno further :(
Check for property.then
that's undefined
Or just cast it to a Promise anyway, Promise.resolve(property)
above coming from chrome console, I already got the object
just want to check if it has only object with property _deferred
What library? Deferreds are obsolete now
10:35
don't worry I found a way out
thanks for help though :)
@Mathematics as a general rule, if you are checking for the existence of a property starting with _ , you wish only pain and suffering
is it still okay to use tables in a situation like a shopping cart?
@Neil already suffering a lot :(
something in me wants to use divs
app.use(express.static(path.join(__dirname, 'partials'),options));
app.all('/partials/*', function(req, res, next) {
  res.status(403).send(
	{
		message: 'Access Forbidden'
	});
	next();
})
10:37
_ means "you don't see me!"
why i am still able to see files in private folder?
@Kob_24 if the server has access, so do you
what u mean? @Neil
@Kob_24 not sure I understand your question.
You make partials folder available to everyone in that way
@Kob_24 that's too late, it has to go before the static middleware
10:40
my question is that i am trying to make files in folder not accessable to public, so if anyone routes to localhost/private/files.html is not able to see it
@Kob_24 it is hidden without having to do anything
you are saying, in effect, if (theyWantMoney()) { giveThemMoney(); return; } dontGiveThemMoney(); <-- you expect it to block the requests after the static middleware already sent it
oh wait ! am stuck again..
I need to check if property is not equal to Object {__deferred: Object}
Is "ghacks.net" some big famous blog?
Don't go there it redirects to Friday!
10:44
1 message moved to Trash can
@Mathematics Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
^ we need that in C#
@AwalGarg you have been lately reading about lots of hacking isn't it ? Oo
@Sippy you can borrow it...
@Kob_24 You realize the order matters, right?
@doug65536 so u mean if i write tex app.all('/partials/*', function(req, res) {
	res.destroy();
}),, am i for example blocking the request
?
I don't read ghacks.net. But a project of mine is receiving lots of hits from that site, so was just curious...
10:48
it mysteriously doesn't block it right now, right? try moving that 403 sending route up so it gets run earlier. at least before the static middleware
no it does not
the whole app.all...
yeah i got what u mean pout the whol app.all before the express.static line
let me try it
ok! u the man

« first day (2049 days earlier)      last day (3122 days later) »