« first day (1783 days earlier)      last day (3161 days later) » 

6:00 PM
I've never heard of those, interesting.
 
bbl, we can talk more then
 
You'd use that for more than debugging ?
 
6:12 PM
why doth thou torment me so, arrays of objects?
 
fuck I'm losing it here
I run req.login(newUserData, callback); and I can see it being passed to passport.serializeUser and I call done(null, user); inside of serializeUser but in deserializeUser I never get the newUserData.. it just never fucking changes. so on all subsequent requests req.user is not updated.
this is really fucking with me
 
Seems like one of those problems you'll solve in your sleep
 
I don't have time for that
I had planned on shipping tomorrow
 
me too
 
@Goyuso 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.
 
6:20 PM
@BenjaminGruenbaum can I vamp off you for a second?
 
what about meteoric?? Meteor + Ionic
I want to try it
 
user406009
@rlemon Do you have a simple example of your broken code?
 
@rlemon don't ask to ask just ask
 
I don't feel right pinging you randomly with a question if you are busy or don't care.
but okay, how can I implement a middleware function in express to make certain requests bypass passport.authenticate
@Lalaland not 'working' example
but I can give you the actual (redacted bits ofc) code.
 
Hey, does anyone here use d3? I'm drawing a sparkline. When the SVG pumps out, I always want the highest point of the sparkline to map to the coordinate 0 and the lowest point to map to the coordinate 100, and if it's a flat line (like the result of the value for the sparkline) at 0, that should always appear in the center.
Right now, my 0 line is appearing on the bottom, and my sparkline that has real values doesn't stretch all the way to the top or bottom
 
user406009
6:23 PM
@rlemon Nah, I would just keep on putting console.log's till you track it down.
 
user406009
Do a "binary search"
 
@rlemon the simplest ways it to put all unauthenticated middleware before passport
 
@Luggage okay, I'll be honest here, this project is a fucking mess.
if I had my way I'd scrap it and start over
I did so much wrong.
 
app.use((req, res, next) => {

    if (wantToUsePassport)
        passportMiddleware(req, res, next);
    else
        next();
})
I think
 
I have a router path that proxies the fallback long polling websocket requests
proxy.web(req, res, {
    target: 'http://localhost:' + proxyPort
}, ProxyError.bind(proxy, req))
 
6:25 PM
So if my sparkline has values x: 0, y: 10; x:2, y20; x:3, y:0
That would map in the SVG to coordinates 0,50 50,0 100,100
 
this calls deserializeUser
I need it to not
 
Anybody working with Angular 1.4?
simple ng-change isnt working on <textarea>
 
ugh.
lemmy fuck around with it a bit more
I still have like 32 hours
 
user406009
@rlemon You can do it! With enough caffeine, anything is possible!
 
s/caffine/alcohol/
 
user406009
6:27 PM
(Or Adderall)
 
I can be little annie adderall
 
user406009
Anyways, we all know that the first trick to increasing productivity is placing the following in your hosts file:
0.0.0.0 chat.stackoverflow.com
4
 
just close the tab. you can do it.
i've been trying all day.
 
user406009
That's why the hosts file idea is better.
 
@Luggage There's no button to close it... I think I'm trapped... Send help.
 
user406009
6:32 PM
Darn, I miss StarGazer already.
 
nahh, see I help 100 noobs in the hopes that one regular will let me vamp off them
 
Van noob, ah ah ah.
Tvo noobs, ah ah ah,
Vree noobs, ah ah ah
 
@rlemon just like me, then
(apart the helping the noobs part)
 
I just hang around to shoot down Florian's ideas.
 
I'm here because social life.
 
so I take it I cannot mix app.get/post with app.use(path, router)
??
 
sure you can.
 
Huh. So in Edge, you can open up a JS file on a site, edit it, hit CTRL+S, and it just kinda runs the new code without refreshing
 
.use is all methods. check fro get/post inside the middleware and then call next() if it's not what you want
 
function hackingFBI(money, guns, numberOfPeople){
// Your code here...
}
 
6:38 PM
@Luggage I have this:
app.get(path, handler);
app.use('/', router);
app.use('/users', usersRouter);
...
 
