« first day (2228 days earlier)      last day (2706 days later) » 

12:15 AM
@Knu parse?
 
user2620028
@knu objectify
 
Knu
@HatterisMad yeah is that really common?
 
@Zirak I'm never over there for xmas/newyear - I usually go home for ~3 weeks
 
user2620028
in the english language yes, in programming for some reason i don't think it is.
 
Knu
That's what I though.
I ended with a function named something like exampleToObject
bit long but to the point
 
user2620028
12:22 AM
like kendall said parse would be the programming verb you are likely looking for
 
parse is just a buzzword
 
Knu
I like how some terms have different definition depending on the language.
 
Kind of like how JavaScript is just another definition of Java
 
I'm a little confused with how immutable js treats keys of different types. If you use fromJS() it converts the int to a string but if you use set() it doesn't seem to. Example: jsfiddle.net/1onh8b8s
Wouldn't it make sense to follow javascript and make either work? What am I missing?
Updated example to show where it doesn't work: jsfiddle.net/1onh8b8s/1
 
object keys can only be strings or symbols
the key in {1: null} is a string
 
12:36 AM
correct, but for some reason immutable doesn't seem to convert it to a string if you use set()
 
that's because it's not an object
it's an immutable-js map
you can compare it to a JS Map
where keys can be anything
 
right, I would have assumed then it would have treated fromJS() the same way
maybe there is an option for fromJS, I'll look in the docs
 
why would there be an option
you are thinking of something like this:
const test = Immutable.fromJS(new Map([[1, 'one']]));
 
well pretty much I'm trying to import / export it to json. But it messes up because of the different key types
 
@Mosho I forgot Symbols could be keys
 
12:43 AM
I'm thinking if I want to export to json I should probably store my ids (keys) as strings instead of ints
 
@joshhunt It calls Object.keys when you use fromJS
!!> Object.keys({2: 'foo'})
 
@Meredith ["2"]
 
it doesn't matter what it does
the key is never a number
!!> for (let k in {1:1}) console.log(typeof k)
 
If you call set with a number key
 
@Mosho "undefined" Logged: "string"
 
12:47 AM
It's a number
 
it's not an object
 
He literally posted an example that contradicts you
 
in an object declaration if you use a "number" without ticks it's still a string
where lol
 
test2.set(2, 'two') has an integer key
 
there is no contradicting, it's fact
it's not
an
object
 
12:49 AM
That's why get(2) works and get('2') doesn't work
 
well, not a plain one, you know what I mean
 
Immutable maps let you use whatever as a key
 
right, but when you declare an object
the key is a string
that's all I'm saying
 
But if you create it from an object, every key is a string because objects aren't maps
It calls Object.keys internally
 
it doesn't matter how it does it, that's my (somewhat delicate) point
I'm trying to say it's not an implementation detail of fromJS
 
12:50 AM
pretty much immutable map !== object. Map lets you use whatever as a key but when immutable imports from an object it only imports it as a string because objects only allow strings
thats my current understanding anyways
 
Yes
@Mosho I got you
 
cool
 
{1: 'one'} -> {'1': 'one'} which I already new but I didn't connect the dots :/ Thanks for your help
 
