« first day (2382 days earlier)      last day (2557 days later) » 

12:03 AM
@RachelDockter what do you mean? Do you have multiple servers behind a load balancer or something?
 
@david no its just one server, i got an assignment recently to make a website where u can host a simple canvas game so i wanted the homepage to be the lobby and when you find a match it will go to another page where you actually played the game
i asked my professor and he said u will disconnect from the server if i leave the page
 
Ah
does it have to be an actual different page or can you make a 'Single Page Application' using something like react or angular so that the connections are persistent?
Otherwise, if you 100% have to do a full page refresh, then you can store some kind of ID in the user's localstorage so that when the player reconnects you can reattach them to the right game
 
It can be single page but i was looking at other websites of the same sort and they had different pages. I was thinking of just storing the users name in a session and when they get on the new page connecting them again and pass in their userId or something
i have about a year to finish it so i got loads of time
 
12:24 AM
making a single page application is probably a good learning experience. It's how most new projects are done nowadays. You can still get the benefits of multiple URLs without having to actually reload the whole page
But otherwise yes, using a username or better yet a userid is another way to go
it also handles cases where they accidentally close the browser tab and reload it
 
how would i go about making a single page application with multiple urls? is that a php thing?
i would like a url like .../game/23847 where someone could link and then spectate that game
 
Nope not php, it's done purely in javascript. Are you doing this in php?
and yeah you can have a url like that
 
i was thinking php and js, so they could sign up and log in with php etc
 
how are you hosting the php? just on your computer or will you put it on a server somewhere?
I guess use whatever technology you're most comfortable with
 
just using xampp on my own computer, although its my final year project so when im finished i should probably host it somewhere
 
12:35 AM
what sort of gamewill you make?
 
just a standard 2 player canvas game, something like checkers
i could make the game easy, its just the functionality of setting up a game, having spectators etc is going to be difficult
 
yeah
I have not used php or xampp before so I can't really help you from that side of things
your original question was about a nodejs server though
not php
 
im actually considering doing it all in just html instead of php, i can connect to a sql database using node to sign up/ log in
 
you could also have node run the actual game and just do updates based on messages from the users
if all the information about the game is on the node server then it's also easier to do spectators
 
yeh thats exacly what i was planning, everything will be done server side
except the client inputs
i could just have an array of current games or something on the server
 
12:41 AM
yeah that would be the easiest
 
so on the homepage where you see everyone thats hosting a game, would that be done using node? I was looking for a kind of table but then it wouldnt update if it was in html
I was thinking just drawing it on a canvas but that seems abit backwards
im not sure if theres a way to update what the user sees in real time apart from a standard canvas
 
You can change html dynamically
so updating an html list or table is definitely doable
frameworks like react and angular make it slightly easier
For truly realtime updates you'd probably want to open a websocket connection to the node server
 
oh really, ill look into that then, i can eaisily send info back to the client on a timer and then hopefully pass that into html to update ill look into that. im using socket.io if thats the same thing
 
1:02 AM
yeah socket.io works too
it also handles a bunch of stuff about connections too from what i hear which will be helpful
 
1:27 AM
@phenomnomnominal sup
 
2:14 AM
yo
 
 
2 hours later…
4:00 AM
<input type = "image" id = "host-game" src = "graphics/buttons/hostGame.png">

$("#host-game").on('click', function()
{
	console.log("hello");
});
would anyone know why thats not working, am i missing something lol
 
whats not working
 
@RachelDockter Do you get an error in the console? There's a few things you can try: Does the code run before the element is on the page? Do you have jquery included?
 
nothing is happening, i have jquery included, i put a console log before the click function and that works
i swear im missing something so simple
and no errors
 
works for me
other than broken image of course
and your unclosed input tag
and your mismatched double and single quotes
 
thats weird i have no idea what im doing wrong then
 
4:06 AM
I've been doing lots of peer review today and one guy on my team is so sloppy with the coding standards :P
 
am i suppose to add </input> at the end?
 
<input />
 