YEAH, DECORATORS
 
app.use('/path', (req, res, next) {
    if (!req.method !== 'GET') { next(); return; } //might be lowercase 'get', not sure
});
 
EAT IT, WEAKLINGS
34
A: How to implement a typescript decorator?

David SherretI ended up playing around with decorators and decided to document what I figured out for anyone who wants to take advantage of this before any documentation comes out. Please feel free to edit this if you see any mistakes. General Points Decorators are called when the class is declared—not whe...

 
@Luggage ahhhhhhh
 
Not sure what I am doing wrong here. When I inject a service in my Angular 1.4 code, the ng-change on the textarea doesnt work.
http://jsbin.com/butapateba/1/edit?html,console,output
How do I fix this?
 
6:38 PM
@Luggage do you know gpg subkeys? :)
 
@Luggage ahh, makes sense
 
app.get() is really like that. (sorta)
 
how do I implement typescript
 
@FlorianMargaine No.
 
@Luggage look it up, it's similar to what you told me
 
6:40 PM
@Luggage off the top of your head, does app.use accept regexp?
app.get/post do
 
I don't really know how that works, but you can generate subkeys from a master key... With or without password
 
will do. My idea doesn't prevent copying the UsB key in whole and using it for access, it just allows you to carry around your main gpg private key with a little more security from being abused for OTHER uses.
 
And the messages signed with the subkeys are recognized as such
 
@rlemon docs say yes.
 
@rlemon yes
 
6:44 PM
well fuck that is not going to work, I forgot I needed the user port info
so I can't bypass deserialize user
@DenysSéguret I can bug you now, you've used passport, postgres, and express :D
 
there's no proof
 
30 mins ago, by rlemon
I run req.login(newUserData, callback); and I can see it being passed to passport.serializeUser and I call done(null, user); inside of serializeUser but in deserializeUser I never get the newUserData.. it just never fucking changes. so on all subsequent requests req.user is not updated.
 
what you pass to done() in the serializeUser() will go to your configured session store. That's where you can debug that.
 
@Luggage what I pass to done is what I want to see
 
@rlemon no idea, why do you need to do that?
 
@BenjaminGruenbaum because I fucked myself again and my deadline is friday
 
so now I'm rushing out bandaids
 
@rlemon I don't get it, do you deserialize or not ?
 
Put your middleware before you run passport, and process it directly?
 
6:47 PM
yea, that solution was bunked
it was a wrong idea to solve another problem
 
your session store is likely using cookies. maybe they aren't available on the websocket request and thus you are getting a blank session in deserializeUser()
i had to use some express-socket.io thing to get them to 'share sessions'.
 
!!afk sleep
 
@DenysSéguret okay, let me try to explain this. deserializeUser runs every websocket request that passes through the proxy (when it falls back to long polling, which it often does with our clients) so I cannot (rather, do not want to) get the users from the db every time. the long polling fires like 100 requests in ten seconds. SO, I am updating the user session after I have updated the db using req.login(newUserInfo, callback) and I can see within the callback that the req.user object is updated
however, when I log inside of deserializeUser all I ever get is the original session object
not the updated one
 
Just remove websockets and always longpoll
 
still de serializes every request, and the this is a real time dashboard, so there are many many requests
I would like to not have deserializeUser pull from the db, but I also would like to be able to edit the session values
I would LOVE to have this:
client.queryAsync(querystuff).then(function() {
  // update req.user here and have it actually stick.
});
 
6:53 PM
separate out that concern. Start with querying the db every time and make that work. Then use a local in-memory cache to throttle that down.
 
Oh, I think this is a synchronization issue, then runs too late.
 
@Luggage db every time works
 
Call next inside the promise callback? Where are you calling it?
 
but with a few hundred clients connected it will be slow
 
right, so have deserializeUser() call a "get from cache or DB" function.
 
6:54 PM
I'd just throw memcached in front of the DB or Redis and it'd be super fast, you'd probably need Redis if you ever want to scale out of a single box anyway.
 
I vote redis. you can have those objects expire easily so that you can re-quiery the db once/minute or some other rule.
 