1:08 AM
@SterlingArcher >:( you're a buzzword
In the course of redditing, I made a thing.
It's probably terrible
 
1:41 AM
Hey guys
I have got a client object that takes the socket.id when a client connects (pushes to a client array) and I'm trying to figure out an efficient way to remove the client when they disconnect, other than for looping over everything and removing once I find a match
 
@lix Store the clients in a map
 
Won't I still have to foreach over the map to find the client to remove?
or actually
 
No, you can remove by key
 
Sorry in advance if this is hard to understand, all my exsitsing knowledge is from c# / php
Were essentially making an assoc array where the clients Id would be the key
and were making a function for the map that takes a client id and then does a remove statement from the map?
The answer to this looks like what I've been thinking of stackoverflow.com/questions/4246980/…
 
@lix Yes, that would work, but this is even better: developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…
 
1:57 AM
Oh nice, thanks @copy
 
If you need to use objects for this, use Object.create(null)
 
rather than new Map()?
It's working but not actually deleting from the map
Oh though delete returns a boolean, though I'm imaging it's still trying to remove from the map
 
You should be using players.delete(id)
And players.set(id, player) to add
 
Yeah That's what I've been trying to do, but check this
It's as if the socket gives me an integer or a string at random
so It can't find it for deletion
There's one above where the key has no ' ' string identiferies
 
2:12 AM
I'm not following
 
Okay so I've set up a socket.io server and I'm calling socket.id which gives me a id for the client, I'm saving that into the map and then when the user disconnects I'm trying to remove that user from the map by id
The above is what my sever is printing out, It doesn't delete the entry from the map because it can't find the id, I'm guessing this is because it changes it to a string? not sure
I've set out an if loop to try and reason as to why this is happening, but I must admit my troubleshooting knowledge in js isn't great :/
This time it didn't make it a string :o
 
> a = new Map()
Map {}
> a.set('abc', 'test')
Map { 'abc' => 'test' }
> a.delete('abc')
true
> a
Map {}
Are you calling the functions like that?
 
I'm kind of using it like an array
var connectedUser = new Client(socket.id);

allConnectedClients[socket.id] = connectedUser;
creating the map like this var allConnectedClients = new Map();
 
Use allConnectedClients.set(socket.id, connectedUser)
 
Then I'm calling delete like you do above using socket.id
@copy Nice spot :-)
It's working ^_^
@copy in respect to good coding practices, should I wrap this into a try and catch and catch an error if a value isn't found so as to log to console?
 
2:28 AM
Nah do what I do and don't bother with try/catches
And wait for it to inevitably make you cry
 
haha, Been there done that in c#
made a fancy university management system that allowed all sorts of odd types and incorrect information to be passed by observers
 
2:49 AM
@copy hi
 
@BadgerCat hi
 
3:05 AM
@Meredith hi
 
@BadgerCat Long time no see
 
Is it possible to create a dom element from within a class defined outside of the .html page and pass it back using a get function?
also hi
 
wat
You can certainly create DOM nodes and insert them, yes
 
man this js stuff is neat
why do people even use php when you have node
 
3:22 AM
Why would anyone use X when they could use Y?
 
@monners If you wondering why I sound like an idiot it's because I was thinking about it like I was in a different language
 
Ah
Yep, you're on the client. Anything's possible!
 
I wish the chat had some way of rewarding people for there answers, like I know you can always open a question for the points. But I feel bad always asking questions :/
 
@SterlingArcher Hi
 
@lix Feel free to upvote one of my popular answers :P
 
3:31 AM
woah 1k bounty
That's actually the first time I've actually seen one above like 75
 
Yup, and actually closely related to the question you just asked
 
Nice man :-D, giving it a read now
 
I take it you're coming from PHP?
 
Mostly yeah, I've done a fair bit of c# aswell
 
Welcome to the wild west
 
3:37 AM
haha cool
 
@lix Because Node doesn't have WordPress or Mediawiki (yet). Solution: implement a PHP parser and runtime in Node.
 
Here we eat type coercion for bacon and eggs
 
PHP powers most of the web. Hard to beat that network effect.
 
Yeah let me just get on that after my degree project haha
I actually started doing PHP because a. University doesn't teach it at all b. I wanted to make a CMS to start a website startup thing
I'm also not a fan of wordpress
 
@lix User document.adoptNode to adopt a node (an element) created elsewhere.
 
3:41 AM
oh that's useful!
though sadly I'm battling with how I load a class in another js file into my html page to use in another script below
 
@lix No, neither am I. But it's cost effective for most small sites.
 
@lix Rule #1 of web development: Don't build your own CMS
 
@monners why?
Keep getting some mime type mismatch
 
Because you are reinventing the wheel. Of course, there are many CMS, some heavier, some lighter. Learning them is part of learning PHP, too.
 
Just a general rule. Do it for the experience, it'll certainly teach you why you don't want to do it again :P
 
3:44 AM
^
 
welp it had the opposite effect on me sadly
 
Then you are not doing it enough XD
 
I wrote something like 100k lines this summer, I was actually sad when I got back to uni because I wanted to keep building it
 
I made a teensy CMS once... never again
seems so simple at first
 
I guess it's just the idea and having some kind of vision
The one I developed was for esports websites
 
