« first day (2055 days earlier)      last day (2891 days later) » 

12:02 AM
cool, i'll use all()+destructuring instead
thanks
 
np
 
Which rule is at work here?
x = (1, 2); // x = 2
x = 1, 2; // x = 1
 
Assignment has higher precedence than the comma operator
In fact, every operator does
 
thanks!
 
//apparently es6 doesn't accept this arrow function parameter destructuring syntax:
[param1, param2] => {}

//shouldn't that be valid syntax, since technically there's only one parameter?
//this syntax does work, however:
([param1, param2]) => {}
 
12:10 AM
@Mathematics is this more like what you were looking for with the names?
 
@NathanJones Both throw a syntax error - unexpected token [ (Chrome 48)
 
@le_m afaik argument destructuring isn't supported in chrome until 49 developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…
i'm using babel btw
 
that explains it
 
!!wiki fat comma
 
@thepiercingarrow That didn't make much sense. Maybe you meant: wat
 
12:14 AM
!!undo
 
Fat comma (also termed hash rocket in Ruby and a fat arrow in JavaScript) refers to the "=>" operator present in some programming languages. It is primarily associated with PHP, Ruby and Perl programming languages, which use it to declare hashes. Using a fat comma to bind key-value pairs in a hash, instead of using a comma, is considered an example of good idiomatic Perl. In CoffeeScript and TypeScript, the fat comma is used to declare a function that is bound to this. == Subtleties == === Perl === The "fat comma" forces the word to its left to be interpreted as a string. Thus, where th...
@thepiercingarrow You do not have permission to use the command undo
 
@NathanJones Nah, you need parens if you're destructuring the argument
 
!!help undo
 
@thepiercingarrow undo: Undo (delete) specified or last message. /undo [msgid0, msgid1, ...] (omit for last message); /undo xN for last N; /undo ~N for the Nth message from the end
 
Also if you're returning an empty object, you need to do () => ({})
3
 
12:18 AM
@Meredith ah, thanks
 
12:28 AM
@Mathematics that algorithm has the same expectations as json: at the top level it must be either an array or an object. That rule in the spec is no accident, it allows you to decompose the path to a property back into a sequence of . and [] accesses
i.e. var x = JSON.parse(' { y: [ 7, 8 ] } '); console.log(x.y[1]); <-- you can reach 8 by accessing x.y.1, but you use [] when it is not a valid identifier in js, so it is x.y[1]
 
@Meredith it's sad that the empty bracket isn't a D
 
@le_m (1,2) is an expression resulting in 2.
 
12:46 AM
@Mathematics improved test case
 
Having a very odd issue with Express and sessions
 
@ThatGuy 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.
 
I have this code
//Mongoose Setup
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
mongoose.connect("MY_DB");
var path = require('path');
var appDir = path.dirname(require.main.filename);
var bodyParser = require('body-parser')
var User = require('../models/user.js');
var passport = require('passport');
var LocalStrategy = require('passport-local');
var uuid = require('node-uuid');
var cookieParser = require('cookie-parser');
//Express Setup
var express = require('express');
var router = express.Router();
 
Seattle... where literal teardowns are $300k redfin.com/WA/Seattle/805-23rd-Ave-98122/home/142287
 
And I keep getting that req.session is undefined
Been asking on here and reddit, could find any answers that worked
 
12:49 AM
> A vegan cafe in Georgia came under attack by 'pro-meat protesters ' who threw sausages and fish at diners ... More than a dozen men entered the vegan Kiwi Cafe ... 'wearing sausages around their necks and carrying skewers of meat' on Sunday night. When the men refused to leave, they were forcibly removed by staff, which prompted a brawl in the street between vegans and pro-meat protesters
laughed so hard
 
free sausage!
 
Anybody know why I may be getting that req.session is undefined?
 
user4196492
Having a hard time accessing items in a multidimensional array. I initialize the mult array like so:
var blocks = Array(100).fill(Array(100));

through experimentation, I figured out that no matter what parameter I put in, it will only access the last row(internal array) within the mult array.
blocks has 100 arrays inside of it.
blocks[69][43] accesses the 43rd item on row 99
blocks[33][23] accesses the 23rd item on row 99

What am I doing wrong?
 
@ThatGuy which line?
 
req.session.userId = user.id;
 
12:52 AM
It's filling the inner array all with the same value.
 
When I do that
I get an error
 
@rlemon lead you astray.
 
"TypeError: Cannot set property 'userId' of undefined"
And I did console.log(session) and it printed undefined
 
well you've answered your question haven't you?
 
I want to know why its undefined
I know that it is
Because based on some other code I tried, I used it correctly
 
12:54 AM
!!google mongoose request session undefined
 
Doesn't have to do with mongoose
I googled it
 
-1
Q: request.session undefined . nodeJS express

KianPthere were many questions about this topic around , but none could solve my problem , i developed an express app and my authentication method was to write to session object and using redis-store . it worked perfect during development , but the first time i deployed my site for some tests ( usi...

 
.fill(Array(100)) // is filling ALL rows with the same array.
 
Found similar questions, didn't help
 
15
Q: 'session' is undefined when using express / redis for session store

AlexI'm trying to use redis for sessions in my express app. I do the following: var express = require('express'); var RedisStore = require('connect-redis')(express); app.configure('development', function(){ app.use(express.session({ secret: "password", store: ...

 
12:55 AM
I looked at those
The solutions didn't work for me
 
@Luggage yup, .fill is by reference, bit me today
 
user4196492
@Luggage So if I change anything in any of the rows, it will change on all of the other rows inside of the mult array?
 
yea, you need to make 100 new arrays, not one and fill all the slots with that same one
 
user4196492
@SomeKittens I think I understand the problem now.
 
@Codeman I tried changing the code according to the other answers, but none of them helped
 
12:59 AM
What is the support for the fat arrow?
 
@Codeman Why would this work:
var express = require('express');
var session = require('express-session');
var app = express();
var uuid = require('node-uuid');
var bodyParser = require('body-parser');

app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());

// Use the session middleware
app.use(session({
  secret: 'jaredasch',
  cookie: { maxAge: 60 * 60 * 1000 },
  saveUninitialized: false,
  resave: false
}))

// Access the session as req.session
app.get('/', function(req, res, next) {
  var sess = req.session
and not something like what I put before\
 
idk. I don't really know Node
you also have too much other cruft for me to see what actually changed
 
@Luggage @pebble225 sorry
const arr = Array(100).fill([]).map(arr => Array(100).fill({}));
fill with an empty array and map a new array
or fill with whatever really.
the map handles it, but you need to fill for the iterator to work
 
0 might be lighter than an empty array there
(assumption)
 
Anybody familiar with Node, I would greatly love your help
 
1:04 AM
@ThatGuy not that familiar, but whats up?
 
Just posted above
 
@rlemon hey, are you familiar with using canvas to draw dynamic maps?
 
Confused at why req.session is undefined in one case and not another
 
> and not something I posted before
what did you post?
 
He only draws colored t-shirts on canvases
 
1:05 AM
god I love .map
 
@thepiercingarrow scroll up.
and .reduce. the peanut butter to that jelly.
 
@thepiercingarrow define "dynamic maps"
 
@thepiercingarrow I'd be glad to have your opinion
 
@Luggage hey, that was fun. I converted the tshirt to greyscale (measured luminescence) then by using that applied the same rgb from the source image for the overlay
 
@rlemon like, for example agar.io, where there is a big map, and you move around but the map moves and you just stay in the center
@ThatGuy not entirely sure - just a guess, but maybe post requests don't have a session object?
 
1:07 AM
Nope
 
@thepiercingarrow camera / map systems I have not personally done, but there is a LOT of resources out there
@ndugger has done one
 
Tried doing the same with Post requests
Still worked
I thought that might have been the issue aswell but it isnt
 
I wasn't making fun.
 
@rlemon k. but my main question is - should I draw relative to to the player in the center, or should I translate my map to keep the player in the center?
 
@thepiercingarrow imo have a border radius that moves the map. like 20% around the edge moves the map
so I can always see where I'm going, but as I move the center the map stays where it is
 
1:09 AM
@rlemon huh?
@rlemon how big is your map?
 
@thepiercingarrow sketchtoy.com/67084038
 
@ThatGuy change the secret
 
@rlemon what?
 
I tried changing the secret such that it matches the secret of cookieSession
not successful
 
no, I mean, you just told the world the secret. change it
in case you plan on leaving it like that
 
1:11 AM
@rlemon is the rectangle the viewport? or a box inside the screen?
 
and every other account you have if you are a 1 password person, lol
 
that wasn't the real secret
 
well, not the world, but you told a few bored people on the internet..
 
And I also didn't post the real secret
I'm not that dumb...
But why might it not be working?
 
Yea, you did. I'm already in your harddrive. Stealing all your cat pictures.
 
1:13 AM
@thepiercingarrow jsfiddle.net/gz8hqupr
does this help
 
these cats are kinda young, you sick bastard
 
@rlemon yeah, I see
 
you want a camera/move system.. Im just saying don't make it terminate at the absolute edge of the viewport.
that will suck
always leave a buffer
 
@rlemon makes sense... although wouldn't that be really hard to do?
 
no
 
1:15 AM
idk, keeping it in the center just seems seems easier to a simple person like me :/
 
yes it is easier, but less enjoyable.
 
What should i do to find a solution for my problem?
 
@rlemon btw for reference, this is a videogame
 
Seems like I should be able to find help somewhere?
 
@ThatGuy you could check the node docs?
 
1:16 AM
@ThatGuy define "work". getting / does what?
 
@ThatGuy or run in REPL mode
!!wiki REPL
 
Hundreds of replicas of the Statue of Liberty have been created worldwide. At least one is the same size as the original; others are all smaller. == France == === Paris === ==== Musée d'Orsay ==== On the occasion of the Exposition Universelle of 1900, Bartholdi crafted a smaller version of the Statue of Liberty, which he subsequently gave to the Musée du Luxembourg. In 1905, the statue was placed outside the museum in the Jardin du Luxembourg, where it stood for over a century, until 2012. It currently stands at the entrance to the Musée d'Orsay; a newly constructed bronze replica st...
 
um... no
 
A read–eval–print loop (REPL), also known as an interactive toplevel or language shell, is a simple, interactive computer programming environment that takes single user inputs (i.e. single expressions), evaluates them, and returns the result to the user; a program written in a REPL environment is executed piecewise. The term is most usually used to refer to programming interfaces similar to the classic Lisp machine interactive environment. Common examples include command line shells and similar environments for programming languages, and is particularly characteristic of scripting languages. ...
 
lmao
 
1:17 AM
lol
 
there. didn't know caps mattered :P
 
I know how it theoretically should work
And it did in one situation
But I don't see how the second is different in a way that would cause an issue
 
@rlemon are there any live examples I could look at?
 
@thepiercingarrow none that I can think of
most follow center of frame because it is easier
 
Where could I go to get help?
 
1:19 AM
@rlemon lol okay
 
Is there anybody who visits the chat often very skilled with node/express?
 
@rlemon I think pokemon does it - but that is closed source !!angry emoji
@ThatGuy little pootis lol
@ThatGuy or you could post on the main site, make a mvfe and you'll probably get a response by 2morrow
 
Tried that
Got nothing
 
!!urban mvfe
 
@thepiercingarrow No definition found for mvfe
 
1:20 AM
@ThatGuy I offered to help but you won't say what you mean by work
 
lol I'm just using that as an excuse to use the bot :P
 
req.session is undefined
Why?
 
am I supposed to solve the puzzle of what happened too?
 
@doug65536 lawl
doug is very smart o.O
 
@doug65536 I told you what the issue is
 
1:22 AM
@doug65536 bascially if you look up, he has two node programs, one that works, and one that throws an error claiming req.session is undefined
@doug65536 and he is unsure why one works and one doesn't
 
oh sorry didnt see 1st one
 
My bad for not explaining that @doug65536
 
@ThatGuy are you using cookieParser?
 
1:23 AM
@rlemon No, I added it in the second one, didn't work
 
@rlemon I wish I was as smart as you... :(
 
Don't have it in the working one anyways
 
flattery will get you no where
 
That was what most SO answers I saw said
 
@ThatGuy well you need cookieParser for sessions iirc
 
1:24 AM
The first one works fine
 
!!urban iirc
 
@thepiercingarrow No definition found for iifc
 
Also I added it and it still didn't work
 
@thepiercingarrow iirc abbv for If I Recall Correctly
 
to the second one
 
1:25 AM
was written for express 3, but should work for 4
and sessions work
 
Thank you for giving more reference material
But I am specifically interested in why one worked and the other doesnt
 
diff them.
 
Because I see nothing that should make a difference
 
@Luggage good idea XD - deserves a star XD
 
It does
 
1:27 AM
@ThatGuy so it never creates a session, ever, on redis?
 
Not using redis
Creates session variables
 
ok that is some other question you referenced ?
 
?
 
am I crazy, where did I see new RedisStore...
oh in that question
 
Not using RedisStore
 
1:29 AM
are you using cluster?
 
Nope
 
In socket.io, if you say socket.emit('ping') with no second parameter, is that allowed?
is there a better way to ping the server if you don't have any information to send in the second argument?
 
@thepiercingarrow I disagree!
(in terms of what you said yesterday)
 
@qaispak what did I say?
morning qaispak!
 
Web deve is blue collar work in CS
good morning! (evening here)
 
1:32 AM
@qaispak why? it totally is
 
cs = c#?
 
or coffeescript?
 
the world is becoming more and more interconnected.
 
cs = comp sci
(computer science)
 
1:32 AM
Well I don't know if you're referring to just making websites
 
ohh, i see
 
webdev is bridging the forefront of computer technology
 
but actual web application development is the uture
future*
 
at least, it is bringing in the $$
 
no its not
 
1:33 AM
it can be, yes. working on some shitty LOB app in asp.net
 
there is so much more to comp sci than web dev
wait
nvm
 
@doug65536 Any ideas?
 
I was thinking about websites / database stuff
I forgot about the rest of the web...
 
@ThatGuy You don't set anything in the session, and you tell it not to save uninitialized, so you told it to do just that, right?
 
I'm talking about actual web applications.
 
1:33 AM
but you can throw functional programming techniques at web dev, if you like
 
@rlemon if you still remember that code you helped me with, does .all() still work when one of the values in the array is also an array (of Promises)?
 
@thepiercingarrow you think narrow. don't think blogs and social networks. the 'web' is connecting people to devices to do their jobs all over the world. SCADA is bridging the web
 
Hard Knock Life = momma said
 
Think Amazon, Google. These are web applications!
 
ya
sorry
> I was thinking about websites / database stuff
I forgot about the rest of the web...
^above
 
1:34 AM
yeah I see that. Honestly, I thought like you did 2months ago and disregarded web dev. I just got into it (maybe a week).
 
@NathanJones don't know. try it
if it doesn't work let me know
 
but because my brain is annoying, I am starting from the scratch...
 
@doug65536 What would I have to do to fix the issue I am having?
 
@qaispak its fun, but it gets a bit boring after a bit :(
 
once the 'web' part of web dev is second nature, you can go throwing all your CS tools at the problem
 
1:35 AM
@thepiercingarrow I want to just get the basics
what @Luggage said!
 
@rlemon tried it, .then() is getting called while all of those Promises are still pending
 
That's what I want to do.
 
@NathanJones so you have a value and an array of promises and you want them all in one scope?
 
All those hours of coding data structs and what not in Java scratching my head... I want to be able to do that in webs.
 
If I have a js map with objects in it, is there a better way to modify a property of an object than map.set(key, join(map.get(key), new value)) ? idk seems a bit redundant to me...
 
1:36 AM
Anyway I have complex things to do, making an html page :P
 
.then(respA => {
  return [respA, [PromiseB1, PromiseB2, ...];
})
.then(([respA, arrayOfRespBs]) => {});
 
hey guys. morning
 
@ThatGuy do you store something in the session somewhere? in the browser debugger, check the headers, the response headers will say cookie: and you should see cookies in the resources tab
 
@qaispak :P
@qaispak ga html is the worst... its SO annoying
@qaispak idk about you, but its literally I just copy-paste html from the docs and hope it works :P
 
is that doable?
 
1:37 AM
@ThatGuy you told it not to create empty sessions, so it is correctly not creating empty sessions
 
@thepiercingarrow are those two different Maps?
a map of maps?
 
So change saveUninitialized to turn?
true*
 
@Luggage no same map
@Luggage and same key
 
why? don't you put something in the session? or just create a pointless one and not use it
 
@Luggage I have a map storing objects, and I want to change a single property of one of the objects
@Luggage is it a bad idea to map objects?
 
1:38 AM
I will put something in it, but I can't because I can't set a property of undefined
 
@thepiercingarrow of course it is annoying... which is why I've been ignoring it forever. but now's the time I have to learn it :( I just really, really want to understand the basics!
 
can someone help me understand this.
var ok = true;
ok = writer.write(data, encoding);
 
what is the key?
 
@Luggage a websocket id
 
a string or another objecT?
 
1:39 AM
so when I try req.session.userID = something, I get an error
 
@Luggage a string
 
i got it from the node js docs. The full code.
 
@ThatGuy if you store something in the session, it should suddenly work
 
@rlemon i'm kind of suspecting the spread operator might be useful somewhere, but i'm just not seeing it
 
then no need for a Map. Just use an object.
 
1:39 AM
function writeOneMillionTimes(writer, data, encoding, callback) {
  var i = 1000000;
  write();
  function write() {
    var ok = true;
    do {
      i -= 1;
      if (i === 0) {
        // last time!
        writer.write(data +i , encoding, callback);
      } else {
        // see if we should continue, or wait
        // don't pass the callback, because we're not done yet.
        ok = writer.write(data, encoding);
      }
    } while (i > 0 && ok);
    if (i > 0) {
      // had to stop early!
 
But I can't store something
 
Maps are for when you need objects as keys.
 
Thats the issue
It won't let me
I get the error
TypeError: Cannot set property 'userId' of undefined
 
@ThatGuy can you show the line that won't let you
 
@Luggage oh. but I read somewhere that if you edit the map alot and make/delete properties (users connect, disconnect), then maps are better or something?
@Luggage was I misinformed?
 
1:40 AM
@NathanJones jsfiddle.net/g3uz4m1a does this work for you
 
When I try to do req.session.userId = user.id;
 
stop making my pc constantly ding
 
user.id is the mongo user id
 
@Luggage sorry :(
 
obviously not
 
1:40 AM
Why should I use ssh git link and not https?
 
huh luggage?
 
I don't know what a Map gets you over an object.
A WeakMap, perhaps, not but Map.
I also don't know why you need that one line of code to be shorter :)
 
it says on MDN: ix.io/NnK
mine applies to 1, 4, 5, 6
and I think 2 as well
 
?
 
@doug65536 Any ideas?
 
1:44 AM
no idea what you are talking about with those numbers.
 
@rlemon oh that makes sense and it works
 
luggage sorry reload I numbered the points
 
reload what?
 
if you want to paste a link to mdn, just to that... not using your shortener
 
1:46 AM
@ThatGuy assign an object to req.session
the middleware should detect it at the end and do its thing
 
Why is working in the first example then?
Can you give an example of what you think I should do?
 
are you sure it is exactly the same version with exactly the same options?
req.session = { userId: 42 };
 
Let me try that
 
you want saveUninitialized: true anyway, right? you are guaranteeing you will set something so go ahead and assume it
 
Seems to work
Thanks bro
 
1:49 AM
np
yeah either way should be fine
 
typically you will say if (req.session === undefined) { ...brand new ... } else { ... welcome back ...}
I'm not sure it is undefined though. check
assigning undefined to req.session should destroy it
 
Now another weird issue
 
@Luggage btw ix.io is a pastebin - and mdn scroll down to the part that says "If you're still not sure which one to use, ask yourself the following questions:"
 
It doesn't seem as if the session is set
I printed out the session after I was redirected
and it shows this
Session {
  cookie:
   { path: '/',
     _expires: Tue May 31 2016 22:51:52 GMT-0400 (EDT),
     originalMaxAge: 3600000,
     httpOnly: true } }
 
1:53 AM
ok, a browser won't send that cookie for ajax
does that matter?
httpOnly means "not XHR"
 
But why can't I access the session variables now?
from other parts of my app
 
can you post what you have?
 
Sure one sec
Can someone make a chat with me and doug?
 
@towc just frigging use arch
 

« first day (2055 days earlier)      last day (2891 days later) »