okay. I appreciate the advice. I was really trying to get something done in the next half hour because I have other crap to finish as well. probably will not be possible :/ and I've never done anything like what you guys are suggesting.
looks like it will be a long night
 
well, since db-every-time works, you can probably find some miminal JS expiring cache code online and paste tht in to make it more efficient without getting into redis, etc.
 
just install redis, it's super easy. You just put it there with a key and an expiry policy and get it from redis and if not there the db.
 
getFromCache(userId).then((user) => { if (!user) { return getFromDb(userId); } else return user; })
 
6:56 PM
It's like simple memory access with a callback.
 
fuckit, I'm just doing db every time, moving on, and after I push to the clients I'll spend the first few days next week replacing that with redis
 
using redis for express session data solves other problems, like jsut being able to restart the process without loggin people out
 
because I have like 6 more features to write and I don't wanna be doing this on the weekend.
I was on track then 'found' out that I'm not updating the use session properly.
that and another login issue have set me back about a week
 
GL. Off to do other things.
 
7:17 PM
@AwalGarg I'm trying to play with some darker colours, but everything that seems okayish further obscures the url part.
Other ideas, like making the text bold, are less intuitive and don't stand out as much.
hrm, wha if I make the regular background lighter?
 
@AwalGarg How's this?
 
user1596138
7:37 PM
@Zirak No way. Is this tab search like in ST or Sources when you control+P???
 
user1596138
Because if it is that's really awesome.
 
You know it baby
 
user1596138
Good idea. Think of it on your own?
 
One time some time ago I was gazing at so many-a-tabs that I couldn't make out their favicons any more. At that moment I knew that something must be done.
 
user1596138
7:42 PM
lol
 
user1596138
I start closing them as soon as there's too many to read the titles
 
user1596138
Never have more than ~10 or so
 
That's also a good solution...I guess it can be solved by using something like Pocket. But mouseless (and guessless) tab navigation is pretty nice.
 
does JavaScript (or jQuery) contain a contain or LIKE %'sql'% (like sql)?
 
@KendallFrey @Zirak @SomeKittens @SomeGuy youtube.com/watch?v=h-O3ASU7L4M
 
m59
7:49 PM
// anyone know why this doesn't do what it seems it should do?
process.stdout.pipe(fs.createWriteStream('/tmp/node.log', {flags: 'a'}));
 
!!tell JoJo mdn String.includes,String.indexOf
 