ah, this is a very important project for me so it needs to be perfect
should $("#host-game").on('click', be single or double quotes, is there a standard for it, or does it not matter
 
there are many standards, just pick one and stick with it i guess... we use single quotes
where is your code? is it in the HEAD or the BODY?
 
alright ill go with single, i also moved the click function to script tags under the input and it worked
 
4:08 AM
yeah, that's what was wrong
 
I use single for JS so if you need to do something horrible like create html in a js string the double quotes arent a problem
 
in the body and the click is in an external js document
 
you either need to use the document ready handler or put your code after the html
 
oh yeah lol, the js needs to be in a script tag
 
well i linked the external js in the head tags
 
4:09 AM
yeah that's fine, the problem was you were trying to add a click handler to the button before the button even existed
 
thats stange because i have another project that does the same thing and it worked there without the document.ready function
 
as an aside, are you sure you want to use jquery for this project? if you have a whole year then maybe learning react might be a better idea
 
to me i just have jquery in the head tags and whenever something can be done easily in jquery rather than js ill just use that
most of the code will be in normal js tho
 
okay, whatever you're comfortable with
 
also i added "defer type="text/javascript" to my script tags in the head and its working now
not sure what that did but it works lol
 
4:15 AM
defer would work too
 
ah defer just means when the document has loaded, that makes sense now
 
4:32 AM
hi
anyone know why angular routes show url as profile#!/#about instead of profile#about
 
hmm
 
you probably need to set history to be true somewhere
 
hi , I am using javascript to upload a file , using this
 
@BhargavSushant 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.
1 message moved to Trash can
@BhargavSushant Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
4:46 AM
okay my code got scrapped
 
You need to hit the format button
 
anyone know how to get and change the name of file I selected
it was a simple target.file[] ,
@david
yes just learned that
 
I have bound a keydown event that checks for an Escape key
 
but that is going to fire on every keydown, even when users are typing in a textbox
is that gonna be a problem?
 
4:54 AM
depends how much work it does
 
it closes open modal windows
 
 
1 hour later…
6:12 AM
would an object array with 1 item at index [0], take up less memory than an object array with 1 item at index [50] for example?
 
no it shouldn't do, javascript arrays can be 'sparse' which is what that is called
it might however be slower
because it might not be stored internally as an array, rather as a hashmap type thing
 
right, ok i think thats good then
var hostingGames = {};

var server = new Server();
server.initialise(8081);

server.em.addListener('hostGame', function(userId, userName)
    {
        var hostGame = new HostGame();
        hostGame.initialise(userId, userName);
        hostingGames[userId] = hostGame;

		server.consoleLog('APP', userName + ' is hosting a game. ID: ' + userId);
		server.updateGamesList(hostingGames);
    });
 
don't worry too much about taking up memory though, it's better to get it working and then do profiling to figure out what is actually taking up memory
rather than trying to guess
 
i have this which makes a list of games being hosted but puts them at the index of the player hosting them
so if a player has an id of 354345 it will put it at that index rather than the lowest avaible one, not sure if thats ok
 
yeah that's fine. It's not actually an array you're using, it's an object which is basically a hash
 
6:16 AM
ah ok, is there a limit to the number of index's in an object?
its not like my sites gonna have anymore than 1 person being me testing it but just for good practise
 
nah there's no real limit that you should worry about
 
Hi guys care for a bounty question? stackoverflow.com/questions/43448283/…
 
sweet thanks david
 
i mean there might be one because of weird internal stuff, but you're very unlikely to hit it
 
ok ill leave it as it is then
 
6:17 AM
o.o
@RachelDockter Rachel, that's actually a theoretical question
it depends of the array ;)
 
@MaryDaisySanchez Are you running this in IE? it looks like it might be using an activex thing
 
@KarelG well its an object, im not sure if thats different to an array in terms of the max index but even if its something like 2.1b thats plenty
 
@david i'm using on all browsers IE , firefox chrome opera
 
although if theres an easy way to check for the lowest empty index id use that
 
its for a biometrics i'm not sure where to get this library
 
6:22 AM
@MaryDaisySanchez tip: use console.log for debugging. So many alerts :P
what do you get if you check document.objSecuBSP ?
 
6:37 AM
wtf ?
0
A: Exists (-like) function for jQuery?