3:47 AM
A CMS is really not about what you write, it's about the eco system you create
 
though we used it on a variety of different things
 
@lix Sounds like a good plan. 100k loc is not bad, and putting it down for a year of study and then come back to re-read it would give you more experience.
 
because the corner cases kill you, with astonishing variety
 
@Shane Couldn't agree more, lots of meetings about UX and 'How the fuck are people going to use this lel'
 
yeah... over and over, new, weird stuff that makes sense eventually, but you'd never think of when drafting the original plan
 
3:48 AM
@Sheepy yeah for sure, I'm hoping It'll look good when I go for interviews
oh god yeah, managing images with sorting and naming in general was an obstacle for me for sure @Shane
 
yeah, then there's taxonomy...
that's another nut-punch
 
dealing with ajax calls from within like 3 sub directories and an ever growing .htaccess was also painful
though we found a way to deal with that by seperating headers identified as ajax, still not sure if that's a good thing to do
 
no idea, I'm pretty much exclusively hapijs / single page apps these days
 
If I have my files inside /src/something.js and I call it on my client index.html being run by node is that likely to cause a mime mismatch and block the call?
 
so for me, they're kind of all web services
 
3:53 AM
that's cool is it your job?
 
yeah
you just set the server to return GET requests to a particular url as the same html page (which is your single page app)
react / redux do the rest
works pretty well
but that's one of 10k ways to skin a cat
 
I actually meant on my app atm xD
This whole setting up the server yourself with node is something new for me
 
ah, right... problem with those is you're never sure just how far off the reservation you've wandered
yeah... that part's nasty
just going at it blind like that
so many ways to hang yourself
 
Yeah but I guess it's part of the learning curve ey
 
we had a pretty smart guy set ours up, done it lots of times so I know it scales
ew... what's serving your pages?
 
3:57 AM
just node with socket.io
 
ah, never used socket.io
just hapi, express and sails (maybe a few others)
 
What I'm trying to do atm shouldn't need sockets, just to load in a js file so I can use the class :/
Really quite confusing man
 
what's the end goal?
what kind of site?
 
never heard of sails gunna give it a look
 
no, don't actually
 
3:59 AM
It's a multiplayer game of asteroids
 
pretty sure it's not a contender anymore
ah ok... so you need real-time
 
yeah, I'm going to use socket.io for it I guess
 
meteor's good for that if you stay within their box... but god help you if you step out of their intended use
socket might be the better choice, I just wouldn't ,now
*know
haven't seen that "nosniff" bit before
 
It was what was recommended at uni, plus I don't mind going to the hard route and putting some effort in
 
got pluralsight?
 
4:02 AM
yeah I'm not really sure what it means either, I'm considering just having all my logic in a single file, but the PHP developer inside of me wants to abstract shit
never heard of that
 
it's a subscription site, not bad imo though I'm sure there's plenty who disagree
I like their courses... I feel more grounded after one
I prefer to start there and then go to google and youtube for what I need specifically
 
as bad as this may sound, I'm broke as fuck.. like barely afford food
so I just grab copies of books off the internet
or look for free stuff
 
yeah, there's that...
do they have a trial period?
might have 30 days, most do
 
It'd be cool, though that course has the same stuff as the tutorial on the socket.io website
 
anyhow, I'd look for some kind of socket.io intro... get the fundamentals first if you want to build a project around it
ah ok... sounds like you've done that (some don't)
 
4:05 AM
yeah probably a good shout to get some more fundamentals in
 
not enough of that is a guaranteed nightmare down the road
 
oh I agree, like the error I'm getting atm. It's more than likely because I don't understand enough about how files are distributed from the sever I made
 
yeah, those headers are the result of either some explicit or default configuration no doubt
fundamentals show you where
do you have a working example anywhere?
something you can contrast?
 
go to bed
 
that's another general principle, find a working example... slowly eliminate delta
I was wondering when you were going to show up ndugger
 
4:11 AM
That I do not, though it manages to find the js for the sockets which is rather confusing
 
I'd make that your focus, otherwise you're going to spend a lot of time attacking the wrong problem
 
Very true, gunna do some digging on express as well as that might give some soloutions
 
@ndugger - you ever check out ducks?
 
oh lord now it's just sending the page as text rather than html
 