@Zirak Command string.includes,string.indexof does not exist. (note that /tell works on commands, it's not an echo.)
 
@Cap
 
@rlemon Idon'twanttoliveonthisplanetanymore.gif
 
@rlemon wtf
 
7:53 PM
I love when he calls the one guy a fucknugget then proceeds to laugh uncontrollably for 30 seconds
 
@CapricaSix thanks
 
@rlemon love it
 
@Zirak is there really a "real jew news"
??
 
@rlemon No no, of course there isn't. Live your life like a docile livestock.
 
hey guys
 
7:55 PM
@Calne 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.
 
@Zirak ...i... realjewnews.com
 
@SomeGuy holy fuck that is funny!
 
Hey @Calne
sup
 
@rlemon oh, uh, haha, how did that get there? Must be solar flares from our turtles
> I Wish To Warn How Jewry Is Destroying Christianity Throughout The World
TIL Jewry
 
@rlemon wtf
@Zirak he must have confused Jewish and jewelry... They're kinda related
 
7:59 PM
@KendallFrey my favorite proof is that rockets would rip apart when they met "the earth spin"
this is like my favorite video of all time now
 
user406009
People will believe all sorts of crazy things when it suits them.
 
user406009
Such as PHP being a decent language.
 
woah @Lalaland you're a real user now!
no more default avatar
 
hey, I own that joystick
 
user406009
I know. 4 years was too long.
 
8:00 PM
haha
 
I share his sentiment. "just.. FUCK!"
 
"Let me contradict this thing which I know nothing about"
 
user406009
If you are interested in similar stuff, watch the anti-evolution people.
 
I can't wait for video 2 and 3
 
> #1. It's ridiculous because I didn't understand it correctly
> #2. I didn't get that part either, isn't it ludicrous?
 
8:02 PM
KERBAL SPACE PROGRAM
 
lol
 
HAHAHA this is amazing
 
@Zirak to whom are you referring?
 
@rlemon The lovely video he's watching towards the end
 
So... with mongodb, is it better to just put the data directly in every document, or just the _id and then make queries to connect all of the documents into one?
 
8:03 PM
The one with the KSP (among other pearls of wisdom)
 
ohh with the plane
yea
gold.
 
user406009
@corvid If you just want to put the _id, that's an indication that you should be using a relational database.
 
I looked at the comments, wasn't disappointed
 
the shear forces with the vacuum will rip you to shreds
 
user406009
@corvid The technical term for "make queries to connect all the documents into one" is called "join".
 
8:04 PM
> gravity is a social construct that oppresses woman.
> It's actually a feminist idea means to enslave men
 
@Lalaland why would you ever not want to? I mean, it kind of works for 1-to-many relationships, but many to many... eh
 
even though atmospheric reentry is 20 times more violent than that would be
 
(also, no option of database because Meteor doesn't support postgres fully yet :\ )
 
user406009
@corvid I would recommend looking into normalization vs denormalization arguments.
 
user406009
Putting the contents straight in has the benefit of simplicity and speed as the cost of being hard to change and with the possibility of duplicated/invalid data.
 
But how would you model data like that for many-to-many relationships? Add hooks to update everything when something changes?
 
user406009
Yes. It sucks, with high risk of invalid data.
 
sounds bad imho :\ what application does it serve?
 
user406009
Anyways, I would recommend looking into docs.mongodb.org/manual/reference/database-references.
 
user406009
@corvid Speed.
 
8:09 PM
@Lalaland not speed. Dynamic schema.
 
Why would you want a dynamic schema?
 
user406009
How does denormalization help with dynamic schema?
 
user406009
@corvid So you can easily change the schema without having to do any migrations. There are of course counterarguments.
 
That would make data so inconsistent, how do you program around that?
 
user406009
Assuming you have some sort of wrapper for reading from the database, you would enforce consistency there by dynamically changing to the new format.
 
8:13 PM
drat
I need the sync initialized thing to wait for the async thing
PROGRAMMING IS HARD
 
guess what else is hard
 
user406009
Make the sync thing async. Next
 
@KendallFrey MUFFINS
because I left them in the oven too long
 
user406009
@corvid And yes, that is the main counterargument against dynamic schema. The risk of inconsistency.
 
user406009
@SomeKittens They are probably still salvageable. Just cut the outside off.
 
8:22 PM
Hey! I've written a tiny JavaScript / PHP quiz application which gives the user one question, and visualises the result. I post the user's answer to a mysql database using AJAX, then a PHP script updates a JSON file. So here is my problem, how do I let my JavaScript application listen for the change to the JSON file so I can update the visualisation results? I'm trying to avoid refreshing the page. I don't know much about async.
the code is here, thanks for any help! github.com/radiocontrolled/quiz/blob/master/js/main.js
 
user406009
@user2694168 Two options: 1. polling, or 2. Websockets (either through socket.io or natively)
 
user406009
I would just do polling.
 
user406009
Certain people cough rlemon cough would probably accuse me of ruining the environment by wasting pennies of electricity though.
 
rlemon doesn't give a fuck about the environment
 
@Lalaland cool thank you! I will research these options. Can I ask.. what search terms am I looking for if I want to figure out how to do it natively.. and by natively do you mean using vanilla js?
 
user406009
8:26 PM
@user2694168 You just google: "websockets". MDN has a good guide: developer.mozilla.org/en-US/docs/Web/API/WebSockets_API
 
@Lalaland thanks
 
I would use socket.io, since it will automatically choose the best way to do it
 
@Lalaland Third option is long polling (which, yes, I suppose can be called a sub-category of polling, but is probably different enough to warrant its own category)
 
user406009
@Retsam I consider that under socket.io.
 
AWWWWW YIISSSSSS
Decorator takes the output of a function and emits it to a socket
See what your Gustav is processing in a REAL DASHBOARD
“Your realtime….IN REALTIME"
 
user406009
8:28 PM
The advantage of polling is simplicity. Long polling doesn't quite match that.
 
blerg I don't know node so maybe it sense to look at it natively first?
 
user406009
@KendallFrey Socket.io comes at a high complexity cost.
 
If you are doing node, concede that you will not author it all yourself.
 
user406009
@user2694168 There are websocket libraries available in every language: google.com/…
 
you will need libraries
otherwise you'll not get much done
 
user406009
8:28 PM
Unless you do polling.
 
@rlemon You can (see: me) but it's not recommended.
 
user406009
You can do polling without any libraries.
 
user406009
Thus, my polling suggestion.
 
@Lalaland What do you mean?
 
@SomeKittens yea I know you can, but it isn't very productive in the long run unless you're authoring something completely new (ie. a lib someone else would use)
 
8:29 PM
socket is easy
 
@BenjaminGruenbaum we're thinking about using it for profiling
 
@rlemon yup, I decided to do everything manually the first time around and ended up hurting myself due to it.
which is why @FlorianMargaine is so far ahead of me
well, one reason
 
for some reason I was thinking if I used socket, and I'm using node, then why am I bothering with php/mysql code on the server. ok, well I will look at socket
 
user406009
You don't need to use node for socket.io
 
user406009
There are socket.io php libraries.
 
8:32 PM
@SomeKittens other being: he got da skills
 
and a kid
Having kids is OP
 
@rlemon he got all the sweet jobs because everyone else was on strike
 
user406009
Also, I expect socket.io is going to go the way of jQuery quite soon. Only really android's browser is holding it back: caniuse.com/#search=websocket
 
user406009
And opera mini.
 
I use socket.io mainly for the fallback support
like, even when websockets are available, sometimes they drop easily for my clients.
 
8:34 PM
so you use polling? or native?
 
and don't reconnect proper
 
guess what else drops easily
 
the bass?
 
Our self esteem?
 
your mom's panties
 
8:36 PM
@SomeGuy btw, I checked out the library for half an hour. It's almost completely shit XD
There are literally 3 ICT books, and although I did find something interesting explaining very basic physics stuff, I couldn't really find anything else that was of any interest to me ;)
 
hurry up, Friday
 
user406009
@user2694168 Just get it working with simple polling first. Just check the json file like every 2 seconds.
 
user406009
You can worry about making it more efficient if you really need to later.
 
No, get it working with simple socket.io first
 
hmm maybe 2 different implementations! fer fun.
 
8:37 PM
for fun and profit and learning
 
if (fieldText.includes(searchString)) { // }

IE11 does not support includes? Object doesn't support property or method 'includes'
 
user406009
@KendallFrey I find that getting shit done can sometimes be more useful.
 
user406009
Or course, I am on here, JavaScript<time waster>, so I guess I am contradicting myself already.
 
grr.. fixed it
    if (fieldText.indexOf(searchString) != -1) {
 
8:44 PM
!==*
 
ahh very true
 
So I'm trying my darnest to be a good boy and not use innerHTML, but the DOM makes it difficult.
I just wanted to split some text :(
 
whatchu doing?
 
Oh! An idea. Will see if viable.
 
user406009
The DOM is easier than innerHTML + validation for XSS.
 
8:46 PM
just walk the DOM and grab textNodes
??
const parseTextNodes = (container, callback) => {
    let recurse = (node = container) => {
        for (let n of node.childNodes) {
            recurse(n);
        }
        if (node.nodeType === Node.TEXT_NODE && node.nodeValue !== '') {
            callback(node);
        }
    };
    return recurse;
};
 
Really, tell me more
!!mdn createTreeWalker
 
@Zirak OIC, you are one of those jerkfaces that like to mock people trying to help you.
..jerkface
 
user406009
@rlemon I see you haven't blackholed chat.stackoverflow yet.
 
Your help is mockery, you know my skill level
Peasant!
 
8:49 PM
I'm sending you a pizza with all of your favorite toppings and pineapple
 
Little do you know that one of my favourite combos contains pineapple
 
waitaminute...let's look on the StupidOMeter and see how stupid I am right now.
 
Peasant!
 
oh, fuck, here comes a t-storm
 
8:54 PM
> Oh. Fuck.
 
user406009
@Zirak I am afraid the StupidOMeter doesn't go that high. You've broken it. Now how will we measure our incoming noobs?
 
that should be recognized poetry
it explains the most intense moments of the daily life of anyone
 
@Lalaland Carrots. We'll measure them with carrots.
 
first comes "Oh", the realization that something happened. Then The "." shows that the surprise ended. Now the consequences, and we get "Fuck", explaining a wide variety of emotions combined with the modern thought process of young people, then there's another "." meaning that the phrase ended and you better get to prepare/fix stuff
 
I have three ternaries on one line. Huh.
 
8:58 PM
That's three too many
 
user406009
Ternaries are better than || though for some things.
 
user406009
Like numbers, strings, or unknown types.
 
user406009
I always find it funny how the people who rail against "x != null" always have || or && scattered around their code which are much worse IMHO.
 
Don't worry, I replaced it with something equally ugly!
 
@corvid Well then.
 
9:19 PM
room topic changed to JavaScript<bread pit>: Don't piss in the brad pit, children! Read this: rules.javascriptroom.com. Before asking inform yourself on the XY problem goo.gl/taIqf | devdocs.io Documentation™ Helps. WooHoo ES2015 (ES6) released! [ecmascript] [es6] [iojs] [jabbascript] [javascript] [nodejs] [promises]
room topic changed to JavaScript<bread pit>: Don't piss in the bread pit, children! Read this: rules.javascriptroom.com. Before asking inform yourself on the XY problem goo.gl/taIqf | devdocs.io Documentation™ Helps. WooHoo ES2015 (ES6) released! [ecmascript] [es6] [iojs] [jabbascript] [javascript] [nodejs] [promises]
 
9:29 PM
@SomeKittens using libraries has nothing to do with it, we just have different interests. Ask me something about angular and I'll drop my pants. Ask me about nginx and I'll tell you about that time I went to look at kernel source code to find a bug and fix it the smartest way we could
 
> Ask me something about angular and I'll drop my pants.
Thaaaat may not have translated as well as you wanted it to
 
... I guess so. But you got what I meant :P
 
Or it was translated perfectly, who knows?
 
Oh yeah, s/drop/shit/ is what I meant.
 
Anyway, Celtic Connections is on, I'mma fuck off now.
 
9:32 PM
And kids are definitely badass.
Especially mine.
He's sooooo cute
 
Cute = baddass?
 
Both. Right now he's falling asleep in my arms tho, so, cute.
 
Array.prototype.reduce is like a USB plug - I always get it backwards.
 
What, you try to plug the literal mouse in?
 
The callback comes first because it's more common to use it with the same callback on different arrays than on the same array with different callbacks
 
9:48 PM
@copy specifically, the next/prev vs prev/next
 
Oh
(Left) Reduce is ((x0 ∘ x1) ∘ x2) ∘ ...
 
@SomeKittens Buuuut...it's in that order
Previous comes before current
On the other hand, I *never* remember `ln`'s argument order
!!ln
 
@Zirak That didn't make much sense. Maybe you meant: tln
 
NNNNOOOOO
!!apocalypse
 
9:53 PM
the hell man
 
the man, hell?
 
Let's not be reddit
 
@Zirak src dest
 
@FlorianMargaine AHA! You'd think that
BUT ACTUALLY! It's ln target name
So name -> target
 
I remember it now because it's backwards
 
9:56 PM
And it's ALWAYS fucking with me
 
@Zirak no, ln -s src dest
 
Because I keep thinking "no way it's reversed like that", but then another part of me goes "you've done this...for a thousand times"
 
I'm absolutely 100% certain
 
@FlorianMargaine Which points to which?
ls -l src, what do you get?
 
Dest points to src, duh
 
9:57 PM
I will burn you
With a burning mechanism
 
@Zirak Read that as bum, top kek.
 
But yes, it's backwards and I remember it as such.
 

« first day (1783 days earlier)      last day (3161 days later) »