JaiWell you can make of your own: function isExist($obj){ return $obj.length>0; } Now you can use: if(isExist($(selector))){ // do somthing here. }

 
@KarelG tip: use debugger flags so you can actually step through the code at point of execution
 
that's 2nd tip
no point to say that if you aren't familiar with the dev console.
 
@KarelG i encounter this issues "document.objSecuBSP.OpenDevice is not a function"
 
tbf, hard to solve if I don't have access to the docs ( I have to download the SDK it seems) Your best bet is to check the documentation if that function really exists in javascript.
 
6:53 AM
I like how it all operates on value level
 
Morning !
 
@MaryDaisySanchez I have a feeling that would only work in IE6 or a similarly ancient browser.
You should probably go with C# or other similarly "native app" language that can communicate with such devices more easily.
The browser had evolved to become a sandboxed environment, with no access to the rest of the system.
 
the error notation has surprised me though
you should get undefined error at document.objSecuBSP (if it doesn't work). So i'm curious what that is
 
7:41 AM
So my node js server returns an object array, i can list each key in its own row in a table but i want to add a button next to each one that will then get the id of the key that it clicked on if that makes sense
would anyone know if this is possible
 
0
Q: How to write test case for below angular service

MukeshI have been trying to write Jasmine test case for below service function, but its failing, Please look in the code below, I have write it down a service "getAllNotificationList" take two parameters an nested array and a number and merge nested array data and create new data, which is working fine...

i am trying to fix this is there anyone can help
 
@RachelDockter <button data-id="<the id here>"> some val</button>, add click event listener on that and in the event handler, use this.dataset.id to retrieve the id of the key
 
@KarelG thanks hold on 1 sec im gonna try that
@KarelG would u be able to take a look please, when i try to substitute my own id, it wont run jsfiddle.net/vz2pxpyr
 
8:00 AM
@RachelDockter Check your console
 
its saying missing ) after argument list but as far as i can see it isnt
 
How do you concatenate?
 
if i leave it with no id, it runs fine so me adding an id wouldnt mess up any brackets
oh lmao
ok im an idiot
that fixed it, thankyou ben
 
😀
 
but if I were you I would use javascript as many as possible
would make the things easier
 
8:06 AM
ah this is even better, thanks karel, how come it would be eaiser over jquery?
 
jquery uses javascript under the hood and it's not sorta relevant these days. If you focus on javascript (not sure if you are going to work as front-end dev later) over jquery, you will understand it better and have a more futureproof knowledge.
 
ahh ok that makes sense, im gonna comment out the jquery library and then fix any errors i get in javascript then
thanks alot for your help karel :)
 
For me, one of the most annoying mis-use of jquery is that people uses $(this).attr('id') to retrieve an id of the element ... but it could be much more simpler (and faster) if they just did this.id ...
 
yeh i kinda found that too, seems more effort than its worth sometimes
 
8:13 AM
if you use jquery for eg slidetoggle and something that requires CSS animations, then it's not an issue. But for just getting id or changing values ... meh ... go to javascript
 
@RachelDockter But then you can brag about quitting jquery and start hating on people who use it.
 
lmao
its just gonna be me and my classmates so they wont mind
 
group work?
 
individual but we work alot together, come to think of it, its just me giving them my code alot of the time lol
but now its our final year and uni, im not gonna help anyone, they will have to pay me or something
 
o/
 
8:24 AM
Guys quick question
I have a component that blocks all click events to its children (with capture: true)
But it also blocks right clicks
(so when I right click it to, say, inspect, it performs unrelated actions that are undesirable)
How can I check, in the event listener, whether or not it was the rmb/mmb I clicked?
 
oh, there's no mention of Vue in the 2017 dev survey: stackoverflow.com/insights/survey/2017
 
@BenFortune Yes, only that's not supported in IE11 (I checked)
All the answers I've found are from 2010 or earlier
 
there's the oncontextmenu thing
 
@towc to me its angular on steroids ( ~ smiles at a prospective flame war ~ )
 
8:30 AM
@towc The problem is that the click handler fires for rmb
 
right click afaik should only fire contextmenu, and left click should only fire click
 
And I don't want it to
(Or rather, I want to block the action being called in the click listener)
 
@MadaraUchiha most likely because contextmenu is also attached to it, so look for that
 
