« first day (2439 days earlier)      last day (2734 days later) » 

00:00
@BadgerCat everyone has abs, silly
@Shmiddty yeah, but like not hidden under layers of fat
looking for material for the spank bank? ;)
cheesegrater abs
I weigh 220 now
fatty boobalatty
@Shmiddty yeah
I like stars on github and abs
00:03
seems legit
Open Source Abs
ok bye now
abs? pfft, only noobs play with assists on
abs prevent skidmarks xD
00:16
i weigh 165.3467lbs
or 0.02 elephants as the Windows 10 calculator tells me
@Luggage s/based client//
i wonder what hate driven development would look like
UI elements that inch away from your mouse randomly
aria text which just abuses you when you put it through a screen reader
hi, is anyone here willing to help with a js problem of mine?
@RichardMišenčík Welcome to the JavaScript chat! Please review the room rules. Pleasedon'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.
click handlers that drop every fifth click leading you to question your sanity
00:37
@derp I once saw a script that'd delete a random DOM node every 30 seconds.
that's pretty evil
but not evil enough
if it was a form they needed to fill in for services and forced them to reload and type all their data in again
now we're talking
maybe throw in a dark bakground and a completely white overlay on mouse move
Mismatch the name and id attributes of the labels and inputs, then stretch the labels so they invisibly cover the inputs
hmm i'm playing around with jsfiddle
and i need to make a synchronouse setTimeout
to block the event loop
isn't setTimeout async by nature?
If you block the event loop, you're blocking everything on the page. This means it's completely frozen
So there's likely no built-in way to do that in the browser. They'd be building in a foot-gun.
00:52
setTimeout is non-blocking
yes the aim is to block everything
and then make the user wait a random amount of time before they get their browser back again
and attaching it to the mousemove event
i also want to give them a microsecond flash of #000000
Check if this does what you want:
function xx(){
    console.log("start!");
    var start = new Date().getTime()
    while ((new Date().getTime() - start) < 20000) {}
    console.log("About 20 seconds of frozen eventloop")
}
@bigblind Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
Whoops
ah nice
01:05
On a completely different note, how would you help someone on Stack Overflow, when it's clear that they need to learn about a lot of things in order to achieve what they want?
As a concrete example, I'm trying to help out the answerer of this question: stackoverflow.com/questions/44641580/…
depends if they want to learn or if they just want the answer
I can't just give them the answer, that'd be a book.
So for example in this case, the asker seemed to think that $.get redirects the user. They also weren't clear on the whole client-server model of the web. What they want, is a progress bar on a pge, updating based on the progress of a long-running server process.
So he'd have to know the basics of how the web actually works, updating a page using AJAX polling, running tasks on the server in the background, or in a worker queue of some sort, ...
There's a whole bunch of concepts envolved in explaining htis answer, that the asker clearly doesn't grasp
at that point, i usually revert to giving them links
ie check out these things
its helpful to know what terms they need to google
@derp eval(b='for(c=new Date;new Date-c<c%1e3;);setTimeout(b,c%1e3)')
01:14
Are dates converted to integers when you use the modulo operator on them like that?
Ah yep, looks like they do
dates are stored as ms
.toString is special on them
hmmm okay
so the eval will block the event loop until it returns
no that script is just a golfed 'lag' script
run it in the console here and then scroll up and down the chat a bit
Does eval create its own scope?
It took me a while to understand the whole thing, because I forgot setTimeout accepts a string of code
@monners no it doesn't
the b="..." expression just assigns the code string to b. But an assignment expression returns whatever was assigned, so that's also the argument for eval
01:18
Makes sense
And the code that's being eval'd just uses whatever's in scope of the call to eval AFAIK
I'm like 90% sure eval takes the parents scope
Yep, according to MDN, that's unless you call it indirectly
starting from es5, if you do var foo = eval; foo("2-1");, that call will have global scope
01:36
people make such stupid hoisting mistakes
does anyone here use surge.sh? I can't seem to connect from work and I think it might be my proxy
A K
A K
given an array of objects, how do i filter through that array and return array of filtered objects, but 1 property is removed?
never mind, figured it out; it was using filter and then mapping
i'm so stupid; i failed an interview today that was about filter
02:25
in the dom/html is the viewport only the full window? or do many elements such as a div or canvas or svg have a viewport?
02:36
i think svg has its own viewport
A K
A K
hahaha, i just killed an api
rest in pending
A K
A K
being petty has made me a better programmer lol;
wait was this the small startup who didn't reply back to your technical assessment fast enough?
A K
A K
they still havent replied :(
i have nothing better to do :(
02:44
If message someone in this chat room and they are not around will they still get the message?
A K
A K
3 different places all asked me similar questions
serialize and deserialize a binary tree or tree
first time fcked me over, 2nd time, i wasnt expecting from a small seed start up
and 3rd one, i got it today again and solved it but ran out of time to debug;
i really hope that those were places which needed to do that on a daily basis
A K
A K
they were data driven, so i can see that; but the 2nd didnt' make sense
they did something about contract laborers
have you worked with graphql derp?
not yet
A K
A K
02:48
oh, i've been trying to figure out how to approach authentication with it and there's different opinions in the community
meh; my only real last hope is if this start up closes A round
if they dont close it, they dont have any money to bring me on board :(
@Arrow yes, they get a notification
nice
I'm finally learning to drive.
good job dude. But they have uber now
I can't take a uber to college everyday.
02:55
don't they have a bus, Ucla has busses
A K
A K
busing is cheaper than owning and driving a car
especially in la
I'm not in LA.
so true
Hyderabad.
Public transport sucks. The bus stop's half a mile away.
why deprive yourself of the death defying thrill of cycling to college each day?
02:57
@littlepootis What is that, a 10-minute drive?
ya you are going to need a tank
@derp Good luck cycling in a city like this.
I heard China is building the silk road, should be traffic free
There are very few bicycle-only paths, and it's impossible to cycle on regular roads.
nah all you need is lycra
like a full lycra body suit
and then channel the wrath of the fashion gods to pierce a way through the traffic
A K
A K
03:00
just bike
biking is so fun
It's not that you can't pierce your way through, it's that you can't ride fast enough.
what about painting the bike red?
And lane discipline's non-existent, so you could expect to get hit once a day at the least.
its scientifically proven that red things go faster
A K
A K
put flame stickers
that adds extra horse power
03:02
@derp that would explain my bowel movement
if its dark red....RUN to the hospital
@KendallFrey 20-30.
3.1 miles
you said half a mile
no dude dark red would mean he is having a period
Half a mile to the bus stop. 3.1 miles to my college.
03:04
an ass period
I assumed you were talking about the time it takes me to get to college, as a half a mile wouldn't take 10 minutes if you're driving.
twas but a humourous dig
there's only one way to settle this
...pistols at dawn
although given that you two are on different continents and have different times of dawn...those are going to be some big ass pistols and one person is going to be shot hours before the other
I need an idea to protect session data being sent from a node server to my friendly ajax/javascript. I was thinking of updating the cookie with an encrypted random id - on every major action - (I'm loading a page - as opposed to updating an item, I'm making a purchase) etc. but I wonder if that could have performance issues
I'm new to the whole - "secure my session" thing
you will need an encrypted token
think about using a jwt library
03:18
TIL my city has more muslims than all of USA.
I was reading up on JWT the other day - what do you think about it?
I think it's the standard for authentication
@littlepootis my city has more Americans than all of China. The comparison is not very useful
ok I was reading up on it and the express-jwt and it's client side library equivilant... (too lazy to type name) - what if I want to use a diffrent "secret" for each authenticating app?
can an identifier varable like appid: blah-blah-blah be sent with a secure payload but uneffecting the payload
you can use OAuth with Google or Facebook etc... and let them take care of that logic for you
A K
A K
jwts pretty solid for handling secure tokens
everyone has either a google or facebook account
03:27
> The comparison is not very useful
A K
A K
its easier to let them ahndle it lol
But I think I'm better than Google or Facebook - LOL.
right, you could have come up with a better example.
A K
A K
then you're liable for security issues
if you get breached, you have to deal with it
lol ya that's what she said
A K
A K
03:28
if facebook/google gets breach, its their fault
nothing lies on you
I'm trying to secure an api - how did we get to "google" or "facebook"
A K
A K
youre dealing with authentication right?
that's for user authentication - I need to autheticate where the requests are coming from before I can authenticate a user.
you can use their tokens to authenticate your sessions
Which would be a hybrid - use google, facebook, or your email/passphrase (they are all linked to your account anyway)
I have to issue "tokens" based off a secure secret - yes? What if I want to use a diffrent secure secret per app. Kind a like: This came from desktop, this came from the admin console, this came from xyz third party snazzy widget.
Similiar to how Facebook security works.
here's the worst question to ask: Can I do that with JWT?
03:32
Well facebook auth tokens are a little retarded. However, with Google you can generate as many keys as you want.
yes you can do that with jwt but be prepared to pull out some hair
put and pull hair out... sounds like I won't have any losses
lol
do it have fun, learns something. You can also look into passport
I suppose the easiest thing to do is require a hash to be generated of the payload using the app.id and the app.sharedsecret and test the hash myself. but that doesn't really authticate a javascript app - unless it's requests through a server side "wrapper" which would proably help protect an app through CORS
domain javascript - sends commands to self server script which forwards request to server. no handshaking of tokens or secrets on client.
googling passport
However, I am not sure what you're setup looks like, so it's hard to say what would be best for your situation.
Eventually, I want to use this account api with all my app api's to help unify the experience - prevent multiple user registration.. etc. Give users access to one place to change user level data, payment info, etc... even though they may use google or facebook or some other provider to "Say hi" to the server - I still want a unified experience for the customer.
I'm still developing. But I got one app that has a API and a Web App (web app uses ajax to api). But I want to move user's, payments, etc... to it's own API. So any app I create can use the same functions.
Big reasons - I want to move notifications processing from my server - to it's own a app/server. So it can do all the socket processing, apple and android stuff...
03:42
I think your problem scope is too wide. You need to narrow objectives
I won't disagree with that statement.
I'm doing a lot of thinking - because I've been in dev shops where their was all action and no thinking. Products died and customers were lost because of dev's coding themselfs into a corner not preparing for high use and new features.
I'm trying to plot a design approach that says: "I'm preparing for the future" and one that can battle with the big boys.
I want to launch a real cool product idea but I would hate for the more wealthier competitor to find ways of making my life miserable and squishing me like a bug: ie hacks, poor performance, inability to make quick adjustments.
Well, there is no perfect solutions, technology and methods are always changing. Change what you can to meet the demands as they come. Early optimization can also lead to problems. You build for demand and fix the bottlenecks
Your design approach seems very different than those who've scolded me here in the past.
lol.
I suppose the easiest way to offload user processing is to just make it it's own set of objects (which I'll do anyway) and offload them when it is needed. At least this app has a very small set of simple objectives... you should see some of my more adventurous ideas.
So is JWT actually secure? If it's used client side?
if one bottleneck accounts for 70% of performance, no reason to spend time optimizing peripherals that have no impact.
it's secure, but pick a package that will manage it for you like passport
the problem with using most of those packages is they rely on MongoDB
03:56
does <svg> really only use absolute units only? in other words, I have to specify an absolute height/width like 500px? I'd have thought the positioning would be some relative coordinate system like -1,1 or 0-1/ . that way if my <div> is 500px wide than 0.5 would correspond to 250px..
or a free flowing NOSQL database - and I like SQL... specifically because my host has huge replicated servers with unlimited storage... I emphize that last part.
I should rephrase - I won't be billed for that kind of storage. :D
I'm sure they scolded you for coding standards and best practices. We are talking about architectural considerations in app development.
04:10
OHHHHHH! So the token is just an authentication key created by the server and used to authenticate to a requested api function.
JWT doesn't require a token be generated for each payload - it just needs to be provided to a payload. So in theory a payload doesn't need to have anything to do with a user, it could just authenticate a session. If a user logs in or not just depends on how the session goes.
so a path could be Webserver requests token from API server, token is stored in hidden field for client ajax calls to API Server. The API server can than determine to change the token (by sending back a request to change) or invalidate a token because it has expired. The issuer is not the client, it's the API server.
If anybody can follow that, kudos.
Does this idea make sense? Is this a good idea? In theory, steps to authenticate include "generate machine id" (client id), "get session token", and use token for all requests. Everytime the API is called it can check the session token against the machine id and other unique identifiers - whatever it wants - to help verify the session is authenticate (or as close as a webserver is going to get).
ya seems standard, client can also ask to renew token close to expiration
with a request
coupling this with SSL will help ensure data can't be intercepted. However if a hacker gets access to the client machine, and can run API calls through the validated browser than I suppose he or she could get access. I suppose that is where rate limiting, CORS, and ClickJacking preventive measures are needed.
both with the API and the Ajax Client
at that point it's browser security and user no point in worrying about that
If a token expires, the session data associated with that session becomes inaccessible (or purged depending on how lazy I am) the client just askes for a new token. I could also track sessions being created per "machine id" and prevent multiple active sessions. Using a UID, I could make that a app specific pin. If an app askes for a new session token, I'll expire the old one automagically.
Unless nefarious hacker is using a self built app that cares less about browser security.
04:27
data can be stored in session storage, cashed, local storage etc and managed by the client
I'll probably need to keep an eye out for problem sessions - luckily I'm offloading all my payments/charges (and there liability) to xyz secure processor (we all know which one). So I at least don't have financial data to secure but I do have my product and to me it's worth more than financial data.
I'd prefer to keep session data away from the client and make it the server's responsability to maintain and protect that data. I just want the happy client to do it's business not caring about some arbitrary id.
as my boss says true dat, peace
@Arrow thanks for the help and the voice of reason...
Now to attack my keyboard with relentless fingers of fury.
\o morning
whats with free bricks?
for the wall
04:42
where do i get my free bricks
“We build too many walls and not enough bridges.” - Isaac Newton
so the bricks are for the wall not bridges?
what's the standard for when a API wants to request a client to something - ie, renegoate session
1 message moved to Trash can
@JustinKaz Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
04:54
what I'm trying now is
1 message moved to Trash can
@JustinKaz Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
	"api.request": {
		"name": "handshake",
		"type": "get",
		"local": "/stateless/handshake",
		"must": true
	}
I hate that thing... its official.
name being the common name of the function, type being the http verb (maybe verb is better), local just being short for location, and must is just the api's way of saying - it's not optional.
Til
to remove '.' from a sentence
(Buffer.from(sentence, 'base64')).toString('utf8');
what's a sentance?
apparently node just ignores
things beyond the encoding
weird.
A K
A K
04:59
a sentence is a series of words that ends with a period, exclamation mark, or question mark
it usually has a noun, verb, or pronoun
05:43
am i doing it right guys? here my client side

$(document).ready(function(){
var socket = io();

// //understand button
$(".understandbtn").click(function(){
//reset the timer every 3 second of interval
$('.actionBtnFloat').css('z-index','0');

//e_money
var deduct = 100;
var newMoney = {{user.e_money}} - deduct;

// send a message to the server that the e-money value has changed
socket.emit('update e-money',
username: getUserName(), //get the current user
newMoney: newMoney );

//end

clearTimeout(interval);
but it keeps me an error on the console of chrome that says
Uncaught SyntaxError: missing ) after argument list

on

socket.emit('update e-money',
username: getUserName(), //get the current user
newMoney: newMoney );
dont ya hate it when youre following a tutorial and none of the steps work for you
@hsimah hahahahahaha
lol
hahahahaha
05:52
this one is pretty good for an intro to react
but its old, so a lot has changed
@TheGinxx009 are you sending objects? It would be something like {username: getUserName()},{newMoney: newMoney}
yeah im sending an object
well thats your syntax issue
so can i do it like this

socket.emit('update e-money',
{username: getUserName()}, //get the current user
{newMoney: newMoney });
yes
05:55
@suraj i'll try this one thank you :)
is not because im throwing two objects on my socket.emit and only one on my socket.on?
should webpack be a devDependency or a dependency?
@suraj ow so that was irrelevant . hahaha
codesandbox.io/s/mwpR1Wvx9 in this react form i have added email and mobile number validation.website url. when i type backspace i get in console invalid error message. i do not want to error message after pressing back space in empty textbox
06:11
how can I change the value but not reflect that change on UI ?
is this possible ?
are you able to see my code after opening the link ??
can i paste here so that you can paste there ??
please re check this link again.
not seeing any error
06:23
type on any t three fields and check console..
06:39
think this is default code.. I dont see any form..
06:57
codesandbox.io/s/mwpR1Wvx9 please check again ..
@amarghodke you will have to make a check for empty in your validators..
Hi guys
@suraj: i already handling this in handleSubmit ...
07:03
I want to match a word i.e exact word in a string and replace that word from a string
@abilasher Welcome to the JavaScript chat! Please review the room rules. Pleasedon'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.
str="de degree deep de";
output=str.replace(/\bde\b/g,'');
but in the replace is is possible to use variable?
Making a proper image capture of Current screen using jquery Or PHP
0
Q: Making a proper image capture of Current screen using jquery Or PHP

abilash erI write some code for to convert svg to inline svg and take screenshot of that div . Please check .Please copy this code int to your local host and test it . Because screen shot is different in different width . https://jsfiddle.net/7bqukhff/15/ <link href="style.css" rel="stylesheet"> <scrip...

@amarghodke the logs are due to handleInputChange
@suraj: i have to set each field validations ??
07:08
yes.. or you need to reconsider validation onKeyUp..
@suraj: what is can use instaed of onKeyUP ??
@suraj
@suraj hi , have you ever done with screen capture or screenshot using javascript or php
@abilasher no not really.. you have put the question.. Someone who knows will respond when they can
ok. Thank you
@amarghodke sry..any way you have to check for empty
07:13
@abilasher Take a screenshot of the client-side with PHP?
Try to format your question properly before spending your rep on a bounty :P
@oliver what you have doubt friend ?
what you didn't understand?
i have a website . In which user can select any svg from the given svg list . When user select one svg then that svg is converted to inline svg displayed in one div . Also user can move that svg to any portion of the div . After everything then user will fill a froum and submit . At the time of submit we ant to download the screen shot of that div then we understand user select which colour , where the svg image is place etc
@Learning sure. Look for RegExp object. You can use that in your .replace
Is hummus made from chick peas?
PHP is a server side language.
don't expect it being able to screenshot your browser
I feel like I'm 8 years old again.. How do I not know this?
07:24
> Hummus, is a Levantine dip or spread made from cooked, mashed chickpeas or other beans, blended with tahini, olive oil, lemon juice, salt and garlic. Today, it is popular throughout the Middle East and in Middle Eastern cuisine around the globe.
see in php we have function called imagegrabscreen . THis can take screen shot . But it only work in windows
"chick peas" huh. I did not know that term
Is there any other method to solve this problem using jquery or phantom.js
@abilasher you want to capture the screen of the clients browser?
@abilasher it takes a screenshot from the server current display UI ... 😐
07:26
That sounds terribly backwards
This is my code which i am using to replace exact word
function replaceAll(str, find, replace) {
        return str.replace(new RegExp(escapeRegExp(find), 'g'), replace);
    }

    function escapeRegExp(str) {
        return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
    }
Consider this is my string : /api/Node-1/{Node-1}/Node-1-1
Now in this string i only want to replace : Node - 1 with Customer
@Neil yes . Please check my question stackoverflow.com/questions/44602309/…
But getting output like this :
/api/Customer/{Customer}/Customer-1
Can anybody guide me like how to replace exact word only
it works ?
just to be clear, what's the expected output
@abilasher hmm, you can extract the ImageData from a canvas, and you can draw a svg on that canvas
07:29
str = "/api/Node-1/{Node-1}/Node-1-1"
find = "Node-1"
Is that sufficient? You then send that data to the server in an Ajax call and the server saves it
replace = "Customer"
Expected Output :
/api/Customer/{Customer}/Node-1-1
Notice in place of Node-1 i have customer
difficult to figure out to exclude only the last one
But it is just a string so why it is not matching exact word i.e Node - 1
Or you could just translate the ImageData to a img tag and let the user download as they would any image on the internet
You wouldn't have to even save it on the server that way @abilasher
07:32
image data to img tag ?
@Learning regex creates a DFA. It doesn't really match by "exact" words. It follows the expression described. What you can do is to split the string using substring, lastIndexOf and then regex ofc
But what if i have a string like this then :
/api/Node-1/{Node-1}/Node-1-1/{Node-1-1}/Node-1-1-1
What's expected output if you use repl there?
(just give the output please, to Customer)
/api/Customer/{Customer}/Node-1-1/{Node-1-1}/Node-1-1-1
This is the expected output for last string
why is the first "Node-1" replaced too ? The others have { and } surrounding
if you put the brackets there too, then your problem is solved more easily. Just add {} to the regex
07:40
Becuase i want to replace customer with Node -1 everywhere
But it should have exact word Node -1
Problem is notice i have Node -1 - 1 at some place
so there also i am getting customer - 1 and customer - 1 - 1
!!> let s = '/api/Node-1/{Node-1}/Node-1-1/{Node-1-1}/Node-1-1-1'.split('/'); s.map(e => e.replace('Node-1', 'Customer')); s
@KarelG "SyntaxError: missing ) after argument list"
@KarelG ["","api","Node-1","{Node-1}","Node-1-1","{Node-1-1}","Node-1-1-1"]
!!afk urgent issue
But this is just generating array
posted on June 20, 2017

All mobile browsers have two viewports. The layout viewport constrains your CSS — width: 100% means 100% of the layout viewport — while the visual viewport describes the area of the page the user is currently seeing. This visualisation of the two viewports might be useful as a reminder. Today’s article studies what happens when these viewports change size. It also studies th

07:56
Can someone explain to me what distinguishes HATEOAS from "normal" REST?
38
Q: HATEOAS: concise description

Myles McDonnellI am trying to get a clear and concise understanding of HATEOAS, and I am by no means an expert WRT REST (I think I get it though, thanks to this http://tomayko.com/writings/rest-to-my-wife) Can anyone suggest an equally enlighenting blog/article WRT HATEOAS?

Nice answer
I would suggest you read the book, "REST in Practice". — Brian Kelly Feb 8 '12 at 12:43
"Read a book" is always a great suggestion to any question :P
08:11
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file prod-env.pem type -1
debug1: key_load_public: No such file or directory
debug1: identity file prod-env.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.5
ssh_exchange_identification: Connection closed by remote host
@OliverSalzburg random error while trying to ssh into my EC2
google results seem absurd
I cannot just restart the machine
08:29
@GandalftheWhite Check your CPU credit balance
Also check the system log through the console
I've seen this for 2 reasons: 1) CPU credits exhausted 2) memory exhausted
2 is usually due to neglecting to set up swap space for the instance
 
2 hours later…
10:29
Any reason why this spread example doesn't work ?
function myFunction(x:any, y:any, z:any):void { }
var args:Array<any> = [0, 1, 2];
myFunction(...args);
@Royi I guess because there is no guarantee that the spread will result in something that matches the signature of the function
As in, the length of the array, not the contained types
@OliverSalzburg This doesn't work either :
function myFunction(x:any, y:any, z:any):void { }
var args:any[3] = [0, 1, 2];
myFunction(...args);
Huh, interesting
I noticed that it also doesn't transpile properly
Typescript needs exact number of parameters. Rest and spread works in tandem..
@suraj But I did specify length
10:39
I tried with rest and spread
oddly it worked
@OliverSalzburg it's from MDN.
^ doesn't work in TS
myFunction(...args):void { }
or myFunction(...args:any[]):void { }
@Royi That's my point. It seems like that "feature" will be added in TS 2.4
hmm
TS is more strict on that btw
Your best bet is to overload the function with one argument that accepts an array
and if size is 3, call that 3 arg function
Hello,

« first day (2439 days earlier)      last day (2734 days later) »