4:30 AM
Okay I think I found out where the issue is coming from, In node when you create a http server and server an a page the mime type gets read by the server using what I presume to be a regular expression and tells the browser what it's expecting. Because I'm loading in a resource without a get hanlder in my server when it goes to retrieve it there's no handler to send the correct mimetype so the browser knows how to compile the code.
 
4:45 AM
With some tweaking to how I was approaching my express sever and serving the directory as a static component of my app, the files were correctly sniffed. thanks for the advice @Shane
 
4:58 AM
ah, cheers!
nite!
 
5:17 AM
Finally a new badge "Constituent" , go and get your free badge people stackoverflow.com/election
 
6:01 AM
var name = "Jesse";
var habit = "Reading";
var website = "www.antwistom.com";
var stringTemp = `My name is ${name}, I like ${habit}.
My website is ${website}`;
console.log(stringTemp);
name = "Lisa";
console.log(stringTemp);
Why I change the variable, the template does not change it output?
 
6:12 AM
@Jesse because they evaluate to strings
 
@littlepootis what does that mean?
 
It's the same as doing "My name is " + name + ", I like " + habit + "."
They're already interpolated.
 
To be fair, if he doesn't know what string evaluation means I don't think he'll know interpolation
 
6:28 AM
@littlepootis so once it is defined, it could not be changed.
got it
 
yeah.. something like that..
 
Hi guys
Guys there is a help regarding Object modelling is required : i.e. for the first time i am working on a NodeJS project which is a very simple module wherein we are reading from a queue and Dumping the same in MongoDB, & the currently existing code is a MESS.

So for the starters I have started to differentiate the Business layer and the Data access layer with a Data model entity. Now, I am looking for further betterment. Any idea ?
 
@Shmiddty err what is that?
 
6:55 AM
Quick question for you web wizards:
var mFile = event.target.files[0];
var params = {o1: mFile, o2: "foo" };
console.log(params);
$.post("request.php",params,function(data) {
	document.getElementsByTagName("body")[0].innerHTML+= data;
 });
why does jquery throw an exception when I pass params like that?
If I do $.post(..., {key: "val"}, ...) it works
 
what's the exception
 
Illegal invocation
 
of what
be specific
 