@towc It's not.
I have a very closed list of events I'm listening to
 
well, rmb can't fire a click event
again, afaik
 
8:31 AM
Ah, it's probably the mousedown that's firing
 
@RachelDockter maybe I should ask for some money too for my help 😉
meh, paging issues are annoying
 
haha id be paying so many people on here then
i love this website
 
@MadaraUchiha yeah, that's it
try right clicking on the result
gets green for me
 
we're glad to help. Unless you're a vamp. A vamp of the "help" subspecies
 
@towc Now a different problem it seems
IE marks 1 for lmb, chrome marks 0
 
8:34 AM
... screw IE bro
 
@KarelG That's not an option.
 
did you have tried to use .which instead of .button ?
 
apparently currentTarget is different on rmb and lmb
(open console. Click once on lmb, and once on rmb)
 
@MadaraUchiha That's a classic one
Standard says one thing, IE does another one entirely
 
@Zirak Yup
 
8:39 AM
IIRC spec says 0 = left, 1 = middle, 2 = right
 
.which seems to work fine in both
And consistently
And it's mostly for debugging purposes anyway, so I don't really mind
 
And I think IE disagrees on all except the right code
 
also, there might be a more intuitive jQuery option, if you're using that
 
@towc No jQuery here
 
good.
o/
 
8:40 AM
Although @BenjaminGruenbaum is dying to add it.
 
@MadaraUchiha oh, that works too
 
stab him thrice for us
 
inb4 something something Madara is our jQuery expert something something
 
@MadaraUchiha Another random fact if you care: In single-mouse buttons, ctrl+click (or something like it) brings up the context menu, and some browsers change the relevant codes to be right button, some don't
@BenFortune ppk really did cover everything
 
8:57 AM
@Zirak thanks again :)
 
np
 
9:08 AM
Is it faster to unshift() and pop() or to push() and shift(), in order to keep a specific order of an array?
 
you should keep an index value, set the array's unwanted elements to null, and keep on pushing
alternatively, you can represent your data structure as a bidimensional hillbert curve to save space and maintain structure
 
Hi, did anyone here used OData ever ever however ?
 
@Mathematics It's the only way I get data out of the database
 
@RaisingAgent you have to check what unshift does. Does it add the element to a new array instance and repopulates it, or does it just move the memory address pointer (less likely).
but you can do a jsperf ya know
 
I searched for a jsPerf, didn't find one for this case. probably have to write one myself
 
9:20 AM
@RaisingAgent what library do you use ?
 
@Mathematics SAPUI5
 
@RaisingAgent oh but I am not using SAP though lol
 
@Mathematics I never said I could help you :P
 
@RaisingAgent lol, you are right, thanks for the information though
 
kekness
 
9:22 AM
@RaisingAgent I never seen, heard that word before :P
 
it means darkness and chaosness
 
10:17 AM
anyone knows js documentation generator - preferably online ?
 
@RaisingAgent i'm curious of the results though
 
hi
 
@Relisora 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.
 
eh SugarCRM is a plethora of bugfest karmainsecurity.com/tales-of-sugarcrm-security-horrors
 
10:39 AM
Doesn't surprise me
 
10:58 AM
@rlemon Do you know anything about MIDI?
I'll describe to you a problem: I have an ADC (analog->digital converter), it's a thing which connects my guitar and computer so I can record and put effects on it etc.
Problem is there's a certain types of guitar pedals (e.g. wah or expression) which aren't simply on/off, they have different levels of "being pressed".
You can adjust their computer-simulation breathren with your mouse, but that's mighty uncomfortable to do while playing
 
@BenFortune It's also noted in the conclusion that Apple would use SugarCRM's system for their own CRM system
 
So I looked up a pedal which is "dumb" and can be wired up to my program to control those pedals
Nothing of the sort exists, which is weird. I also asked around in shops and such. Nothing at all
I know a similar thing exists for electronic pianos, specifically the sustain pedal, and I think you connect the pedal to the keyboard with a midi connection
Which leads us to the present day
Also paging @phenomnomnominal because he's smart
 
@Loktar playing switch level + 1: reddit.com/r/gaming/comments/676k7z/…
 
@taco eh missed it, ubuntu
 
@Mosho Reading the discussion linked, is your program only linux-baed? Because you can ask the kernel to tell you when you're orphaned
 
11:13 AM
yeah
 
In C that's calling prctl(PR_SET_PDEATHSIG, SIGHUP) for instance sends a SIGHUP when your parent dies
Search for PR_SET_PDEATHSIG in man 2 prctl
(@FlorianMargaine you like this sort of things)
 
I ended up using a --no-autorestart flag for the process manager (pm2)
so it won't kill the server and I don't have to deal with the children
 
pfft cheats
 
might have a few orphans still
but meh
 
@Mosho Alternatively, could you ask pm2 to signal you nicely when it's about to kill you so you can reap your children?
 
11:23 AM
the process errored out regardless of pm2
 
ah
 
pm2 tries to restart it 15 times after that by default
creating 2 leaky phantomjs processes each time
and boom server ded
 
oh, then writing a pidfile could help with that
 
I was about to do just that
 
When you create children add their pids to something in /var/fuckwhere and when you start up destroy whatever's in it
 
11:24 AM
but it's a little icky
 
Make sure to clean it up when you exit cleanly
@Mosho yeah, but it's a well-known concept
 
and @FlorianMargaine said that pid's are reused
so I would have to check if the corresponding processes match phantom
 
That's true, that's why it's important to clean up when things exit cleanly
 
it's a service, really
 
@Zirak I saw something like that on Reddit the other day, he had it setup as a shortcut in vim
 
11:29 AM
it would only exit if it crashes or I kill it from the console
 
@BenFortune Not on/off or something which identifies as a keyboard and sends a keypress
@Mosho Services employ pidfiles extensively
As long as you clean up after yourself AND the phantom children don't die and get their pids recycles until it gets back up...
 
@Zirak Ah yeah, keyboard HID. github.com/alevchuk/vim-clutch
 
Hi all
 
want some excuses but cannot invent one at your own? Use excusator !
Some are ...
 
11:52 AM
"I don't believe in deadlines. "
truth
most of these would be a decent way to get fired
well, all of these
 
0
Q: Using node tls package is it possible to define something like read timeout?

SrleFrom my testing between TCP client and TCP server using node tls package, there is no any defined timeout. Basically as it seems one side could wait for hours for answer without any error or timeout event occur. What one can do is something like following: socket.setTimeout(10000) socket.on('ti...

beers to anyone who can help :D
 
> "Have you met Ted?"
10/10
 
hi there, is there a simple decent way to count the number of nested items on a property name in nested object instances? example :
"object":{
    "id":"1",
    "obj_property":{
        "id":"4",
        "obj_property":{
            "id":"15",
            "obj_property":null
        }
    }
}
how to know how many "obj_property" are in the root object?
like folders / subfolders
 
tail-recursion with level of depth as tail ?
 
for now I'm doing it with a while loop, but wonder if there are other 'smarter' and faster ways to do that...
 
so earth is "/sites/default"?
 
/thumbnails/ 4960x4000
 
12:25 PM
extreme thumbnails
 
i recall that NASA has a funny 404 message
something about beyon' the event horizon
 
while "funny" may be a stretch. True.
 
@Zirak nice, didn't know about PDEATHSIG
 
12:42 PM
why did this Q got 2 upvotes? stackoverflow.com/questions/43588090/…
 
With commonJS, is it possible to have a bunch of JS functions in one file and require them in another, or must all of them be in separate files?
I'm reading this article: blog.risingstack.com/…
 
noone starred forall.js? :(
I came here to rant about Array.includes and how it's a useless piece of crap
 
What's up with it?
 
@BenFortune In Good Languages(tm) we do it by find (== x) arr. Why do we need another function on top of find (and indexOf)?
 
@BartekBanachewicz because why not?
includes = find . (==)
or something like that
 
12:57 PM
@KendallFrey can't do that, it takes two things. includes x = find (== x) with eta-reduced arr.
 
I'm a bit rusty, what's the difference?
 
f . g = \x -> f (g x)
 
I know what . is
 
mm, maybe it works
 

« first day (2382 days earlier)      last day (2557 days later) »