on this line $.post("request.php",params,function(data) { of the second parameter.
Doesn't say anything else, let me screen shot it though
 
include the entire error
 
7:00 AM
the anonymous function on line 23 is that line.
in jQuery its here:
 
46
Q: jQuery - Illegal invocation

yodajQuery v1.7.2 I have this funcion that is giving me the following error while executing : Uncaught TypeError: Illegal invocation Here's the function : $('form[name="twp-tool-distance-form"]').on('submit', function(e) { e.preventDefault(); var from = $('form[name="twp-tool-distance-f...

put quotes on your object keys
and google first ;)
 
oh ok thanks, sorry about that
xD
 
any idea guys >
 
@SterlingArcher no its not this. Looks like jQuery params can only be strings I suppose.
 
7:23 AM
@MadaraUchiha oi! You have setup wildcard email on one of your domains right?
 
Right, sup?
 
@MadaraUchiha What do you use for the setup? I currently use namecheap.me's "one click" setup from their domain panel, but that forces me to use their DNS, so I can't easily point the domains to my VPS.
 
I use 123 reg, and they offer this feature out of the box
I haven't pointed my mx records to my server for it.
 
7:54 AM
Socket.io anyone?
Need some help
 
8:14 AM
does anyone know how to download Blob using Safari?
 
@MadaraUchiha thanks
@towc since you are virtually the only one I know who visits awalgarg.tk from this room: I have migrated everything to awalgarg.me instead (shared/git domains too). .tk still works, but it soon won't. the email redirection on awalgarg.me works too.
 
8:56 AM
26
Q: Download blobs locally using Safari

ErikI'm trying to find a cross browser way to store data locally in HTML5. I have generated a chunk of data in a Blob (see MDN). Now I want to move this Blob to the actual filesystem and save it locally. I've found the following ways to achieve this; Use the <a download> attribute. This works only ...

 
tables vs d3 ??
 
@Sheepy Thank you, I already checked it, I donot want to add additional JS in my project and the "window.open" does not support Sarafi 9.X
 
Well then you're SOL
 
@Jesse File download is one of the few features that I'd recommend using a library. Different versions of different browsers do it differently and is a headache to support. If you say you only want to support one version of one browser you are free to take apart the library and see how it works for you.
 
@BenFortune SQL ?
 
9:09 AM
@Mathematics Sadly Outta Luck
 
agree with you, I want to import library, but my archtect does not agree, he is very careful for adding library.
my code supports Chrome, Firefox, IE. but for Safari, it failed :/
 
@Sheepy oh
 
s/adly/hit/ :P
 
s/hit/ooooo/
 
d3/vs/tables/
I need something like this but with a lot more, not sure to extend this or use d3...
 
 
1 hour later…
10:38 AM
hi all i have this line of code and want to change from random numbers to values, possibly in a class , how do i change this line
var visitors = [[1, randNum()-10], [2, randNum()-10], [3, randNum()-10]
 
11:06 AM
Ugh, the shit my boss writes
$.ajax({
    type: 'post',
    url: 'index.php?type=predict_occasion&message='+message,
...
 
that pretty much sums up his knowledge about web development
 
@BenFortune what's wrong with that?
 
11:29 AM
@BenjaminGruenbaum Why would you not pass the message as form data?
Plus an apostrophe would throw mysql errors
And the PHP is littered with global $db;
 
@BenFortune lots of reasons
241
Q: HTTP POST with URL query parameters -- good idea or not?

Steven HuwigI'm designing an API to go over HTTP and I am wondering if using the HTTP POST command, but with URL query parameters only and no request body, is a good way to go. Considerations: "Good Web design" requires non-idempotent actions to be sent via POST. This is a non-idempotent action. It is eas...

global $db sounds awful, but a POST with a query string has legit reasons.
 
@BenjaminGruenbaum global $db also sounds like most normal php codebases :D
 
11:54 AM
anyone know how i change this line from random numbers to a number or even a class ?
var visitors = [[1, randNum()-10], [2, randNum()-10], [3, randNum()-10]
 
What?
 
@BenFortune hi Ben
its a line of code to define points on a chart , as default its using random numbers but i want to change that
 
So... change it?
 
im thinking it should be something like this
var visitors = [[1, .value], [2, 7500], [3, .value2]
is that right ?
 
Remove the periods, why do you think you need them?
 
11:58 AM
because they were in the original
i think 1, .value where 1 = the point on the chart
im using plot.js i think
 
that is not valid.js
 
huh
so what is the corect syntax then ?
is it even possible to integrate classes into this
 
12:43 PM
this is why this was such a bad idea for a keyword. This is so confusing because now I don't know if you mean this or that.
 
@Neal got a message from Ilya
 
12:57 PM
@jAndy this isn't a bad idea for a keyword, it's a bad idea for a concept.
 
1:10 PM
:drools:
 
 
Huh
 
I only see one of you
 
You avatar in chat is normal
 
^ any wild guess as why flex is not working for the highlighted chart ?
 
1:25 PM
@FlyingGambit There's probably something wrong with your code </guess>
 
@Cerbrus Nice guess XD
 
@Feeds Someone found my Terraria storage system.
 
@KendallFrey @SterlingArcher reddit.com/r/PeopleFuckingDying ohh my.
> Videos and GIFs of people fucking dying in a figurative manner.
NSFW/NSFL and/or literal deaths are prohibited and will be removed.
quality sub
@SterlingArcher look at #2 top post reddit.com/r/PeopleFuckingDying/top
 
What the fuck...
 
1:40 PM
@rlemon Hehe, okay xD
 
@rlemon youtube.com/watch?v=DLUDxistCUo best thing since scottish roof guy
 
Hi, im having trouble with a tampermonkey script would anyone be willing to help me?
 
@zeddex 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.
 
it involves this question: stackoverflow.com/questions/40721227/…
but none of the answers work in the script on the page in question
 
windows 10 ; node.js ; angular2 ---> freshly installed, not working ; ideas ?
 
1:54 PM
have you tried restarting your pc? /s
 
haven't ; will try now ; thanks
 
@bvdb use React
 
tried, failed :)
 

« first day (2228 days earlier)      last day (2706 days later) »